API-style comments and ktlint formatting
Every comment is reduced to its first sentence plus @param, @return and @throws tags. Comment lines: 20040 to 8526. ktlint 1.8 applied with its default (official Kotlin) style across all modules; 262 files reformatted. The 264 remaining ktlint findings are naming and filename rules, which are code changes, and are left alone. Comments and formatting only. 1208 tests pass, counted from the XML. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
8a7f40fb13
commit
2fa430f21c
@@ -9,20 +9,15 @@ import kotlin.test.assertTrue
|
||||
|
||||
/**
|
||||
* Handing a contact the bridge you use (§6.19).
|
||||
*
|
||||
* The security property under test is that this is an OFFER. A bridge
|
||||
* line routes every relay connection through a machine somebody else chose. A
|
||||
* contact, or whoever has taken their account, could not read the traffic,
|
||||
* because the ratchet does not care what carries it, but they would learn who
|
||||
* is online and when, and could cut them off. So nothing in the engine or the
|
||||
* transport may apply one; only the person it was sent to can.
|
||||
*/
|
||||
class BridgeOfferTest {
|
||||
|
||||
private val line =
|
||||
"obfs4 198.51.100.7:4444 0123456789ABCDEF0123456789ABCDEF01234567 " +
|
||||
"cert=" + java.util.Base64.getEncoder()
|
||||
.encodeToString(ByteArray(52) { 0xAB.toByte() }).trimEnd('=') +
|
||||
"cert=" +
|
||||
java.util.Base64
|
||||
.getEncoder()
|
||||
.encodeToString(ByteArray(52) { 0xAB.toByte() })
|
||||
.trimEnd('=') +
|
||||
" iat-mode=0"
|
||||
|
||||
@Test
|
||||
@@ -33,11 +28,10 @@ class BridgeOfferTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* `1`, not `true`. iOS decodes `ctl` as a number, and a boolean does
|
||||
* not merely fail to set the flag, it fails the whole envelope's decode
|
||||
* and falls through to the plain-text path, which is how an Android user
|
||||
* once sent an iPhone a bubble of raw JSON. Asserted on the wire rather
|
||||
* than through the parser, because the parser here would accept both.
|
||||
* `1`, not `true`. iOS decodes `ctl` as a number, and a boolean does not
|
||||
* merely fail to set the flag, it fails the whole envelope's decode and
|
||||
* falls through to the plain-text path, which is how an Android user once
|
||||
* sent an iPhone a bubble of raw JSON.
|
||||
*/
|
||||
@Test
|
||||
fun `the control flag is the number one on the wire`() {
|
||||
@@ -47,9 +41,7 @@ class BridgeOfferTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* What an older build does with this. A build that has never heard
|
||||
* of this kind must swallow it, not draw it. `ctl` is what makes that true,
|
||||
* and membership of CONTROL is what routes it to a handler here.
|
||||
* What an older build does with this.
|
||||
*/
|
||||
@Test
|
||||
fun `an offer is control traffic and never renders`() {
|
||||
@@ -59,9 +51,9 @@ class BridgeOfferTest {
|
||||
assertTrue(Content.Kind.BRIDGE in Content.Kind.CONTROL)
|
||||
}
|
||||
|
||||
/** The line crosses whole. Rebuilding it from parsed fields at the far
|
||||
* end would lose the `cert=` that makes it usable and the fingerprint
|
||||
* somebody may want to check against another source. */
|
||||
/**
|
||||
* The line crosses whole.
|
||||
*/
|
||||
@Test
|
||||
fun `the line is carried verbatim`() {
|
||||
val awkward = "obfs4 [2001:db8::1]:9001 ABC cert=zz+/9 iat-mode=1 sni=x.example"
|
||||
@@ -76,8 +68,7 @@ class BridgeOfferTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* An empty or whitespace line is not an offer. Storing one would put an
|
||||
* un-actionable row on the settings screen with somebody's name against it.
|
||||
* An empty or whitespace line is not an offer.
|
||||
*/
|
||||
@Test
|
||||
fun `an empty line is not an offer`() {
|
||||
@@ -85,10 +76,7 @@ class BridgeOfferTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* The engine validates nothing, deliberately. Whether a line is
|
||||
* usable is asked on the screen where a person decides, so a bad one is
|
||||
* reported to them with a reason. Rejecting it here would drop it in
|
||||
* silence, the exact failure the settings screen was built to end.
|
||||
* The engine validates nothing, deliberately.
|
||||
*/
|
||||
@Test
|
||||
fun `a malformed line still arrives, to be judged where it can be explained`() {
|
||||
|
||||
Reference in New Issue
Block a user