@open-e2ee/signal-protocol-sdk 12.0.0 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADAPTERS.md +3 -0
- package/ARCHITECTURE.md +4 -4
- package/CHANGELOG.md +165 -0
- package/README.md +1 -1
- package/SECURITY.md +2 -2
- package/TROUBLESHOOTING.md +7 -7
- package/client/README.md +40 -0
- package/device/README.md +29 -3
- package/dist/client/client.d.ts +8 -0
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +26 -3
- package/dist/client/client.js.map +1 -1
- package/dist/client/config.d.ts +19 -12
- package/dist/client/config.d.ts.map +1 -1
- package/dist/client/config.js.map +1 -1
- package/dist/client/event-hooks.d.ts +28 -0
- package/dist/client/event-hooks.d.ts.map +1 -1
- package/dist/client/event-hooks.js +1 -0
- package/dist/client/event-hooks.js.map +1 -1
- package/dist/client/group-init-status.d.ts +21 -0
- package/dist/client/group-init-status.d.ts.map +1 -0
- package/dist/client/group-init-status.js +156 -0
- package/dist/client/group-init-status.js.map +1 -0
- package/dist/client/hosted-device-link.d.ts +97 -0
- package/dist/client/hosted-device-link.d.ts.map +1 -0
- package/dist/client/hosted-device-link.js +149 -0
- package/dist/client/hosted-device-link.js.map +1 -0
- package/dist/client/hosted-http-error.d.ts +30 -0
- package/dist/client/hosted-http-error.d.ts.map +1 -0
- package/dist/client/hosted-http-error.js +34 -0
- package/dist/client/hosted-http-error.js.map +1 -0
- package/dist/client/hosted-presence.js +1 -1
- package/dist/client/hosted-presence.js.map +1 -1
- package/dist/client/hosted-profile-keys.js +1 -1
- package/dist/client/hosted-profile-keys.js.map +1 -1
- package/dist/client/hosted-sandbox-identity.d.ts +3 -3
- package/dist/client/hosted-sandbox-identity.js +3 -3
- package/dist/client/hosted-transport.d.ts +0 -11
- package/dist/client/hosted-transport.d.ts.map +1 -1
- package/dist/client/hosted-transport.js +1 -15
- package/dist/client/hosted-transport.js.map +1 -1
- package/dist/client/hosted.d.ts +53 -7
- package/dist/client/hosted.d.ts.map +1 -1
- package/dist/client/hosted.js +158 -17
- package/dist/client/hosted.js.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/receive-queue.d.ts +4 -2
- package/dist/client/receive-queue.d.ts.map +1 -1
- package/dist/client/receive-queue.js +26 -22
- package/dist/client/receive-queue.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/manager/manager.d.ts +6 -1
- package/dist/internal/manager/manager.d.ts.map +1 -1
- package/dist/internal/manager/manager.js +8 -2
- package/dist/internal/manager/manager.js.map +1 -1
- package/dist/internal/session/cipher.d.ts +2 -2
- package/dist/internal/session/cipher.js +1 -1
- package/dist/internal/session/types.d.ts +1 -1
- package/dist/local/store/conformance/cases/ciphertext.d.ts +7 -0
- package/dist/local/store/conformance/cases/ciphertext.d.ts.map +1 -0
- package/dist/local/store/conformance/cases/ciphertext.js +55 -0
- package/dist/local/store/conformance/cases/ciphertext.js.map +1 -0
- package/dist/local/store/conformance/cases/durability.d.ts +6 -0
- package/dist/local/store/conformance/cases/durability.d.ts.map +1 -0
- package/dist/local/store/conformance/cases/durability.js +34 -0
- package/dist/local/store/conformance/cases/durability.js.map +1 -0
- package/dist/local/store/conformance/cases/identity.d.ts +7 -0
- package/dist/local/store/conformance/cases/identity.d.ts.map +1 -0
- package/dist/local/store/conformance/cases/identity.js +84 -0
- package/dist/local/store/conformance/cases/identity.js.map +1 -0
- package/dist/local/store/conformance/cases/metadata.d.ts +7 -0
- package/dist/local/store/conformance/cases/metadata.d.ts.map +1 -0
- package/dist/local/store/conformance/cases/metadata.js +48 -0
- package/dist/local/store/conformance/cases/metadata.js.map +1 -0
- package/dist/local/store/conformance/cases/protection.d.ts +7 -0
- package/dist/local/store/conformance/cases/protection.d.ts.map +1 -0
- package/dist/local/store/conformance/cases/protection.js +14 -0
- package/dist/local/store/conformance/cases/protection.js.map +1 -0
- package/dist/local/store/conformance/cases/receive-work.d.ts +8 -0
- package/dist/local/store/conformance/cases/receive-work.d.ts.map +1 -0
- package/dist/local/store/conformance/cases/receive-work.js +152 -0
- package/dist/local/store/conformance/cases/receive-work.js.map +1 -0
- package/dist/local/store/conformance/cases/sender-key.d.ts +7 -0
- package/dist/local/store/conformance/cases/sender-key.d.ts.map +1 -0
- package/dist/local/store/conformance/cases/sender-key.js +59 -0
- package/dist/local/store/conformance/cases/sender-key.js.map +1 -0
- package/dist/local/store/conformance/cases/session-trust.d.ts +7 -0
- package/dist/local/store/conformance/cases/session-trust.d.ts.map +1 -0
- package/dist/local/store/conformance/cases/session-trust.js +64 -0
- package/dist/local/store/conformance/cases/session-trust.js.map +1 -0
- package/dist/local/store/conformance/checks.d.ts +15 -0
- package/dist/local/store/conformance/checks.d.ts.map +1 -0
- package/dist/local/store/conformance/checks.js +67 -0
- package/dist/local/store/conformance/checks.js.map +1 -0
- package/dist/local/store/conformance/index.d.ts +30 -0
- package/dist/local/store/conformance/index.d.ts.map +1 -0
- package/dist/local/store/conformance/index.js +29 -0
- package/dist/local/store/conformance/index.js.map +1 -0
- package/dist/local/store/conformance/records.d.ts +36 -0
- package/dist/local/store/conformance/records.d.ts.map +1 -0
- package/dist/local/store/conformance/records.js +109 -0
- package/dist/local/store/conformance/records.js.map +1 -0
- package/dist/local/store/conformance/run.d.ts +24 -0
- package/dist/local/store/conformance/run.d.ts.map +1 -0
- package/dist/local/store/conformance/run.js +156 -0
- package/dist/local/store/conformance/run.js.map +1 -0
- package/dist/local/store/conformance/types.d.ts +55 -0
- package/dist/local/store/conformance/types.d.ts.map +1 -0
- package/dist/local/store/conformance/types.js +6 -0
- package/dist/local/store/conformance/types.js.map +1 -0
- package/dist/local/store/expo/adapter.d.ts +2 -1
- package/dist/local/store/expo/adapter.d.ts.map +1 -1
- package/dist/local/store/expo/adapter.js.map +1 -1
- package/dist/local/store/node/adapter.d.ts +2 -2
- package/dist/local/store/react-native/adapter.d.ts +2 -1
- package/dist/local/store/react-native/adapter.d.ts.map +1 -1
- package/dist/local/store/react-native/adapter.js.map +1 -1
- package/dist/local/store/sqlite/convert-plaintext.d.ts +62 -0
- package/dist/local/store/sqlite/convert-plaintext.d.ts.map +1 -0
- package/dist/local/store/sqlite/convert-plaintext.js +236 -0
- package/dist/local/store/sqlite/convert-plaintext.js.map +1 -0
- package/dist/local/store/sqlite/driver.d.ts +9 -0
- package/dist/local/store/sqlite/driver.d.ts.map +1 -1
- package/dist/local/store/sqlite/encryption.d.ts +21 -0
- package/dist/local/store/sqlite/encryption.d.ts.map +1 -1
- package/dist/local/store/sqlite/encryption.js.map +1 -1
- package/dist/local/store/sqlite/errors.d.ts.map +1 -1
- package/dist/local/store/sqlite/errors.js +2 -1
- package/dist/local/store/sqlite/errors.js.map +1 -1
- package/dist/local/store/sqlite/key-storage/identity-keys.d.ts +3 -1
- package/dist/local/store/sqlite/key-storage/identity-keys.d.ts.map +1 -1
- package/dist/local/store/sqlite/key-storage/identity-keys.js +3 -1
- package/dist/local/store/sqlite/key-storage/identity-keys.js.map +1 -1
- package/dist/local/store/sqlite/open-store.d.ts +36 -4
- package/dist/local/store/sqlite/open-store.d.ts.map +1 -1
- package/dist/local/store/sqlite/open-store.js +326 -21
- package/dist/local/store/sqlite/open-store.js.map +1 -1
- package/dist/local/store/sqlite/web/sqlite3mc/sqlite3.mjs +2 -1
- package/dist/local/store/sqlite/web/worker.d.ts +13 -0
- package/dist/local/store/sqlite/web/worker.d.ts.map +1 -1
- package/dist/local/store/sqlite/web/worker.js +163 -22
- package/dist/local/store/sqlite/web/worker.js.map +1 -1
- package/dist/local/store/web-sqlite/adapter.d.ts +3 -2
- package/dist/local/store/web-sqlite/adapter.d.ts.map +1 -1
- package/dist/local/store/web-sqlite/adapter.js +12 -2
- package/dist/local/store/web-sqlite/adapter.js.map +1 -1
- package/dist/remote/relay/types.d.ts +4 -2
- package/dist/remote/relay/types.d.ts.map +1 -1
- package/dist/types/api.d.ts +20 -4
- package/dist/types/api.d.ts.map +1 -1
- package/docs/ASSURANCE.md +25 -7
- package/docs/DEVIATIONS.md +35 -3
- package/docs/ERROR_HANDLING.md +8 -6
- package/docs/GETTING_STARTED.md +15 -8
- package/docs/INTERFACES.md +3 -1
- package/docs/PACKAGE_SURFACE.md +1 -0
- package/docs/SECURITY.md +23 -5
- package/keys/README.md +3 -1
- package/local/store/README.md +92 -12
- package/local/store/expo/README.md +63 -6
- package/local/store/key-value/README.md +3 -2
- package/local/store/node/README.md +68 -6
- package/local/store/react-native/README.md +62 -4
- package/local/store/web-sqlite/README.md +73 -4
- package/package.json +5 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The durability case: each kind of write survives a reopen of the store.
|
|
3
|
+
*/
|
|
4
|
+
import { ProtocolAddress } from '../../../../types/address.js';
|
|
5
|
+
import { assertEqual } from '../checks.js';
|
|
6
|
+
import { contactIdentity, receiveWork, SENDER_KEY_ID, senderKeyState, sessionRecord, skippedMessageKey, } from '../records.js';
|
|
7
|
+
export const durabilityCases = [
|
|
8
|
+
{
|
|
9
|
+
name: 'durability after reopen',
|
|
10
|
+
needs: 'reopen',
|
|
11
|
+
run: async function durabilityAfterReopen(context) {
|
|
12
|
+
const store = context.store;
|
|
13
|
+
const address = ProtocolAddress.create('conformance-durable-user', 1);
|
|
14
|
+
const groupId = 'conformance-durable-group';
|
|
15
|
+
const memberId = 'conformance-durable-member';
|
|
16
|
+
const work = receiveWork('conformance-durable-work', { groupId: groupId });
|
|
17
|
+
await store.storeSessionRecord(address, sessionRecord(address, 1));
|
|
18
|
+
await store.saveContactIdentity(address, contactIdentity(1), 'aci');
|
|
19
|
+
await store.storeSenderKeyRecord(groupId, memberId, 1, [senderKeyState(1)]);
|
|
20
|
+
await store.storeSkippedSenderKey(groupId, memberId, 1, SENDER_KEY_ID, 2, skippedMessageKey(2));
|
|
21
|
+
await store.setMetadata('conformance-durable-metadata', 'durable value');
|
|
22
|
+
await store.putReceiveWork(work, null);
|
|
23
|
+
const reopened = await context.reopen();
|
|
24
|
+
assertEqual(await reopened.getSessionRecord(address), sessionRecord(address, 1), 'the session after a reopen');
|
|
25
|
+
const contact = await reopened.getContactIdentity(address, 'aci');
|
|
26
|
+
assertEqual(contact === null || contact === undefined ? null : contact.identity, contactIdentity(1), 'the contact identity after a reopen');
|
|
27
|
+
assertEqual(await reopened.getSenderKeyRecord(groupId, memberId, 1), [senderKeyState(1)], 'the sender key record after a reopen');
|
|
28
|
+
assertEqual(await reopened.getSkippedSenderKey(groupId, memberId, 1, SENDER_KEY_ID, 2), skippedMessageKey(2), 'the skipped key after a reopen');
|
|
29
|
+
assertEqual(await reopened.getMetadata('conformance-durable-metadata'), 'durable value', 'the metadata after a reopen');
|
|
30
|
+
assertEqual(await reopened.getReceiveWork(work.workId), work, 'the receive record after a reopen');
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
//# sourceMappingURL=durability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durability.js","sourceRoot":"","sources":["../../../../../local/store/conformance/cases/durability.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EACL,eAAe,EACf,WAAW,EACX,aAAa,EACb,cAAc,EACd,aAAa,EACb,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAGpB,MAAM,CAAC,MAAM,eAAe,GAAyC;IACnE;QACE,IAAI,EAAE,yBAAyB;QAC/B,KAAK,EAAE,QAAQ;QACf,GAAG,EAAE,KAAK,UAAU,qBAAqB,CAAC,OAAO;YAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;YAC5B,MAAM,OAAO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Q,EACnE,eAAe,CAAC,CAAC,CAAC,EAClB,qCAAqC,CACtC,CAAC;YACF,WAAW,CACT,MAAM,QAAQ,CAAC,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,EACvD,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EACnB,sCAAsC,CACvC,CAAC;YACF,WAAW,CACT,MAAM,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,EAC1E,iBAAiB,CAAC,CAAC,CAAC,EACpB,gCAAgC,CACjC,CAAC;YACF,WAAW,CACT,MAAM,QAAQ,CAAC,WAAW,CAAC,8BAA8B,CAAC,EAC1D,eAAe,EACf,6BAA6B,CAC9B,CAAC;YACF,WAAW,CACT,MAAM,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAC1C,IAAI,EACJ,mCAAmC,CACpC,CAAC;QACJ,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The identity cases: the overwrite of the local identity key pair and the
|
|
3
|
+
* registration ID of one identity type, and the same writes after a reopen.
|
|
4
|
+
*/
|
|
5
|
+
import type { LocalStoreConformanceCase } from '../types.js';
|
|
6
|
+
export declare const identityCases: readonly LocalStoreConformanceCase[];
|
|
7
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../../../local/store/conformance/cases/identity.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AA0E1D,eAAO,MAAM,aAAa,EAAE,SAAS,yBAAyB,EAiC7D,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The identity cases: the overwrite of the local identity key pair and the
|
|
3
|
+
* registration ID of one identity type, and the same writes after a reopen.
|
|
4
|
+
*/
|
|
5
|
+
import { generateIdentityKeyPair } from '../../../../keys/generation.js';
|
|
6
|
+
import { assertEqual, fail } from '../checks.js';
|
|
7
|
+
const IDENTITY_TYPES = ['aci', 'pni'];
|
|
8
|
+
/** The first registration ID of each identity type. Each write adds one. */
|
|
9
|
+
const FIRST_REGISTRATION_ID = { aci: 1001, pni: 2001 };
|
|
10
|
+
async function readIdentity(store, type) {
|
|
11
|
+
return {
|
|
12
|
+
keyPair: await store.getIdentityKey(type),
|
|
13
|
+
registrationId: await store.getLocalRegistrationId(type),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/** Write the key pair and its registration ID of one identity type. */
|
|
17
|
+
async function writeIdentity(store, keyPair, type) {
|
|
18
|
+
await store.storeIdentityKey(keyPair, type);
|
|
19
|
+
await store.setLocalRegistrationId(keyPair.registrationId, type);
|
|
20
|
+
}
|
|
21
|
+
/** Assert both reads of each identity type. */
|
|
22
|
+
async function assertIdentities(store, expected, label) {
|
|
23
|
+
for (const type of IDENTITY_TYPES) {
|
|
24
|
+
assertEqual(await readIdentity(store, type), { keyPair: expected[type], registrationId: expected[type].registrationId }, 'the ' + type + ' identity ' + label);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Write a key pair and a registration ID for each identity type, as a new
|
|
29
|
+
* store does. Then, for each type, overwrite the record with the same keys
|
|
30
|
+
* and a new registration ID, as a managed device link does. With `check`,
|
|
31
|
+
* assert both reads of both types after each write.
|
|
32
|
+
*/
|
|
33
|
+
async function overwriteIdentities(store, check) {
|
|
34
|
+
let current = {
|
|
35
|
+
aci: { ...(await generateIdentityKeyPair()), registrationId: FIRST_REGISTRATION_ID.aci },
|
|
36
|
+
pni: { ...(await generateIdentityKeyPair()), registrationId: FIRST_REGISTRATION_ID.pni },
|
|
37
|
+
};
|
|
38
|
+
for (const type of IDENTITY_TYPES)
|
|
39
|
+
await writeIdentity(store, current[type], type);
|
|
40
|
+
if (check)
|
|
41
|
+
await assertIdentities(store, current, 'after the first write');
|
|
42
|
+
for (const type of IDENTITY_TYPES) {
|
|
43
|
+
const replacement = {
|
|
44
|
+
...current[type],
|
|
45
|
+
registrationId: current[type].registrationId + 1,
|
|
46
|
+
};
|
|
47
|
+
await writeIdentity(store, replacement, type);
|
|
48
|
+
current = { ...current, [type]: replacement };
|
|
49
|
+
if (check) {
|
|
50
|
+
await assertIdentities(store, current, 'after the overwrite of the ' + type + ' identity');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export const identityCases = [
|
|
55
|
+
{
|
|
56
|
+
name: 'identity overwrite',
|
|
57
|
+
run: async function identityOverwrite(context) {
|
|
58
|
+
await overwriteIdentities(context.store, true);
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'identity overwrite after reopen',
|
|
63
|
+
needs: 'reopen',
|
|
64
|
+
run: async function identityOverwriteAfterReopen(context) {
|
|
65
|
+
// The identity overwrite case checks the values. This case checks only
|
|
66
|
+
// that a reopen keeps the values that the store gave before it.
|
|
67
|
+
await overwriteIdentities(context.store, false);
|
|
68
|
+
const before = {
|
|
69
|
+
aci: await readIdentity(context.store, 'aci'),
|
|
70
|
+
pni: await readIdentity(context.store, 'pni'),
|
|
71
|
+
};
|
|
72
|
+
for (const type of IDENTITY_TYPES) {
|
|
73
|
+
if (before[type].keyPair === null) {
|
|
74
|
+
fail('the ' + type + ' key pair is absent before the reopen');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const reopened = await context.reopen();
|
|
78
|
+
for (const type of IDENTITY_TYPES) {
|
|
79
|
+
assertEqual(await readIdentity(reopened, type), before[type], 'the ' + type + ' identity after a reopen');
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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vC,KAAK,EAAE,QAAQ;QACf,GAAG,EAAE,KAAK,UAAU,4BAA4B,CAAC,OAAO;YACtD,uEAAuE;YACvE,gEAAgE;YAChE,MAAM,mBAAmB,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAChD,MAAM,MAAM,GAAuC;gBACjD,GAAG,EAAE,MAAM,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;gBAC7C,GAAG,EAAE,MAAM,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;aAC9C,CAAC;YACF,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;gBAClC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;oBAClC,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,uCAAuC,CAAC,CAAC;gBAChE,CAAC;YACH,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC;YACxC,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE,CAAC;gBAClC,WAAW,CACT,MAAM,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,EAClC,MAAM,CAAC,IAAI,CAAC,EACZ,MAAM,GAAG,IAAI,GAAG,0BAA0B,CAC3C,CAAC;YACJ,CAAC;QACH,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The metadata case: compare-and-set on a value, on an absent value, and
|
|
3
|
+
* among concurrent calls.
|
|
4
|
+
*/
|
|
5
|
+
import type { LocalStoreConformanceCase } from '../types.js';
|
|
6
|
+
export declare const metadataCases: readonly LocalStoreConformanceCase[];
|
|
7
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../../../local/store/conformance/cases/metadata.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAuB1D,eAAO,MAAM,aAAa,EAAE,SAAS,yBAAyB,EA8C7D,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The metadata case: compare-and-set on a value, on an absent value, and
|
|
3
|
+
* among concurrent calls.
|
|
4
|
+
*/
|
|
5
|
+
import { assertEqual, fail } from '../checks.js';
|
|
6
|
+
/** The number of concurrent compare-and-set calls on one absent value. */
|
|
7
|
+
const CONCURRENT_CALLS = 8;
|
|
8
|
+
function step(expected, value, result, stored, label) {
|
|
9
|
+
return { expected: expected, value: value, result: result, stored: stored, label: label };
|
|
10
|
+
}
|
|
11
|
+
export const metadataCases = [
|
|
12
|
+
{
|
|
13
|
+
name: 'metadata compare-and-set',
|
|
14
|
+
run: async function metadataCompareAndSet(context) {
|
|
15
|
+
const store = context.store;
|
|
16
|
+
const key = 'conformance-compare-and-set';
|
|
17
|
+
const steps = [
|
|
18
|
+
step(null, 'a', true, 'a', 'a write that expects an absent value'),
|
|
19
|
+
step(null, 'b', false, 'a', 'a write that expects an absent value over a value'),
|
|
20
|
+
step('a', 'b', true, 'b', 'a write that expects the stored value'),
|
|
21
|
+
step('x', 'c', false, 'b', 'a write that expects a different value'),
|
|
22
|
+
step('b', null, true, null, 'a delete that expects the stored value'),
|
|
23
|
+
step('b', 'd', false, null, 'a write that expects a value over an absent value'),
|
|
24
|
+
];
|
|
25
|
+
for (const next of steps) {
|
|
26
|
+
assertEqual(await store.compareAndSetMetadata(key, next.expected, next.value), next.result, 'the result of ' + next.label);
|
|
27
|
+
assertEqual(await store.getMetadata(key), next.stored, 'the value after ' + next.label);
|
|
28
|
+
}
|
|
29
|
+
const raced = 'conformance-compare-and-set-race';
|
|
30
|
+
const calls = [];
|
|
31
|
+
for (let index = 0; index < CONCURRENT_CALLS; index += 1) {
|
|
32
|
+
calls.push(store.compareAndSetMetadata(raced, null, 'writer-' + index));
|
|
33
|
+
}
|
|
34
|
+
const results = await Promise.all(calls);
|
|
35
|
+
const winners = [];
|
|
36
|
+
results.forEach(function collect(won, index) {
|
|
37
|
+
if (won)
|
|
38
|
+
winners.push(index);
|
|
39
|
+
});
|
|
40
|
+
if (winners.length !== 1) {
|
|
41
|
+
fail('concurrent writes that expect an absent value: expected one winner, got ' +
|
|
42
|
+
JSON.stringify(winners));
|
|
43
|
+
}
|
|
44
|
+
assertEqual(await store.getMetadata(raced), 'writer-' + winners[0], 'the value after concurrent writes');
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
//# sourceMappingURL=metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../../../local/store/conformance/cases/metadata.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAG9C,0EAA0E;AAC1E,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAU3B,SAAS,IAAI,CACX,QAAuB,EACvB,KAAoB,EACpB,MAAe,EACf,MAAqB,EACrB,KAAa;IAEb,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC5F,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAyC;IACjE;QACE,IAAI,EAAE,0BAA0B;QAChC,GAAG,EAAE,KAAK,UAAU,qBAAqB,CAAC,OAAO;YAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;YAC5B,MAAM,GAAG,GAAG,6BAA6B,CAAC;YAC1C,MAAM,KAAK,GAAwB;gBACjC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,sCAAsC,CAAC;gBAClE,IAAI,CAAC,IAA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AO,CAAC,GAAG,EAAE,KAAK;gBACzC,IAAI,GAAG;oBAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;YACH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,IAAI,CACF,0EAA0E;oBACxE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAC1B,CAAC;YACJ,CAAC;YACD,WAAW,CACT,MAAM,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,EAC9B,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,EACtB,mCAAmC,CACpC,CAAC;QACJ,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The protection declaration case: the store declares a valid protection,
|
|
3
|
+
* and the result reports it.
|
|
4
|
+
*/
|
|
5
|
+
import type { LocalStoreConformanceCase } from '../types.js';
|
|
6
|
+
export declare const protectionCases: readonly LocalStoreConformanceCase[];
|
|
7
|
+
//# sourceMappingURL=protection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protection.d.ts","sourceRoot":"","sources":["../../../../../local/store/conformance/cases/protection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAE1D,eAAO,MAAM,eAAe,EAAE,SAAS,yBAAyB,EAO/D,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The protection declaration case: the store declares a valid protection,
|
|
3
|
+
* and the result reports it.
|
|
4
|
+
*/
|
|
5
|
+
import { readLocalStoreProtection } from '../../../../client/storage-protection.js';
|
|
6
|
+
export const protectionCases = [
|
|
7
|
+
{
|
|
8
|
+
name: 'protection declaration',
|
|
9
|
+
run: async function protectionDeclaration(context) {
|
|
10
|
+
context.reportProtection(readLocalStoreProtection(context.store));
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
];
|
|
14
|
+
//# sourceMappingURL=protection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protection.js","sourceRoot":"","sources":["../../../../../local/store/conformance/cases/protection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAGjF,MAAM,CAAC,MAAM,eAAe,GAAyC;IACnE;QACE,IAAI,EAAE,wBAAwB;QAC9B,GAAG,EAAE,KAAK,UAAU,qBAAqB,CAAC,OAAO;YAC/C,OAAO,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QACpE,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The receive record cases: the insert and the compare-and-set of one
|
|
3
|
+
* record, the listing in arrival order, and the atomic completion with its
|
|
4
|
+
* usage counts.
|
|
5
|
+
*/
|
|
6
|
+
import type { LocalStoreConformanceCase } from '../types.js';
|
|
7
|
+
export declare const receiveWorkCases: readonly LocalStoreConformanceCase[];
|
|
8
|
+
//# sourceMappingURL=receive-work.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receive-work.d.ts","sourceRoot":"","sources":["../../../../../local/store/conformance/cases/receive-work.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AA4D1D,eAAO,MAAM,gBAAgB,EAAE,SAAS,yBAAyB,EA8MhE,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The receive record cases: the insert and the compare-and-set of one
|
|
3
|
+
* record, the listing in arrival order, and the atomic completion with its
|
|
4
|
+
* usage counts.
|
|
5
|
+
*/
|
|
6
|
+
import { assertAbsent, assertEqual, expectRejection } from '../checks.js';
|
|
7
|
+
import { receiveWork } from '../records.js';
|
|
8
|
+
/** The number of records of the listing case. It is one above the default page size. */
|
|
9
|
+
const LISTED_RECORDS = 101;
|
|
10
|
+
function compareWorkIds(a, b) {
|
|
11
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
12
|
+
}
|
|
13
|
+
function inArrivalOrder(a, b) {
|
|
14
|
+
return a.arrivalSeq - b.arrivalSeq || compareWorkIds(a.workId, b.workId);
|
|
15
|
+
}
|
|
16
|
+
function isAfter(record, cursor) {
|
|
17
|
+
return inArrivalOrder(record, cursor) > 0;
|
|
18
|
+
}
|
|
19
|
+
function workIds(records) {
|
|
20
|
+
return records.map(function workIdOf(record) {
|
|
21
|
+
return record.workId;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function usageOf(records) {
|
|
25
|
+
let bytes = 0;
|
|
26
|
+
for (const record of records)
|
|
27
|
+
bytes += record.sizeBytes;
|
|
28
|
+
return { items: records.length, bytes: bytes };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The records of the listing case. The work IDs have no zero padding, so
|
|
32
|
+
* their text order is not their number order. Groups of three records share
|
|
33
|
+
* one arrival sequence, and the insert order is not the arrival order.
|
|
34
|
+
*/
|
|
35
|
+
function listedRecords() {
|
|
36
|
+
const stages = ['decrypted', 'receipt-due', 'awaiting-completion'];
|
|
37
|
+
const records = [];
|
|
38
|
+
for (let index = 0; index < LISTED_RECORDS; index += 1) {
|
|
39
|
+
const stage = stages[index % stages.length];
|
|
40
|
+
records.push(receiveWork('conformance-list-' + ((index * 37) % LISTED_RECORDS), {
|
|
41
|
+
arrivalSeq: Math.floor(((index * 53) % LISTED_RECORDS) / 3) + 1,
|
|
42
|
+
stage: stage,
|
|
43
|
+
dueAt: 1_000 + (index % 5) * 100,
|
|
44
|
+
plaintext: stage === 'receipt-due' ? undefined : 'listed content ' + index,
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
return records;
|
|
48
|
+
}
|
|
49
|
+
async function expectListing(list, query, expected, label) {
|
|
50
|
+
assertEqual(workIds(await list(query)), workIds(expected), label);
|
|
51
|
+
}
|
|
52
|
+
export const receiveWorkCases = [
|
|
53
|
+
{
|
|
54
|
+
name: 'receive record insert and compare-and-set',
|
|
55
|
+
run: async function receiveRecordInsert(context) {
|
|
56
|
+
const store = context.store;
|
|
57
|
+
const first = receiveWork('conformance-put');
|
|
58
|
+
assertEqual(await store.putReceiveWork(first, null), true, 'an insert of a new record');
|
|
59
|
+
assertEqual(await store.getReceiveWork(first.workId), first, 'the inserted record');
|
|
60
|
+
const clash = receiveWork('conformance-put', { arrivalSeq: 2, plaintext: 'other content' });
|
|
61
|
+
assertEqual(await store.putReceiveWork(clash, null), false, 'an insert over an existing record');
|
|
62
|
+
assertEqual(await store.getReceiveWork(first.workId), first, 'the record after an insert over it');
|
|
63
|
+
const second = receiveWork('conformance-put', { revision: 1, stage: 'awaiting-completion' });
|
|
64
|
+
assertEqual(await store.putReceiveWork(second, 0), true, 'a replace that names the stored revision');
|
|
65
|
+
assertEqual(await store.getReceiveWork(first.workId), second, 'the replaced record');
|
|
66
|
+
const stale = receiveWork('conformance-put', { revision: 2, stage: 'receipt-due', plaintext: undefined });
|
|
67
|
+
assertEqual(await store.putReceiveWork(stale, 0), false, 'a replace that names a stale revision');
|
|
68
|
+
assertEqual(await store.getReceiveWork(first.workId), second, 'the record after a replace that names a stale revision');
|
|
69
|
+
const missing = receiveWork('conformance-put-missing', { revision: 1 });
|
|
70
|
+
assertEqual(await store.putReceiveWork(missing, 0), false, 'a replace of an absent record');
|
|
71
|
+
assertAbsent(await store.getReceiveWork(missing.workId), 'the record of a replace of an absent record');
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'receive record listing',
|
|
76
|
+
run: async function receiveRecordListing(context) {
|
|
77
|
+
const store = context.store;
|
|
78
|
+
const list = function list(query) {
|
|
79
|
+
return store.listReceiveWork(query);
|
|
80
|
+
};
|
|
81
|
+
const records = listedRecords();
|
|
82
|
+
for (const record of records)
|
|
83
|
+
await store.putReceiveWork(record, null);
|
|
84
|
+
const ordered = records.slice().sort(inArrivalOrder);
|
|
85
|
+
assertEqual(await list(), ordered.slice(0, 100), 'the first page of records');
|
|
86
|
+
await expectListing(list, { limit: 200 }, ordered, 'every record in arrival order');
|
|
87
|
+
await expectListing(list, { limit: 7 }, ordered.slice(0, 7), 'a page with a limit');
|
|
88
|
+
for (const position of [0, 49, 50, LISTED_RECORDS - 2]) {
|
|
89
|
+
const cursor = ordered[position];
|
|
90
|
+
await expectListing(list, { after: { arrivalSeq: cursor.arrivalSeq, workId: cursor.workId }, limit: 200 }, ordered.slice(position + 1), 'the records after the record at position ' + position);
|
|
91
|
+
}
|
|
92
|
+
const last = ordered[LISTED_RECORDS - 1];
|
|
93
|
+
await expectListing(list, { after: { arrivalSeq: last.arrivalSeq, workId: last.workId } }, [], 'the records after the last record');
|
|
94
|
+
for (const stage of ['decrypted', 'receipt-due', 'awaiting-completion']) {
|
|
95
|
+
await expectListing(list, { stage: stage, limit: 200 }, ordered.filter(function inStage(record) {
|
|
96
|
+
return record.stage === stage;
|
|
97
|
+
}), 'the records in stage ' + stage);
|
|
98
|
+
}
|
|
99
|
+
await expectListing(list, { dueBy: 1_200, limit: 200 }, ordered.filter(function due(record) {
|
|
100
|
+
return record.dueAt <= 1_200;
|
|
101
|
+
}), 'the records due at a time');
|
|
102
|
+
const cursor = ordered[10];
|
|
103
|
+
await expectListing(list, {
|
|
104
|
+
stage: 'decrypted',
|
|
105
|
+
dueBy: 1_300,
|
|
106
|
+
after: { arrivalSeq: cursor.arrivalSeq, workId: cursor.workId },
|
|
107
|
+
limit: 5,
|
|
108
|
+
}, ordered
|
|
109
|
+
.filter(function matches(record) {
|
|
110
|
+
return record.stage === 'decrypted' && record.dueAt <= 1_300 && isAfter(record, cursor);
|
|
111
|
+
})
|
|
112
|
+
.slice(0, 5), 'a page of the filtered records after a cursor');
|
|
113
|
+
await expectRejection(list({ limit: 0 }), 'a listing with a limit of zero');
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'receive record completion and usage',
|
|
118
|
+
run: async function receiveRecordCompletion(context) {
|
|
119
|
+
const store = context.store;
|
|
120
|
+
const groupId = 'conformance-completion-group';
|
|
121
|
+
const plain = receiveWork('conformance-complete-plain', { arrivalSeq: 1 });
|
|
122
|
+
const blocked = receiveWork('conformance-complete-blocked', {
|
|
123
|
+
arrivalSeq: 2,
|
|
124
|
+
groupId: groupId,
|
|
125
|
+
blockedOn: 'group-update',
|
|
126
|
+
});
|
|
127
|
+
const waiting = receiveWork('conformance-complete-waiting', { arrivalSeq: 3, groupId: groupId });
|
|
128
|
+
for (const record of [plain, blocked, waiting])
|
|
129
|
+
await store.putReceiveWork(record, null);
|
|
130
|
+
await store.setMetadata('conformance-complete-deleted', 'old');
|
|
131
|
+
assertEqual(await store.receiveWorkUsage(), usageOf([plain, blocked, waiting]), 'the usage of every record');
|
|
132
|
+
assertEqual(await store.receiveWorkUsage({ groupId: groupId }), usageOf([blocked]), 'the usage of the records that wait for a group update');
|
|
133
|
+
assertEqual(await store.completeReceiveWork(plain.workId, 1, [
|
|
134
|
+
{ key: 'conformance-complete-set', value: 'done' },
|
|
135
|
+
]), false, 'a completion that names a stale revision');
|
|
136
|
+
assertEqual(await store.getReceiveWork(plain.workId), plain, 'the record after a completion that names a stale revision');
|
|
137
|
+
assertAbsent(await store.getMetadata('conformance-complete-set'), 'the metadata of a completion that names a stale revision');
|
|
138
|
+
assertEqual(await store.completeReceiveWork(plain.workId, 0, [
|
|
139
|
+
{ key: 'conformance-complete-set', value: 'done' },
|
|
140
|
+
{ key: 'conformance-complete-deleted', value: null },
|
|
141
|
+
]), true, 'a completion that names the stored revision');
|
|
142
|
+
assertAbsent(await store.getReceiveWork(plain.workId), 'a completed record');
|
|
143
|
+
assertEqual(await store.getMetadata('conformance-complete-set'), 'done', 'the metadata that a completion sets');
|
|
144
|
+
assertAbsent(await store.getMetadata('conformance-complete-deleted'), 'the metadata that a completion deletes');
|
|
145
|
+
assertEqual(await store.receiveWorkUsage(), usageOf([blocked, waiting]), 'the usage after a completion');
|
|
146
|
+
assertEqual(await store.completeReceiveWork(blocked.workId, 0), true, 'a completion of a record that waits for a group update');
|
|
147
|
+
assertEqual(await store.receiveWorkUsage({ groupId: groupId }), usageOf([]), 'the group usage after a completion');
|
|
148
|
+
assertEqual(await store.completeReceiveWork(plain.workId, 0), false, 'a completion of an absent record');
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
];
|
|
152
|
+
//# sourceMappingURL=receive-work.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receive-work.js","sourceRoot":"","sources":["../../../../../local/store/conformance/cases/receive-work.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,wFAAwF;AACxF,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B,SAAS,cAAc,CAAC,CAAS,EAAE,CAAS;IAC1C,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,cAAc,CAAC,CAAoB,EAAE,CAAoB;IAChE,OAAO,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,IAAI,cAAc,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,OAAO,CAAC,MAAyB,EAAE,MAAyB;IACnE,OAAO,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,OAAO,CAAC,OAAq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C,EACnD,0DAA0D,CAC3D,CAAC;YAEF,WAAW,CACT,MAAM,KAAK,CAAC,mBAAmB,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE;gBAC/C,EAAE,GAAG,EAAE,0BAA0B,EAAE,KAAK,EAAE,MAAM,EAAE;gBAClD,EAAE,GAAG,EAAE,8BAA8B,EAAE,KAAK,EAAE,IAAI,EAAE;aACrD,CAAC,EACF,IAAI,EACJ,6CAA6C,CAC9C,CAAC;YACF,YAAY,CAAC,MAAM,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,oBAAoB,CAAC,CAAC;YAC7E,WAAW,CACT,MAAM,KAAK,CAAC,WAAW,CAAC,0BAA0B,CAAC,EACnD,MAAM,EACN,qCAAqC,CACtC,CAAC;YACF,YAAY,CACV,MAAM,KAAK,CAAC,WAAW,CAAC,8BAA8B,CAAC,EACvD,wCAAwC,CACzC,CAAC;YACF,WAAW,CACT,MAAM,KAAK,CAAC,gBAAgB,EAAE,EAC9B,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,EAC3B,8BAA8B,CAC/B,CAAC;YAEF,WAAW,CACT,MAAM,KAAK,CAAC,mBAAmB,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,EAClD,IAAI,EACJ,wDAAwD,CACzD,CAAC;YACF,WAAW,CACT,MAAM,KAAK,CAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAClD,OAAO,CAAC,EAAE,CAAC,EACX,oCAAoC,CACrC,CAAC;YACF,WAAW,CACT,MAAM,KAAK,CAAC,mBAAmB,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,EAChD,KAAK,EACL,kCAAkC,CACnC,CAAC;QACJ,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sender key cases: the atomic commit of a sender key record with its
|
|
3
|
+
* receive effects, and the rollback of that commit.
|
|
4
|
+
*/
|
|
5
|
+
import type { LocalStoreConformanceCase } from '../types.js';
|
|
6
|
+
export declare const senderKeyCases: readonly LocalStoreConformanceCase[];
|
|
7
|
+
//# sourceMappingURL=sender-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sender-key.d.ts","sourceRoot":"","sources":["../../../../../local/store/conformance/cases/sender-key.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAc1D,eAAO,MAAM,cAAc,EAAE,SAAS,yBAAyB,EAyG9D,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sender key cases: the atomic commit of a sender key record with its
|
|
3
|
+
* receive effects, and the rollback of that commit.
|
|
4
|
+
*/
|
|
5
|
+
import { assertAbsent, assertEqual, expectRejection } from '../checks.js';
|
|
6
|
+
import { receiveWork, SENDER_KEY_ID, senderKeyState, skippedMessageKey, } from '../records.js';
|
|
7
|
+
const GROUP_ID = 'conformance-group';
|
|
8
|
+
const MEMBER_ID = 'conformance-member';
|
|
9
|
+
const DEVICE_ID = 1;
|
|
10
|
+
function skippedKey(chainIndex) {
|
|
11
|
+
return { senderKeyId: SENDER_KEY_ID, chainIndex: chainIndex, messageKey: skippedMessageKey(chainIndex) };
|
|
12
|
+
}
|
|
13
|
+
export const senderKeyCases = [
|
|
14
|
+
{
|
|
15
|
+
name: 'sender key receive commit',
|
|
16
|
+
run: async function senderKeyReceiveCommit(context) {
|
|
17
|
+
const store = context.store;
|
|
18
|
+
await store.storeSkippedSenderKey(GROUP_ID, MEMBER_ID, DEVICE_ID, SENDER_KEY_ID, 1, skippedMessageKey(1));
|
|
19
|
+
const work = receiveWork('conformance-sender-key-work', { groupId: GROUP_ID });
|
|
20
|
+
await store.storeSenderKeyRecord(GROUP_ID, MEMBER_ID, DEVICE_ID, [senderKeyState(2)], {
|
|
21
|
+
work: work,
|
|
22
|
+
consumedSkippedKey: { senderKeyId: SENDER_KEY_ID, chainIndex: 1 },
|
|
23
|
+
});
|
|
24
|
+
assertEqual(await store.getSenderKeyRecord(GROUP_ID, MEMBER_ID, DEVICE_ID), [senderKeyState(2)], 'the sender key record of a receive commit');
|
|
25
|
+
assertEqual(await store.getReceiveWork(work.workId), work, 'the receive record of a sender key commit');
|
|
26
|
+
assertAbsent(await store.getSkippedSenderKey(GROUP_ID, MEMBER_ID, DEVICE_ID, SENDER_KEY_ID, 1), 'the consumed skipped key');
|
|
27
|
+
const evictingMember = 'conformance-evicting-member';
|
|
28
|
+
await store.storeSenderKeyRecord(GROUP_ID, evictingMember, DEVICE_ID, [senderKeyState(4)], {
|
|
29
|
+
skippedKeys: { maxSkippedKeys: 2, keys: [skippedKey(1), skippedKey(2), skippedKey(3)] },
|
|
30
|
+
});
|
|
31
|
+
assertEqual(await store.countSkippedSenderKeys(GROUP_ID, evictingMember, DEVICE_ID), 2, 'the skipped key count after an eviction');
|
|
32
|
+
assertAbsent(await store.getSkippedSenderKey(GROUP_ID, evictingMember, DEVICE_ID, SENDER_KEY_ID, 1), 'the skipped key with the lowest chain index after an eviction');
|
|
33
|
+
for (const chainIndex of [2, 3]) {
|
|
34
|
+
assertEqual(await store.getSkippedSenderKey(GROUP_ID, evictingMember, DEVICE_ID, SENDER_KEY_ID, chainIndex), skippedMessageKey(chainIndex), 'the kept skipped key at chain index ' + chainIndex + ' after an eviction');
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'sender key receive commit rollback',
|
|
40
|
+
needs: 'armWriteFailure',
|
|
41
|
+
run: async function senderKeyReceiveCommitRollback(context) {
|
|
42
|
+
const store = context.store;
|
|
43
|
+
await store.storeSenderKeyRecord(GROUP_ID, MEMBER_ID, DEVICE_ID, [senderKeyState(1)]);
|
|
44
|
+
await store.storeSkippedSenderKey(GROUP_ID, MEMBER_ID, DEVICE_ID, SENDER_KEY_ID, 3, skippedMessageKey(3));
|
|
45
|
+
const work = receiveWork('conformance-lost-sender-key-work', { groupId: GROUP_ID });
|
|
46
|
+
context.armWriteFailure();
|
|
47
|
+
await expectRejection(store.storeSenderKeyRecord(GROUP_ID, MEMBER_ID, DEVICE_ID, [senderKeyState(5)], {
|
|
48
|
+
work: work,
|
|
49
|
+
consumedSkippedKey: { senderKeyId: SENDER_KEY_ID, chainIndex: 3 },
|
|
50
|
+
skippedKeys: { maxSkippedKeys: 10, keys: [skippedKey(4)] },
|
|
51
|
+
}), 'a sender key commit with an armed write failure');
|
|
52
|
+
assertEqual(await store.getSenderKeyRecord(GROUP_ID, MEMBER_ID, DEVICE_ID), [senderKeyState(1)], 'the sender key record after a failed commit');
|
|
53
|
+
assertEqual(await store.getSkippedSenderKey(GROUP_ID, MEMBER_ID, DEVICE_ID, SENDER_KEY_ID, 3), skippedMessageKey(3), 'the skipped key that a failed commit consumed');
|
|
54
|
+
assertAbsent(await store.getSkippedSenderKey(GROUP_ID, MEMBER_ID, DEVICE_ID, SENDER_KEY_ID, 4), 'the skipped key that a failed commit added');
|
|
55
|
+
assertAbsent(await store.getReceiveWork(work.workId), 'the receive record of a failed sender key commit');
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
//# sourceMappingURL=sender-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sender-key.js","sourceRoot":"","sources":["../../../../../local/store/conformance/cases/sender-key.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EACL,WAAW,EACX,aAAa,EACb,cAAc,EACd,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAGpB,MAAM,QAAQ,GAAG,mBAAmB,CAAC;AACrC,MAAM,SAAS,GAAG,oBAAoB,CAAC;AACvC,MAAM,SAAS,GAAG,CAAC,CAAC;AAE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the rollback of that commit.
|
|
4
|
+
*/
|
|
5
|
+
import type { LocalStoreConformanceCase } from '../types.js';
|
|
6
|
+
export declare const sessionTrustCases: readonly LocalStoreConformanceCase[];
|
|
7
|
+
//# sourceMappingURL=session-trust.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-trust.d.ts","sourceRoot":"","sources":["../../../../../local/store/conformance/cases/session-trust.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AA6B1D,eAAO,MAAM,iBAAiB,EAAE,SAAS,yBAAyB,EAuFjE,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The session trust cases: the atomic commit of a session, its contact
|
|
3
|
+
* identity, and its receive record, and the rollback of that commit.
|
|
4
|
+
*/
|
|
5
|
+
import { ProtocolAddress } from '../../../../types/address.js';
|
|
6
|
+
import { assertAbsent, assertEqual, expectRejection } from '../checks.js';
|
|
7
|
+
import { contactIdentity, receiveWork, sessionRecord } from '../records.js';
|
|
8
|
+
/** A one-time prekey ID that no case stores. */
|
|
9
|
+
const MISSING_ONE_TIME_PREKEY_ID = 4242;
|
|
10
|
+
function trustCommit(address, receivedMessages, contactSeed, extra = {}) {
|
|
11
|
+
return {
|
|
12
|
+
address: address,
|
|
13
|
+
record: sessionRecord(address, receivedMessages),
|
|
14
|
+
contactIdentity: contactIdentity(contactSeed),
|
|
15
|
+
contactIdentityType: 'aci',
|
|
16
|
+
localIdentityType: 'aci',
|
|
17
|
+
...extra,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
async function pinnedContact(store, address) {
|
|
21
|
+
const record = await store.getContactIdentity(address, 'aci');
|
|
22
|
+
return record === null || record === undefined ? null : record.identity;
|
|
23
|
+
}
|
|
24
|
+
export const sessionTrustCases = [
|
|
25
|
+
{
|
|
26
|
+
name: 'session trust commit',
|
|
27
|
+
run: async function sessionTrustCommit(context) {
|
|
28
|
+
const store = context.store;
|
|
29
|
+
const address = ProtocolAddress.create('conformance-trust-user', 1);
|
|
30
|
+
await store.commitSessionTrust(trustCommit(address, 1, 1));
|
|
31
|
+
assertEqual(await store.getSessionRecord(address), sessionRecord(address, 1), 'the session of a commit');
|
|
32
|
+
assertEqual(await pinnedContact(store, address), contactIdentity(1), 'the pinned contact identity');
|
|
33
|
+
await expectRejection(store.commitSessionTrust(trustCommit(address, 2, 11)), 'a commit with a changed contact identity');
|
|
34
|
+
assertEqual(await store.getSessionRecord(address), sessionRecord(address, 1), 'the session after a commit with a changed contact identity');
|
|
35
|
+
assertEqual(await pinnedContact(store, address), contactIdentity(1), 'the contact identity after a commit with a changed contact identity');
|
|
36
|
+
const refused = ProtocolAddress.create('conformance-refused-user', 1);
|
|
37
|
+
await expectRejection(store.commitSessionTrust(trustCommit(refused, 1, 1, { oneTimePreKeyId: MISSING_ONE_TIME_PREKEY_ID })), 'a commit that consumes a missing one-time prekey');
|
|
38
|
+
assertAbsent(await store.getSessionRecord(refused), 'the session of a commit that consumes a missing one-time prekey');
|
|
39
|
+
assertAbsent(await pinnedContact(store, refused), 'the contact identity of a commit that consumes a missing one-time prekey');
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'session trust commit rollback',
|
|
44
|
+
needs: 'armWriteFailure',
|
|
45
|
+
run: async function sessionTrustCommitRollback(context) {
|
|
46
|
+
const store = context.store;
|
|
47
|
+
const known = ProtocolAddress.create('conformance-rollback-known-user', 1);
|
|
48
|
+
await store.commitSessionTrust(trustCommit(known, 1, 1));
|
|
49
|
+
const knownWork = receiveWork('conformance-rollback-known-work');
|
|
50
|
+
context.armWriteFailure();
|
|
51
|
+
await expectRejection(store.commitSessionTrust(trustCommit(known, 2, 1, { receiveWork: knownWork })), 'a commit of a known session with an armed write failure');
|
|
52
|
+
assertEqual(await store.getSessionRecord(known), sessionRecord(known, 1), 'the session after a failed commit');
|
|
53
|
+
assertAbsent(await store.getReceiveWork(knownWork.workId), 'the receive record of a failed commit');
|
|
54
|
+
const fresh = ProtocolAddress.create('conformance-rollback-new-user', 1);
|
|
55
|
+
const freshWork = receiveWork('conformance-rollback-new-work');
|
|
56
|
+
context.armWriteFailure();
|
|
57
|
+
await expectRejection(store.commitSessionTrust(trustCommit(fresh, 1, 21, { receiveWork: freshWork })), 'a first commit with an armed write failure');
|
|
58
|
+
assertAbsent(await store.getSessionRecord(fresh), 'the session of a failed first commit');
|
|
59
|
+
assertAbsent(await pinnedContact(store, fresh), 'the contact identity of a failed first commit');
|
|
60
|
+
assertAbsent(await store.getReceiveWork(freshWork.workId), 'the receive record of a failed first commit');
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
//# sourceMappingURL=session-trust.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-trust.js","sourceRoot":"","sources":["../../../../../local/store/conformance/cases/session-trust.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGzE,gDAAgD;AAChD,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAExC,SAAS,WAAW,CAClB,OAAwB,EACxB,gBAAwB,EACxB,WAAmB,EACnB,KAAK,GAAgC,EAAE;IAEvC,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,aAAa,CAAC,OAAO,EAAE,gBAAgB,CAAC;QAChD,eAAe,EAAE,eAAe,CAAC,WAAW,CAAC;QAC7C,mBAAmB,EAAE,KAAK;QAC1B,iBAAiB,EAAE,KAAK;QACxB,GAAG,KAAK;KACT,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,aAAa,CAC1B,KA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uCAAuC,CACxC,CAAC;YAEF,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,+BAA+B,EAAE,CAAC,CAAC,CAAC;YACzE,MAAM,SAAS,GAAG,WAAW,CAAC,+BAA+B,CAAC,CAAC;YAC/D,OAAO,CAAC,eAAe,EAAE,CAAC;YAC1B,MAAM,eAAe,CACnB,KAAK,CAAC,kBAAkB,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC,EAC/E,4CAA4C,CAC7C,CAAC;YACF,YAAY,CAAC,MAAM,KAAK,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,sCAAsC,CAAC,CAAC;YAC1F,YAAY,CACV,MAAM,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,EACjC,+CAA+C,CAChD,CAAC;YACF,YAAY,CACV,MAAM,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,EAC5C,6CAA6C,CAC9C,CAAC;QACJ,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The checks of the local store conformance kit. A failed check throws an
|
|
3
|
+
* error that names what the store did wrong. The checks avoid class syntax,
|
|
4
|
+
* so they run under any JavaScript engine.
|
|
5
|
+
*/
|
|
6
|
+
export declare function fail(message: string): never;
|
|
7
|
+
export declare function sameValue(actual: unknown, expected: unknown): boolean;
|
|
8
|
+
export declare function assertEqual(actual: unknown, expected: unknown, context: string): void;
|
|
9
|
+
/** Fail unless `value` is null or undefined, the two forms of an absent value. */
|
|
10
|
+
export declare function assertAbsent(value: unknown, context: string): void;
|
|
11
|
+
/** Wait for `promise` and fail when it resolves. */
|
|
12
|
+
export declare function expectRejection(promise: Promise<unknown>, context: string): Promise<unknown>;
|
|
13
|
+
/** The message of a thrown value. */
|
|
14
|
+
export declare function errorMessage(error: unknown): string;
|
|
15
|
+
//# sourceMappingURL=checks.d.ts.map
|