@plane31/blind-relay 0.1.3 → 0.3.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/README.md +1 -1
- package/dist/adapters/index.d.ts +4 -3
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +2 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/audience.d.ts +1 -1
- package/dist/audience.d.ts.map +1 -1
- package/dist/audience.js +7 -6
- package/dist/audience.js.map +1 -1
- package/dist/client.d.ts +159 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1112 -102
- package/dist/client.js.map +1 -1
- package/dist/codec.d.ts +25 -1
- package/dist/codec.d.ts.map +1 -1
- package/dist/codec.js +44 -0
- package/dist/codec.js.map +1 -1
- package/dist/crypto/noble.d.ts.map +1 -1
- package/dist/crypto/noble.js +19 -1
- package/dist/crypto/noble.js.map +1 -1
- package/dist/crypto.d.ts +1 -1
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js.map +1 -1
- package/dist/errors.d.ts +9 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +2 -1
- package/dist/errors.js.map +1 -1
- package/dist/identity.d.ts +8 -2
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +7 -3
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/policy.d.ts +13 -0
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +12 -1
- package/dist/policy.js.map +1 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +2 -0
- package/dist/rows.js.map +1 -1
- package/dist/store.d.ts +116 -3
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +2 -0
- package/dist/store.js.map +1 -1
- package/dist/succession.d.ts +108 -0
- package/dist/succession.d.ts.map +1 -0
- package/dist/succession.js +205 -0
- package/dist/succession.js.map +1 -0
- package/dist/testing/clock.d.ts.map +1 -1
- package/dist/testing/clock.js +1 -0
- package/dist/testing/clock.js.map +1 -1
- package/dist/testing/fakeHost.d.ts +60 -1
- package/dist/testing/fakeHost.d.ts.map +1 -1
- package/dist/testing/fakeHost.js +201 -31
- package/dist/testing/fakeHost.js.map +1 -1
- package/dist/testing/faults.d.ts +7 -3
- package/dist/testing/faults.d.ts.map +1 -1
- package/dist/testing/faults.js +27 -3
- package/dist/testing/faults.js.map +1 -1
- package/dist/transactions.d.ts +6 -0
- package/dist/transactions.d.ts.map +1 -1
- package/dist/transactions.js +11 -5
- package/dist/transactions.js.map +1 -1
- package/dist/transport.d.ts +66 -2
- package/dist/transport.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/adapters/index.ts +14 -0
- package/src/audience.ts +7 -6
- package/src/client.ts +1165 -108
- package/src/codec.ts +64 -1
- package/src/crypto/noble.ts +18 -1
- package/src/crypto.ts +1 -0
- package/src/errors.ts +13 -1
- package/src/identity.ts +13 -3
- package/src/index.ts +10 -3
- package/src/policy.ts +23 -1
- package/src/rows.ts +2 -0
- package/src/store.ts +113 -3
- package/src/succession.ts +270 -0
- package/src/testing/clock.ts +1 -0
- package/src/testing/fakeHost.ts +204 -28
- package/src/testing/faults.ts +32 -7
- package/src/transactions.ts +13 -6
- package/src/transport.ts +69 -2
package/src/transport.ts
CHANGED
|
@@ -19,6 +19,52 @@ export interface ResolvedAccount {
|
|
|
19
19
|
readonly certificate: Uint8Array;
|
|
20
20
|
/** When the account's key changed through a reset: the receipt that proves it. */
|
|
21
21
|
readonly resetReceipt?: Uint8Array | undefined;
|
|
22
|
+
/** When the account's key changed through successions (revision 9): the first page of the chain from the root, each link with the successor's certificate, oldest first. */
|
|
23
|
+
readonly successions?: readonly SuccessionLink[] | undefined;
|
|
24
|
+
/** Set when `successions` is not the whole chain: the generation to continue from with `getSuccessions`. */
|
|
25
|
+
readonly successionsNext?: bigint | undefined;
|
|
26
|
+
/** With a non-empty chain: a certificate under the root key (the one the first succession replaced), so a peer can verify what that key signed. */
|
|
27
|
+
readonly rootCertificate?: Uint8Array | undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** One link of an account's succession chain: the type 9 document and the certificate it binds. */
|
|
31
|
+
export interface SuccessionLink {
|
|
32
|
+
readonly wire: Uint8Array;
|
|
33
|
+
readonly certificate: Uint8Array;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface SuccessionPage {
|
|
37
|
+
readonly successions: readonly SuccessionLink[];
|
|
38
|
+
/** On the first page of a non-empty chain: a certificate under the root key. */
|
|
39
|
+
readonly rootCertificate?: Uint8Array | undefined;
|
|
40
|
+
/** The generation to ask after for the next page; absent when the chain ends here. */
|
|
41
|
+
readonly nextGeneration?: bigint | undefined;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** One circle of the authenticated account as the host lists it for bootstrap (amendment A1, section 5). Host-trusted. */
|
|
45
|
+
export interface CircleListing {
|
|
46
|
+
readonly circleId: Uint8Array;
|
|
47
|
+
readonly ownerAccountId: Uint8Array;
|
|
48
|
+
readonly role: "owner" | "member" | "pending";
|
|
49
|
+
/** The current snapshot; absent for a closed circle. */
|
|
50
|
+
readonly snapshot: Uint8Array | undefined;
|
|
51
|
+
/** The account's sharing preference the host holds; absent when none was ever set (disabled). */
|
|
52
|
+
readonly enabled: boolean | undefined;
|
|
53
|
+
readonly preferenceRevision: bigint;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface CirclePage {
|
|
57
|
+
readonly circles: readonly CircleListing[];
|
|
58
|
+
/** The cursor for the next page; absent on the last page. */
|
|
59
|
+
readonly cursor?: string | undefined;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface PreferenceOutcome {
|
|
63
|
+
readonly status: "COMMITTED" | "ALREADY_COMMITTED" | "CONFLICT" | "UNAUTHORIZED" | "RETRYABLE";
|
|
64
|
+
/** The revision the host now holds (the new one on success, the current one on conflict). */
|
|
65
|
+
readonly revision: bigint;
|
|
66
|
+
/** On CONFLICT: the value the host holds at that revision. */
|
|
67
|
+
readonly enabled?: boolean | undefined;
|
|
22
68
|
}
|
|
23
69
|
|
|
24
70
|
export interface JoinRequest {
|
|
@@ -41,7 +87,8 @@ export interface Directory {
|
|
|
41
87
|
newCertificate: Uint8Array;
|
|
42
88
|
newVault: Uint8Array;
|
|
43
89
|
}): Promise<MutationOutcome>;
|
|
44
|
-
|
|
90
|
+
/** `vault` is absent for an account on a recovery-only profile without a recovery provider. */
|
|
91
|
+
registerAccount(input: { certificate: Uint8Array; vault: Uint8Array | undefined }): Promise<MutationOutcome>;
|
|
45
92
|
getVault(accountName: string): Promise<Uint8Array | undefined>;
|
|
46
93
|
publishVault(input: { expectedRevision: bigint; expectedHash: Uint8Array | undefined; newVault: Uint8Array }): Promise<MutationOutcome>;
|
|
47
94
|
getCircle(circleId: Uint8Array): Promise<Uint8Array | undefined>;
|
|
@@ -55,10 +102,30 @@ export interface Directory {
|
|
|
55
102
|
accountName: string;
|
|
56
103
|
expectedOldIdentityId: Uint8Array;
|
|
57
104
|
newCertificate: Uint8Array;
|
|
58
|
-
newVault: Uint8Array;
|
|
105
|
+
newVault: Uint8Array | undefined;
|
|
59
106
|
resetId: Uint8Array;
|
|
60
107
|
reauthProof: Uint8Array;
|
|
61
108
|
}): Promise<MutationOutcome & { receipt?: Uint8Array | undefined }>;
|
|
109
|
+
/**
|
|
110
|
+
* Account recovery (amendment A1): commit a prepared replacement. `ALREADY_COMMITTED` with the
|
|
111
|
+
* original document for a repeated `successionId` with identical bytes is answered before any
|
|
112
|
+
* authorization check; `CONFLICT` carries the current certificate; `UNAUTHORIZED` covers a
|
|
113
|
+
* missing, expired or mismatched authorization and a known id with different bytes.
|
|
114
|
+
*/
|
|
115
|
+
succeedAccount(input: {
|
|
116
|
+
accountName: string;
|
|
117
|
+
expectedCertificateHash: Uint8Array;
|
|
118
|
+
newCertificate: Uint8Array;
|
|
119
|
+
newVault: Uint8Array | undefined;
|
|
120
|
+
successionId: Uint8Array;
|
|
121
|
+
authorization: Uint8Array;
|
|
122
|
+
}): Promise<MutationOutcome & { succession?: Uint8Array | undefined }>;
|
|
123
|
+
/** One page of an account's succession chain, in generation order, links whose new generation exceeds `afterGeneration`. */
|
|
124
|
+
getSuccessions(accountId: Uint8Array, afterGeneration: bigint, limit: number): Promise<SuccessionPage>;
|
|
125
|
+
/** One page of the authenticated account's circles, for bootstrap without a vault. */
|
|
126
|
+
listCircles(cursor: string | undefined): Promise<CirclePage>;
|
|
127
|
+
/** Compare-and-swap on the per-circle preference revision the host keeps for the authenticated account. */
|
|
128
|
+
setSharingPreference(circleId: Uint8Array, enabled: boolean, expectedRevision: bigint): Promise<PreferenceOutcome>;
|
|
62
129
|
}
|
|
63
130
|
|
|
64
131
|
export interface EpochBundle {
|