e3a2378c34
Calls: `call` was missing from the known content types, so every offer was acknowledged and dropped; the call screen column now fills the width (the avatar jumped left after hang-up); a ring started from a push ends after 12 s when no offer arrives; STUN fallback when no TURN credentials. Registration: X-Sepot-Identity-Proof lets a new device reclaim an existing identity; retry backs off from 30 s to 10 min and exposes a conflict flag. Prekeys: PrekeysLow triggers a batch of 50 one-time prekeys via POST /v1/keys; the signed prekey rotates weekly, the Kyber prekey monthly. Messaging: crypto operations run serially (concurrent encrypts derived the same message key); stop() waits for in-flight deliveries (auto-lock between decrypt and persist lost messages); disappearing-message cleanup no longer overwrites fresh messages; a push wake-up reconnects stale connections; the outbox carries polls and mentions; length limits on wire input. Storage: a duress session never exposes the real identity or phrase, does not start networking and cannot touch the keystore; deleting data in a duress session leaves the real account alone; PIN guessing is throttled (5 misses, then 30 s doubling up to 15 min); the duress blob shares the salt so unlock time does not reveal which PIN was entered; iOS keychain items are this-device only; biometrics are biometric-only; screen security defaults to on and is applied after unlock; tapjacking filter in MainActivity. Tests: content types, shared-salt unwrap, duress isolation.
50 lines
1.8 KiB
Dart
50 lines
1.8 KiB
Dart
import 'dart:typed_data';
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:sepot/core/crypto/dek_wrap.dart';
|
|
|
|
/// Skutečný a nátlakový blob se sdílenou solí se zkouší jednou derivací:
|
|
/// který PIN padl, nejde poznat z času odemčení.
|
|
void main() {
|
|
final real = Uint8List.fromList(List.generate(32, (i) => i));
|
|
final decoy = Uint8List.fromList(List.generate(32, (i) => 255 - i));
|
|
// Nejslabší povolené parametry — test nemá čekat na 64 MiB derivaci.
|
|
const m = DekWrap.floorMemoryKiB;
|
|
const t = DekWrap.floorIterations;
|
|
|
|
test('sdílená sůl: oba PINy se najdou, špatný PIN padne', () async {
|
|
final wReal = await DekWrap.wrap(
|
|
dek: real, pin: '111111', memoryKiB: m, iterations: t);
|
|
final salt = DekWrap.saltOf(wReal);
|
|
final wDecoy = await DekWrap.wrap(
|
|
dek: decoy, pin: '222222', memoryKiB: m, iterations: t, salt: salt);
|
|
expect(DekWrap.saltOf(wDecoy), salt);
|
|
|
|
final (i1, d1) = await DekWrap.unwrapFirstMatching(
|
|
wrapped: [wReal, wDecoy], pin: '111111');
|
|
expect(i1, 0);
|
|
expect(d1, real);
|
|
|
|
final (i2, d2) = await DekWrap.unwrapFirstMatching(
|
|
wrapped: [wReal, wDecoy], pin: '222222');
|
|
expect(i2, 1);
|
|
expect(d2, decoy);
|
|
|
|
await expectLater(
|
|
DekWrap.unwrapFirstMatching(wrapped: [wReal, wDecoy], pin: '333333'),
|
|
throwsA(isA<WrongPinException>()),
|
|
);
|
|
});
|
|
|
|
test('různé soli (starší instalace) fungují dál', () async {
|
|
final wReal = await DekWrap.wrap(
|
|
dek: real, pin: '111111', memoryKiB: m, iterations: t);
|
|
final wDecoy = await DekWrap.wrap(
|
|
dek: decoy, pin: '222222', memoryKiB: m, iterations: t);
|
|
final (i, d) = await DekWrap.unwrapFirstMatching(
|
|
wrapped: [wReal, wDecoy], pin: '222222');
|
|
expect(i, 1);
|
|
expect(d, decoy);
|
|
});
|
|
}
|