fix: scope server pins by port (fumi-core rev 1468f3c)
This commit is contained in:
parent
996e879509
commit
7d2a147fec
16 changed files with 109 additions and 79 deletions
|
|
@ -8,6 +8,7 @@ import "dart:typed_data";
|
|||
import "package:flutter_test/flutter_test.dart";
|
||||
import "package:hive_flutter/hive_flutter.dart";
|
||||
|
||||
import "package:smol_mail/smol/address.dart";
|
||||
import "package:smol_mail/smol/store.dart";
|
||||
|
||||
Uint8List randomBytes(int n) =>
|
||||
|
|
@ -66,11 +67,11 @@ void main() {
|
|||
expect(store.allPins(), isEmpty);
|
||||
// A syntactically valid key: the system server's, a real 52-char form.
|
||||
const key = "lm2gqd7e5q67xq3isc5hx6jfj2q7a7xvq4l7trctxipudujovmgq";
|
||||
store.pinServer("example.org", key);
|
||||
expect(store.serverPin("example.org"), key);
|
||||
store.pinServer("example.org", key, defaultPort);
|
||||
expect(store.serverPin("example.org", defaultPort), key);
|
||||
expect(store.allPins().length, 1);
|
||||
await store.unpinServer("example.org");
|
||||
expect(store.serverPin("example.org"), isNull);
|
||||
await store.unpinServer("example.org", defaultPort);
|
||||
expect(store.serverPin("example.org", defaultPort), isNull);
|
||||
});
|
||||
|
||||
test("wipe clears every secret and mark, overwriting the master", () async {
|
||||
|
|
@ -80,7 +81,7 @@ void main() {
|
|||
// The store's own copy, read back before the wipe.
|
||||
final stored = store.master()!;
|
||||
store.pinServer("example.org",
|
||||
"lm2gqd7e5q67xq3isc5hx6jfj2q7a7xvq4l7trctxipudujovmgq");
|
||||
"lm2gqd7e5q67xq3isc5hx6jfj2q7a7xvq4l7trctxipudujovmgq", defaultPort);
|
||||
store.markRead("cd" * 32);
|
||||
|
||||
await store.wipe();
|
||||
|
|
@ -93,7 +94,7 @@ void main() {
|
|||
expect(master.every((b) => b == 0), isFalse);
|
||||
expect(store.master(), isNull);
|
||||
expect(store.identity(), isNull);
|
||||
expect(store.serverPin("example.org"), isNull);
|
||||
expect(store.serverPin("example.org", defaultPort), isNull);
|
||||
expect(store.isRead("cd" * 32), isFalse);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue