475 Commits

Author SHA1 Message Date
yet
f2dc1388ca refactor(noise/protocol): convert remaining log concatenations to templates
Missed by the prior idiomatic-polish pass: SymmetricState had 13 Log.d
calls still using "..." + bytesToHex(...) instead of string templates.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 18:26:30 +04:00
yet
f1645e73f2 refactor(noise/protocol): polish Kotlin idioms and remove Java legacy
Address IDE/compiler warnings across the protocol/ package after the
Java to Kotlin migration:

- Replace reference-identity ByteArray checks `!=` with `!==` in
  ChaChaPoly/AESGCM*CipherState (in-place encrypt/decrypt guards) to
  silence the "dangerous array comparison" warning while preserving
  the original semantics.
- Drop `java.util.Arrays.fill` and `Arrays`-style helpers in favour of
  ByteArray.fill / copyInto / copyOfRange where appropriate. Cold paths
  in NewHopeDHState, Curve25519DHState, Curve448DHState and parts of
  SymmetricState now use Kotlin extensions; tight crypto inner loops
  (HMAC body, ChaChaPoly) keep System.arraycopy intentionally.
- Use property access (`digestLength`) instead of `getDigestLength()`.
- Fold redundant if/else into `if-expression`, drop redundant
  `val space: Int` + assignment, redundant `Companion.` qualifiers,
  and unused `val cipher` re-assign in fork().
- Rename `prev_h` to `prevH` (style).
- Replace string concatenation with templates in log statements and
  exception messages.
- Convert unused catch parameters `e` to `_` and remove stale local
  `var index: Int` in hmac().
- Strip stale `@param secondaryKey/offset/length` KDoc block above
  SymmetricState.split (the params moved to the merged doc).
- Drop dead `check(!(local == null || remote == null))` from
  HandshakeState.mixDH — Kotlin types are already non-null.

Crypto behaviour is unchanged; output of every method matches the
prior Kotlin/Java implementation byte-for-byte.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 18:18:23 +04:00
yet
544d569708 refactor(noise): update NoiseSession for Kotlin-property accessors
External callers must use the property form for HandshakeState
and CipherStatePair members that the protocol package now exposes
as `val`s:

- handshakeState.getLocalKeyPair()    -> handshakeState.localKeyPair
- handshakeState.getAction()          -> handshakeState.action
- handshakeState.getRemotePublicKey() -> handshakeState.remotePublicKey
- handshakeState.getHandshakeHash()   -> handshakeState.handshakeHash
- cipherPair.getSender() / getReceiver() -> .sender / .receiver

DH operations with arguments (`setPrivateKey`, `getPublicKey`, etc.)
remain regular method calls.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 18:00:24 +04:00
yet
84f70ff12d refactor(noise/protocol): migrate HandshakeState to Kotlin
- Use Kotlin properties (`protocolName`, `handshakeHash`) and update
  every getter call (`getDHName/getPublicKeyLength/getMACLength/
  getSharedKeyLength/getProtocolName/getHandshakeHash`) to the new
  property names exposed by the migrated DHState / SymmetricState /
  CipherState interfaces.
- Initialize `pattern` non-null via `requireNotNull(lookup(...))`,
  and give the other late-init `var` fields (`patternIndex`,
  `preSharedKey`, `prologue`) sensible defaults so the class
  compiles cleanly.
- Resolve smart-cast errors on mutable nullable fields (`prologue`,
  `fixedEphemeral`, `fixedHybrid`, `localHybrid`) by copying to
  local `val`s before use.
- Replace `preSharedKey != null` / `mixPreSharedKey(preSharedKey)`
  guards with `?.let` blocks, and pass `localKeyPair!!` etc. into
  `mixPublicKey` to satisfy its now-non-null parameter.
- Tighten the cipher/hash name locals in the protocol-name parser
  from `String?` to `String` so the SymmetricState constructor
  accepts them.
- Token-processing loop, fallback bookkeeping and message buffer
  layout are unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 18:00:06 +04:00
yet
1f2c62d205 refactor(noise/protocol): migrate SymmetricState to Kotlin
- Expose `protocolName` as a non-null Kotlin property and rename the
  IDE's `mACLength` accessor to `macLength` (delegates to
  `cipher.macLength`).
- Update internal `dh.getPublicKeyLength()` calls to use the new
  property form.
- Rewrite the HMAC inner/outer-pad XOR loops as `for`-in-range with
  an explicit `.toByte()` on the result, satisfying Kotlin's
  stricter Int-vs-Byte rules.
- Keep `split()`'s `secondaryKey` parameter nullable to match the
  original Java contract; an empty buffer is substituted when null
  so the HKDF helper signature can stay non-null.
- HKDF/HMAC/handshake-hash logic is otherwise unchanged, including
  the iOS-parity debug logging.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:59:54 +04:00
yet
6f8fcf8022 refactor(noise/protocol): migrate AESGCMFallbackCipherState to Kotlin
- Override CipherState properties; initialize `val` fields inline.
- Rewrite the big-endian 4-byte CTR-counter increment at iv[12..15]
  as an explicit `(iv[i] + 1).toByte()` chain — Kotlin rejects the
  `++(iv[15])` form on Byte array elements.
- Replace `Arrays.fill(arr, 0.toByte())` with `arr.fill(0)` and fix
  the GHASH-tag XOR loop to cast back to Byte explicitly.
- Rijndael CTR keystream and GHASH paths preserved byte-for-byte.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:59:39 +04:00
yet
e0a390996f refactor(noise/protocol): migrate AESGCMOnCtrCipherState to Kotlin
- Override CipherState properties; tighten `initializeKey` parameter
  type to non-null `ByteArray`.
- Promote the constructor to a `@Throws(NoSuchAlgorithmException)`
  primary constructor with the `Cipher` instance assigned once as a
  non-null `val`, removing the bogus `cipher: Cipher? = null`
  initializer the IDE emitted.
- Replace `Arrays.fill(arr, 0.toByte())` with `arr.fill(0)`.
- Inline-byte XOR loop in `encryptWithAd` now casts back to `Byte`
  explicitly to satisfy Kotlin's stricter type rules.
- `fork()` rethrows the (impossible) NoSuchAlgorithmException as
  IllegalStateException instead of returning null — matches the
  non-null contract on `CipherState.fork`.
- AES/CTR keystream and GHASH paths preserved byte-for-byte.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:58:47 +04:00
yet
eabe6eb622 refactor(noise/protocol): migrate ChaChaPolyCipherState to Kotlin
- Override CipherState properties (`cipherName`, `keyLength`,
  `macLength`) instead of Java-style getters.
- Initialize `val` fields inline and drop the now-empty constructor
  `init` block.
- Replace `Arrays.fill(arr, 0.toByte())` with `arr.fill(0)` and
  `Arrays.fill(intArr, 0)` with `intArr.fill(0)`.
- Tighten counter increments (`++input[12]`) — Kotlin no longer needs
  the parenthesized form the IDE emitted.
- Crypto path (ChaCha20 keystream, Poly1305 MAC, AD padding) is
  unchanged byte-for-byte.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:58:05 +04:00
yet
2b4db2f634 refactor(noise/protocol): migrate NewHopeDHState to Kotlin
- Override DHState/DHStateHybrid properties idiomatically; collapse
  branchy length getters via single-expression `if`.
- Replace `Arrays.fill` and `arraycopy` of in-memory key buffers
  with `ByteArray.copyOf()` where the intent is "duplicate buffer".
- Use safe `?.let` / local `val` patterns for the nullable `nh`,
  `publicKey`, `privateKey` fields to satisfy Kotlin smart-cast rules.
- Restructure the if/else-if chains in `calculate` and `copyFrom`
  as `when` blocks for readability.
- Crypto parity preserved: `shareda` and the BobCalculated arraycopy
  intentionally use offset=0 to match the original Java, which never
  honored the caller's `offset` parameter; documented in a comment.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:57:54 +04:00
yet
f3306091d5 refactor(noise/protocol): migrate Curve448DHState to Kotlin
- Override DHState properties instead of Java-style getters.
- Use `ByteArray.fill(0)` in place of `Arrays.fill(arr, 0.toByte())`.
- Preserve bit-identical crypto behavior (56-byte key sizes,
  Curve448.eval call signature, constant-time null-key scan).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:57:40 +04:00
yet
e7c0f28f76 refactor(noise/protocol): migrate Curve25519DHState to Kotlin
- Override DHState properties (`dhName`, `publicKeyLength`,
  `privateKeyLength`, `sharedKeyLength`) instead of Java-style getters.
- Replace `Arrays.fill(arr, 0.toByte())` with `arr.fill(0)`.
- Drop redundant `val dh = other` alias after the `is` smart cast.
- Preserve bit-identical crypto behavior (Curve25519.eval ordering,
  null-public-key constant-time scan, mode bitfield semantics).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:57:31 +04:00
yet
2655aa7636 refactor(noise/protocol): align DHStateHybrid with non-null DHState
- Match the tightened `copyFrom` signature on DHState by making the
  primary `other` parameter non-null while keeping `remote` nullable
  (a missing peer is meaningful for hybrid algorithms).
- Note the inheritance relationship between the single- and two-arg
  copyFrom overloads.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:57:22 +04:00
yet
c04027774f refactor(noise/protocol): migrate DHState interface to Kotlin
- Convert getDHName/getPublicKeyLength/getPrivateKeyLength/getSharedKeyLength
  from Java getters into idiomatic Kotlin `val` properties.
- Tighten nullability: key buffers and DH peer parameters are non-null
  per the original Java @param contract; isNullPublicKey kept as a
  function so existing call sites (`isNullPublicKey()`) keep resolving.
- Trim redundant KDoc; preserve upstream license header.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:56:13 +04:00
yet
597d9a1ba9 refactor(noise/protocol): drop invalid @JvmName on CipherState.macLength
- Remove `@get:JvmName("getMACLength")` — Kotlin rejects @JvmName on
  interface getters and all remaining callers in this module are Kotlin.
- macLength is now exposed idiomatically as a Kotlin property.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:43:48 +04:00
yet
fbb1342439 Convert CipherStatePair from Java to Kotlin 2026-05-15 17:37:47 +04:00
yet
8b3fe53c99 Rename .java to .kt 2026-05-15 17:37:47 +04:00
yet
e8882d6ab1 Convert CipherState to Kotlin 2026-05-15 17:36:07 +04:00
yet
ec60cb3543 Rename .java to .kt 2026-05-15 17:36:07 +04:00
yet
67808f22b8 Convert Pattern.java to Kotlin and refactor lookup logic to use a Map. 2026-05-15 17:32:46 +04:00
yet
f7477d87e9 Rename .java to .kt 2026-05-15 17:32:46 +04:00
yet
bea44f988f Convert Noise utility class to Kotlin
- Migrate `Noise.java` to `Noise.kt`.
- Refactor factory methods using Kotlin `when` expressions and destructuring.
- Use `ByteArray.fill()` and `copyOfRange()` for internal utility functions.
- Update reflection logic in `throwBadTagException` for better readability.
- Apply `@JvmStatic` and `const` to maintain compatibility with existing Java callers.
2026-05-15 17:29:34 +04:00
yet
f9923992f0 Rename .java to .kt 2026-05-15 17:29:34 +04:00
yet300
f09d4b90d3 Update ChaChaPolyCipherState to access ChaChaCore via INSTANCE field 2026-05-09 16:52:06 +04:00
yet300
5693bbfcd8 refactor(crypto): migrate NewHope and NewHopeTor implementations to Kotlin
- Ported the NewHope and NewHopeTor key exchange algorithms from Java to idiomatic Kotlin.
- Maintained strict functional parity with the original verified Java implementation.
- Preserved all necessary cryptographic lookup tables (NTT Montgomery, bit-reversal) to ensure mathematical correctness.
- Converted Keccak-f[1600] and ChaCha20 core algorithms into more compact Kotlin structures while retaining constant-time execution safety.
- Ensured seamless Java interoperability by using `const val` for protocol constants like `SENDABYTES` and `SENDBBYTES`.
- Improved overall code readability and removed legacy/redundant constructs.
2026-05-09 16:52:06 +04:00
yet300
10a84ca56c Rename .java to .kt 2026-05-09 16:52:06 +04:00
yet300
2c7fad6abc Convert GHASH to Kotlin 2026-05-09 16:52:06 +04:00
yet300
0963c2a3cc Rename .java to .kt 2026-05-09 16:52:06 +04:00
yet300
afea44b33a Convert Curve25519 and Curve448 to Kotlin 2026-05-09 16:52:06 +04:00
yet300
5c9a229df4 Rename .java to .kt 2026-05-09 16:52:06 +04:00
yet300
820618e7c9 Refactor: Convert BLAKE2b and BLAKE2s hash functions to pure Kotlin
- Translated `Blake2bMessageDigest` and `Blake2sMessageDigest` to Kotlin.
- Replaced JVM-bound `java.util.Arrays` and `System.arraycopy` with
  Kotlin's native `.fill()` and `.copyInto()`.
- Fixed nullable array type `Array<ByteArray?>` to `Array<ByteArray>`
  for the `sigma` permutation matrix, removing the need for `!!` assertions.
- Refactored `while` loops into idiomatic Kotlin `for` loops in the `transform`
  functions.
- Eliminated mutable parameter shadowing warnings by introducing
  `currentOffset` and `remainingLen` local variables.
2026-05-09 16:52:06 +04:00
yet300
7cc35d7f21 Rename .java to .kt 2026-05-09 16:52:06 +04:00
yet300
544e51ff6b Refactor: Convert SHA-256 and SHA-512 to pure Kotlin for KMP
- Translated `SHA256MessageDigest` and `SHA512MessageDigest` to Kotlin.
- Removed `java.util.Arrays` and `System.arraycopy` dependencies, using
  Kotlin's native `.fill()` and `.copyInto()`.
- Refactored legacy `while` loops into idiomatic Kotlin `for` loops.
- Improved variable scoping in the `transform` function by declaring
  local variables at the point of use.
2026-05-09 16:52:06 +04:00
yet300
c11f5258e3 Rename .java to .kt 2026-05-09 16:52:06 +04:00
yet300
a68efc8921 Refactor: Convert RijndaelAES to pure Kotlin for KMP
- Translated `RijndaelAES.java` to Kotlin.
- Removed JVM-specific `java.util.Arrays` dependency, utilizing Kotlin's
  `.fill()`.
- Refactored C-style variable declarations, moving them closer to their
  usage scope for better Kotlin idiomatics.
- Retained the original lookup tables (S-boxes) and bitwise logic to
  ensure the fallback software AES implementation remains cryptographically
  accurate.
2026-05-09 16:52:06 +04:00
yet300
cf0a767809 Rename Destroyable1 to Destroyable and convert ChaChaCore and Poly1305 to Kotlin 2026-05-09 16:52:06 +04:00
yet300
240635ccfe Rename .java to .kt 2026-05-09 16:52:06 +04:00
yet300
6ac2769f63 Migrate ChaChaCore, Poly1305, and Destroyable to Kotlin
- Translated `ChaChaCore.java` and `Poly1305.java` to Kotlin.
- Replaced JVM-specific dependencies (`java.util.Arrays`, `System.arraycopy`)
  with Kotlin Standard Library equivalents (`.fill()`, `.copyInto()`)

- Refactored `while` loops into idiomatic Kotlin `for` loops.
2026-05-09 16:52:06 +04:00
GitHub Action
1d99434a25 Automated update of relay data - Sun May 3 06:54:32 UTC 2026 2026-05-03 06:54:32 +00:00
GitHub Action
911c80db0e Automated update of relay data - Sun Apr 26 06:41:15 UTC 2026 2026-04-26 06:41:16 +00:00
GitHub Action
c332fb2ff1 Automated update of relay data - Sun Apr 19 06:37:36 UTC 2026 2026-04-19 06:37:36 +00:00
GitHub Action
47adcca1e1 Automated update of relay data - Sun Apr 12 06:35:32 UTC 2026 2026-04-12 06:35:32 +00:00
GitHub Action
42f6cf9d7f Automated update of relay data - Sun Apr 5 06:29:20 UTC 2026 2026-04-05 06:29:20 +00:00
callebtc
4dfec917c8
Revert "voice note player ui (#680)" (#690)
This reverts commit bc8909bab0d40797e57c2f791e7a1a4b0ce5b842.
1.7.2
2026-03-30 10:21:38 +02:00
callebtc
e3c7bd5346
Revert "update input button styling (#682)" (#689)
This reverts commit ce86f4ec2fcecf7067ca850a42dd585f6eeded71.
2026-03-30 10:20:25 +02:00
callebtc
be1a2ec914
update version (#688) 2026-03-30 10:14:32 +02:00
GitHub Action
426e4f0994 Automated update of relay data - Sun Mar 29 06:27:23 UTC 2026 2026-03-29 06:27:23 +00:00
Ovi
5b0a7d0ce9
fix: add input validation for protocol decoding and fragment reassembly (#666)
* fix: add input validation for protocol decoding and fragment reassembly

* fix:subtract the old entry's size before adding the new one, so duplicate/retransmitted fragments don't inflate the counter

* fix: FragmentManager.handleFragment() can be entered concurrently (e.g., fragments for the same fragmentID arriving from multiple peers/relays). In order for this to happen multiple devices would be needed to connect to the mesh. even with a per-fragmentID byte cap, an attacker could open many fragment IDs at once and force the device to buffer lots of fragment data overall (risking memory pressure/OOM). In this fix we made fragments atomic and thread safe. When a fragment index is retransmitted, we compute the size delta (new - old) so duplicates don’t inflate counters and can’t be used to bypass limits. Under heavy load/attack the app will drop/reject fragment sets earlier instead of growing memory usage without bound to reduce risk of oom. tested on pixel 6 and pixel 8.

* fix: add fragmenttest
2026-03-26 16:24:29 +01:00
a1denvalu3
96b35e957c
Add 'Send private message' action to chat user sheet (#649)
* Add 'Send private message' action to chat user sheet

* Change 'Send private message' action color to purple

* Fix: Resolve short ID against all participants, not just cached nicknames

* Fix: Correctly open private chat sheet for mesh peers

---------

Co-authored-by: a1denvalu3 <>
2026-03-25 14:45:36 +01:00
a1denvalu3
dac81b2c3b
fix: use CSPRNG for heartbeat intervals (#685) 2026-03-25 14:42:53 +01:00
Clare Kinery
ce86f4ec2f
update input button styling (#682) 2026-03-25 14:42:24 +01:00