@interop/wallet-core 0.16.0 → 0.18.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 +13 -13
- package/dist/clients/index.d.ts +4 -3
- package/dist/clients/index.d.ts.map +1 -1
- package/dist/clients/index.js +3 -2
- package/dist/clients/index.js.map +1 -1
- package/dist/clients/policy.d.ts +3 -3
- package/dist/clients/policy.d.ts.map +1 -1
- package/dist/clients/policy.js +1 -1
- package/dist/clients/revocation.d.ts +18 -15
- package/dist/clients/revocation.d.ts.map +1 -1
- package/dist/clients/revocation.js +42 -26
- package/dist/clients/revocation.js.map +1 -1
- package/dist/clients/rosterPolicy.d.ts +46 -24
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/clients/rosterPolicy.js +106 -48
- package/dist/clients/rosterPolicy.js.map +1 -1
- package/dist/descriptors/refresh.d.ts +3 -1
- package/dist/descriptors/refresh.d.ts.map +1 -1
- package/dist/descriptors/refresh.js +3 -1
- package/dist/descriptors/refresh.js.map +1 -1
- package/dist/display/alignment.d.ts +8 -2
- package/dist/display/alignment.d.ts.map +1 -1
- package/dist/display/alignment.js +11 -8
- package/dist/display/alignment.js.map +1 -1
- package/dist/display/displayFields.d.ts +6 -2
- package/dist/display/displayFields.d.ts.map +1 -1
- package/dist/display/displayFields.js.map +1 -1
- package/dist/display/evidence.d.ts +9 -3
- package/dist/display/evidence.d.ts.map +1 -1
- package/dist/display/evidence.js +3 -1
- package/dist/display/evidence.js.map +1 -1
- package/dist/display/index.d.ts +1 -1
- package/dist/display/index.d.ts.map +1 -1
- package/dist/display/index.js +1 -1
- package/dist/display/index.js.map +1 -1
- package/dist/display/issuer.d.ts +12 -4
- package/dist/display/issuer.d.ts.map +1 -1
- package/dist/display/issuer.js.map +1 -1
- package/dist/display/obv3.d.ts +7 -2
- package/dist/display/obv3.d.ts.map +1 -1
- package/dist/display/obv3.js +14 -24
- package/dist/display/obv3.js.map +1 -1
- package/dist/display/parse.d.ts +6 -2
- package/dist/display/parse.d.ts.map +1 -1
- package/dist/display/parse.js +6 -2
- package/dist/display/parse.js.map +1 -1
- package/dist/display/subject.d.ts +4 -0
- package/dist/display/subject.d.ts.map +1 -1
- package/dist/display/subject.js +12 -10
- package/dist/display/subject.js.map +1 -1
- package/dist/display/text.d.ts +11 -0
- package/dist/display/text.d.ts.map +1 -1
- package/dist/display/text.js +20 -4
- package/dist/display/text.js.map +1 -1
- package/dist/display/types.js +1 -1
- package/dist/display/types.js.map +1 -1
- package/dist/display/validity.js +4 -4
- package/dist/display/validity.js.map +1 -1
- package/dist/display/verificationView.d.ts +21 -7
- package/dist/display/verificationView.d.ts.map +1 -1
- package/dist/display/verificationView.js.map +1 -1
- package/dist/enrollment/enrollment.d.ts +21 -19
- package/dist/enrollment/enrollment.d.ts.map +1 -1
- package/dist/enrollment/enrollment.js +98 -34
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/enrollment/index.d.ts +1 -1
- package/dist/enrollment/index.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/keys/clientKeyRecord.d.ts +19 -17
- package/dist/keys/clientKeyRecord.d.ts.map +1 -1
- package/dist/keys/clientKeyRecord.js +77 -41
- package/dist/keys/clientKeyRecord.js.map +1 -1
- package/dist/keys/index.d.ts +19 -17
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +16 -14
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterStore.d.ts +3 -3
- package/dist/keys/rosterStore.d.ts.map +1 -1
- package/dist/keys/rosterStore.js +13 -13
- package/dist/keys/rosterStore.js.map +1 -1
- package/dist/keys/userKey.d.ts +43 -0
- package/dist/keys/userKey.d.ts.map +1 -0
- package/dist/keys/{puk.js → userKey.js} +23 -21
- package/dist/keys/userKey.js.map +1 -0
- package/dist/keys/{pukCascade.d.ts → userKeyCascade.d.ts} +69 -69
- package/dist/keys/userKeyCascade.d.ts.map +1 -0
- package/dist/keys/{pukCascade.js → userKeyCascade.js} +77 -75
- package/dist/keys/userKeyCascade.js.map +1 -0
- package/dist/keys/{pukRoster.d.ts → userKeyRoster.d.ts} +141 -64
- package/dist/keys/userKeyRoster.d.ts.map +1 -0
- package/dist/keys/{pukRoster.js → userKeyRoster.js} +200 -72
- package/dist/keys/userKeyRoster.js.map +1 -0
- package/dist/recovery/index.d.ts +1 -1
- package/dist/recovery/index.js +1 -1
- package/dist/recovery/recoveryCode.d.ts +1 -1
- package/dist/recovery/recoveryCode.js +6 -6
- package/dist/recovery/recoveryRecord.d.ts +1 -1
- package/dist/recovery/recoveryWebvh.d.ts +1 -1
- package/dist/recovery/recoveryWebvh.js +1 -1
- package/dist/request/classify.d.ts +15 -1
- package/dist/request/classify.d.ts.map +1 -1
- package/dist/request/classify.js +38 -14
- package/dist/request/classify.js.map +1 -1
- package/dist/request/composeVp.d.ts.map +1 -1
- package/dist/request/composeVp.js +10 -3
- package/dist/request/composeVp.js.map +1 -1
- package/dist/request/matching.d.ts +6 -0
- package/dist/request/matching.d.ts.map +1 -1
- package/dist/request/matching.js +33 -8
- package/dist/request/matching.js.map +1 -1
- package/dist/request/parse.d.ts +5 -2
- package/dist/request/parse.d.ts.map +1 -1
- package/dist/request/parse.js +30 -5
- package/dist/request/parse.js.map +1 -1
- package/dist/request/presentationSuite.d.ts.map +1 -1
- package/dist/request/presentationSuite.js +6 -2
- package/dist/request/presentationSuite.js.map +1 -1
- package/dist/request/processRequest.js +1 -1
- package/dist/request/processRequest.js.map +1 -1
- package/dist/space/activity.d.ts +22 -8
- package/dist/space/activity.d.ts.map +1 -1
- package/dist/space/activity.js +19 -7
- package/dist/space/activity.js.map +1 -1
- package/dist/space/collections.d.ts +33 -21
- package/dist/space/collections.d.ts.map +1 -1
- package/dist/space/collections.js +34 -22
- package/dist/space/collections.js.map +1 -1
- package/dist/space/index.d.ts +2 -2
- package/dist/space/index.d.ts.map +1 -1
- package/dist/space/index.js +2 -2
- package/dist/space/index.js.map +1 -1
- package/dist/space/wasLink.d.ts +6 -2
- package/dist/space/wasLink.d.ts.map +1 -1
- package/dist/space/wasLink.js +5 -2
- package/dist/space/wasLink.js.map +1 -1
- package/dist/sync/contactsConflict.d.ts +1 -1
- package/dist/sync/contactsConflict.js +1 -1
- package/dist/sync/engine.d.ts +33 -11
- package/dist/sync/engine.d.ts.map +1 -1
- package/dist/sync/engine.js +4 -3
- package/dist/sync/engine.js.map +1 -1
- package/dist/sync/pull.d.ts +5 -3
- package/dist/sync/pull.d.ts.map +1 -1
- package/dist/sync/pull.js +34 -10
- package/dist/sync/pull.js.map +1 -1
- package/dist/sync/push.d.ts.map +1 -1
- package/dist/sync/push.js +24 -8
- package/dist/sync/push.js.map +1 -1
- package/dist/sync/types.d.ts +30 -6
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/webvh/didWebvh.d.ts +29 -1
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +46 -11
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/index.d.ts +1 -1
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +1 -1
- package/dist/webvh/index.js.map +1 -1
- package/dist/webvh/listClients.d.ts +19 -0
- package/dist/webvh/listClients.d.ts.map +1 -1
- package/dist/webvh/listClients.js +37 -1
- package/dist/webvh/listClients.js.map +1 -1
- package/dist/webvh/revokeClient.d.ts +11 -3
- package/dist/webvh/revokeClient.d.ts.map +1 -1
- package/dist/webvh/revokeClient.js +83 -14
- package/dist/webvh/revokeClient.js.map +1 -1
- package/package.json +3 -3
- package/dist/keys/puk.d.ts +0 -42
- package/dist/keys/puk.d.ts.map +0 -1
- package/dist/keys/puk.js.map +0 -1
- package/dist/keys/pukCascade.d.ts.map +0 -1
- package/dist/keys/pukCascade.js.map +0 -1
- package/dist/keys/pukRoster.d.ts.map +0 -1
- package/dist/keys/pukRoster.js.map +0 -1
package/README.md
CHANGED
|
@@ -71,19 +71,19 @@ The subpaths:
|
|
|
71
71
|
store they write through, and ZCap signing under the did:webvh
|
|
72
72
|
verification-method id.
|
|
73
73
|
|
|
74
|
-
- **`@interop/wallet-core/keys`** -- the
|
|
75
|
-
`key-map/
|
|
76
|
-
primitives with their client-side guards (`epochsMac`, the
|
|
77
|
-
pin, the document-backed recipient resolver), the roster's
|
|
78
|
-
descriptor store, and the
|
|
79
|
-
collection onto the roster's current
|
|
80
|
-
state alone, history escrowed -- also the
|
|
81
|
-
plus the detector that converges a roster
|
|
82
|
-
recipient the account document no longer
|
|
83
|
-
display labels (`key-map/client-labels.json`)
|
|
84
|
-
the client-key record codec: the contents and
|
|
85
|
-
record each wallet client keeps its own key
|
|
86
|
-
stay app-side).
|
|
74
|
+
- **`@interop/wallet-core/keys`** -- the user key and its
|
|
75
|
+
`key-map/user-key.json` wrap-set roster: minting, the roster's
|
|
76
|
+
init/read/rotate primitives with their client-side guards (`epochsMac`, the
|
|
77
|
+
latest-seen epoch pin, the document-backed recipient resolver), the roster's
|
|
78
|
+
compare-and-swap descriptor store, and the user key rotation cascade's
|
|
79
|
+
per-collection op (re-epoch a collection onto the roster's current user key,
|
|
80
|
+
staleness detected from durable state alone, history escrowed -- also the
|
|
81
|
+
completion sweep's building block), plus the detector that converges a roster
|
|
82
|
+
left wrapping the current key to a recipient the account document no longer
|
|
83
|
+
keys. Also the enrolled-client display labels (`key-map/client-labels.json`)
|
|
84
|
+
and their WAS-backed store. Also the client-key record codec: the contents and
|
|
85
|
+
strict validation of the local record each wallet client keeps its own key
|
|
86
|
+
material in (storage and wrapping stay app-side).
|
|
87
87
|
|
|
88
88
|
- **`@interop/wallet-core/clients`** -- the enrolled-client management surface:
|
|
89
89
|
the listing over the locally verified did:webvh log with display labels
|
package/dist/clients/index.d.ts
CHANGED
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
* - `revokeAccountClient` -- the revocation cascade in dependency order
|
|
18
18
|
* (document edit, roster rotation, collection fan-out, optional recovery
|
|
19
19
|
* re-mints), with the app-specific stages injected.
|
|
20
|
-
* - `
|
|
20
|
+
* - `checkUserKeyRosterAtLogin` / `convergeUserKeyRosterToAccount` -- the
|
|
21
|
+
* login-time
|
|
21
22
|
* roster policy: which roster failures refuse a session, and the standing
|
|
22
23
|
* convergence of the roster onto the account document.
|
|
23
24
|
*/
|
|
@@ -27,6 +28,6 @@ export { cascadeCompletion, disconnectEligibility, revokedClientKeysFor } from '
|
|
|
27
28
|
export type { DisconnectRefusal } from './policy.js';
|
|
28
29
|
export { revokeAccountClient } from './revocation.js';
|
|
29
30
|
export type { CascadeCollections, ClientRevocationResult } from './revocation.js';
|
|
30
|
-
export {
|
|
31
|
-
export type {
|
|
31
|
+
export { checkUserKeyRosterAtLogin, convergeUserKeyRosterToAccount } from './rosterPolicy.js';
|
|
32
|
+
export type { AdoptedUserKey } from './rosterPolicy.js';
|
|
32
33
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clients/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clients/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAC5E,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAEpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACrD,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EACL,yBAAyB,EACzB,8BAA8B,EAC/B,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/clients/index.js
CHANGED
|
@@ -17,12 +17,13 @@
|
|
|
17
17
|
* - `revokeAccountClient` -- the revocation cascade in dependency order
|
|
18
18
|
* (document edit, roster rotation, collection fan-out, optional recovery
|
|
19
19
|
* re-mints), with the app-specific stages injected.
|
|
20
|
-
* - `
|
|
20
|
+
* - `checkUserKeyRosterAtLogin` / `convergeUserKeyRosterToAccount` -- the
|
|
21
|
+
* login-time
|
|
21
22
|
* roster policy: which roster failures refuse a session, and the standing
|
|
22
23
|
* convergence of the roster onto the account document.
|
|
23
24
|
*/
|
|
24
25
|
export { currentAccountSigningKeys, listAccountClients } from './listing.js';
|
|
25
26
|
export { cascadeCompletion, disconnectEligibility, revokedClientKeysFor } from './policy.js';
|
|
26
27
|
export { revokeAccountClient } from './revocation.js';
|
|
27
|
-
export {
|
|
28
|
+
export { checkUserKeyRosterAtLogin, convergeUserKeyRosterToAccount } from './rosterPolicy.js';
|
|
28
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/clients/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/clients/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAO5E,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,aAAa,CAAA;AAGpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAMrD,OAAO,EACL,yBAAyB,EACzB,8BAA8B,EAC/B,MAAM,mBAAmB,CAAA"}
|
package/dist/clients/policy.d.ts
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* that as an error would contradict its own refreshed listing.
|
|
30
30
|
*/
|
|
31
31
|
import type { RevokedClientKeys } from '../webvh/index.js';
|
|
32
|
-
import type {
|
|
32
|
+
import type { UserKeyCascadeResult } from '../keys/index.js';
|
|
33
33
|
import type { AccountClientView } from './listing.js';
|
|
34
34
|
/**
|
|
35
35
|
* Why a listed row cannot be disconnected. See the module doc.
|
|
@@ -70,10 +70,10 @@ export declare function revokedClientKeysFor({ client }: {
|
|
|
70
70
|
* success, never an error (see the module doc).
|
|
71
71
|
*
|
|
72
72
|
* @param options {object}
|
|
73
|
-
* @param options.collections {
|
|
73
|
+
* @param options.collections {UserKeyCascadeResult} the collection fan-out result
|
|
74
74
|
* @returns {'complete' | 'partial'}
|
|
75
75
|
*/
|
|
76
76
|
export declare function cascadeCompletion({ collections }: {
|
|
77
|
-
collections:
|
|
77
|
+
collections: UserKeyCascadeResult;
|
|
78
78
|
}): 'complete' | 'partial';
|
|
79
79
|
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/clients/policy.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/clients/policy.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAErD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAC3B,MAAM,GAAG,aAAa,GAAG,yBAAyB,CAAA;AAEpD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,OAAO,EACR,EAAE;IACD,MAAM,EAAE,iBAAiB,CAAA;IACzB,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAC7B,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,iBAAiB,CAAA;CAAE,CAWpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACP,EAAE;IACD,MAAM,EAAE,iBAAiB,CAAA;CAC1B,GAAG,iBAAiB,CAYpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACZ,EAAE;IACD,WAAW,EAAE,oBAAoB,CAAA;CAClC,GAAG,UAAU,GAAG,SAAS,CAEzB"}
|
package/dist/clients/policy.js
CHANGED
|
@@ -46,7 +46,7 @@ export function revokedClientKeysFor({ client }) {
|
|
|
46
46
|
* success, never an error (see the module doc).
|
|
47
47
|
*
|
|
48
48
|
* @param options {object}
|
|
49
|
-
* @param options.collections {
|
|
49
|
+
* @param options.collections {UserKeyCascadeResult} the collection fan-out result
|
|
50
50
|
* @returns {'complete' | 'partial'}
|
|
51
51
|
*/
|
|
52
52
|
export function cascadeCompletion({ collections }) {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* leaves the document. There is no per-collection revoke anywhere in the
|
|
17
17
|
* cascade; apps a revoked client had connected reconnect through the
|
|
18
18
|
* ordinary connect flow.
|
|
19
|
-
* 2. **The
|
|
19
|
+
* 2. **The user key rotation** in the wrap-set roster, recipients resolved
|
|
20
20
|
* from the document the edit itself just resolved to (no re-fetch of the
|
|
21
21
|
* log this call just extended). The roster delivers, never sources, so the
|
|
22
22
|
* revoked client's entry is dropped even before the retire filter. An
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
*/
|
|
47
47
|
import type { IKeyAgreementKey } from '@interop/data-integrity-core';
|
|
48
48
|
import type { CollectionEncryption } from '@interop/was-client';
|
|
49
|
-
import type { EncryptionDescriptorStore } from '@interop/was-client/edv';
|
|
49
|
+
import type { EncryptionDescriptorStore, EpochsSigner } from '@interop/was-client/edv';
|
|
50
50
|
import { type ClientWebvhUpdateKeys, type RevokedClientKeys, type WebvhIdStore } from '../webvh/index.js';
|
|
51
|
-
import { type
|
|
51
|
+
import { type UserKey, type UserKeyCascadeResult } from '../keys/index.js';
|
|
52
52
|
/**
|
|
53
53
|
* Where the cascade's collection fan-out gets its work: which encrypted
|
|
54
54
|
* collections exist (only the app knows -- a mobile replica names the
|
|
@@ -69,9 +69,9 @@ export interface CascadeCollections {
|
|
|
69
69
|
*/
|
|
70
70
|
export interface ClientRevocationResult {
|
|
71
71
|
rotated: boolean;
|
|
72
|
-
collections:
|
|
72
|
+
collections: UserKeyCascadeResult;
|
|
73
73
|
document: object;
|
|
74
|
-
|
|
74
|
+
userKey?: UserKey;
|
|
75
75
|
rosterDescriptor?: CollectionEncryption;
|
|
76
76
|
recovery?: {
|
|
77
77
|
reminted: number;
|
|
@@ -109,36 +109,39 @@ export interface ClientRevocationResult {
|
|
|
109
109
|
* key; supplied, self-revocation is refused up front by the rule the surface
|
|
110
110
|
* should name, rather than by the update-key check inside the edit
|
|
111
111
|
* @param options.rosterStore {EncryptionDescriptorStore} the
|
|
112
|
-
* `key-map/
|
|
113
|
-
* @param [options.
|
|
112
|
+
* `key-map/user-key.json` roster store
|
|
113
|
+
* @param [options.userKey] {UserKey} this client's cached user key
|
|
114
114
|
* @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
|
|
115
115
|
* (identity) key-agreement key -- its roster entry
|
|
116
|
+
* @param options.signEpochs {EpochsSigner} this client's epoch-configuration
|
|
117
|
+
* signer (`userKeyRosterEpochsSigner`), vouching for the rotated roster epoch
|
|
116
118
|
* @param [options.pinnedEpochId] {string} the locally pinned latest-seen
|
|
117
119
|
* roster epoch
|
|
118
|
-
* @param [options.
|
|
119
|
-
* with `{
|
|
120
|
+
* @param [options.onUserKeyAdopted] {Function} persists a rotated key: called
|
|
121
|
+
* with `{ userKey, latestEpochId, descriptor }` after the roster read and BEFORE
|
|
120
122
|
* the fan-out. The key and the epoch pin must persist atomically
|
|
121
123
|
* @param options.collections {CascadeCollections} the fan-out's work
|
|
122
124
|
* @param [options.remintRecoveryDelegations] {Function} `({ document }) =>
|
|
123
125
|
* Promise<{ reminted, skipped }>` -- the recovery-delegation re-mint stage,
|
|
124
126
|
* for a wallet that issues recovery codes
|
|
125
|
-
* @param [options.onRotationAdopted] {Function} `({
|
|
127
|
+
* @param [options.onRotationAdopted] {Function} `({ userKey }) => Promise<void>`
|
|
126
128
|
* -- the live-session adoption of a rotated key, run last so the session
|
|
127
129
|
* keeps operating without a re-login
|
|
128
130
|
* @returns {Promise<ClientRevocationResult>}
|
|
129
131
|
*/
|
|
130
|
-
export declare function revokeAccountClient({ idStore, updateKeys, revokedClient, knownLatentHashes, ownSigningKeyMultibase, rosterStore,
|
|
132
|
+
export declare function revokeAccountClient({ idStore, updateKeys, revokedClient, knownLatentHashes, ownSigningKeyMultibase, rosterStore, userKey, clientKeyAgreementKey, signEpochs, pinnedEpochId, onUserKeyAdopted, collections, remintRecoveryDelegations, onRotationAdopted }: {
|
|
131
133
|
idStore: WebvhIdStore;
|
|
132
134
|
updateKeys: ClientWebvhUpdateKeys;
|
|
133
135
|
revokedClient: RevokedClientKeys;
|
|
134
136
|
knownLatentHashes?: string[];
|
|
135
137
|
ownSigningKeyMultibase?: string;
|
|
136
138
|
rosterStore: EncryptionDescriptorStore;
|
|
137
|
-
|
|
139
|
+
userKey?: UserKey;
|
|
138
140
|
clientKeyAgreementKey: IKeyAgreementKey;
|
|
141
|
+
signEpochs: EpochsSigner;
|
|
139
142
|
pinnedEpochId?: string | null;
|
|
140
|
-
|
|
141
|
-
|
|
143
|
+
onUserKeyAdopted?: (adopted: {
|
|
144
|
+
userKey: UserKey;
|
|
142
145
|
latestEpochId: string;
|
|
143
146
|
descriptor: CollectionEncryption;
|
|
144
147
|
}) => Promise<void>;
|
|
@@ -150,7 +153,7 @@ export declare function revokeAccountClient({ idStore, updateKeys, revokedClient
|
|
|
150
153
|
skipped: number;
|
|
151
154
|
}>;
|
|
152
155
|
onRotationAdopted?: (rotation: {
|
|
153
|
-
|
|
156
|
+
userKey: UserKey;
|
|
154
157
|
}) => Promise<void>;
|
|
155
158
|
}): Promise<ClientRevocationResult>;
|
|
156
159
|
//# sourceMappingURL=revocation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revocation.d.ts","sourceRoot":"","sources":["../../src/clients/revocation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"revocation.d.ts","sourceRoot":"","sources":["../../src/clients/revocation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EACV,yBAAyB,EACzB,YAAY,EACb,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAKL,KAAK,OAAO,EACZ,KAAK,oBAAoB,EAC1B,MAAM,kBAAkB,CAAA;AAEzB;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,aAAa,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AAO,EAAE;QAC3B,OAAO,EAAE,OAAO,CAAA;QAChB,aAAa,EAAE,MAAM,CAAA;QACrB,UAAU,EAAE,oBAAoB,CAAA;KACjC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACnB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,yBAAyB,CAAC,EAAE,CAAC,OAAO,EAAE;QACpC,QAAQ,EAAE,MAAM,CAAA;KACjB,KAAK,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACpD,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACtE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAuGlC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { revokeWebvhClient } from '../webvh/index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { cascadeCollectionsToUserKey, readUserKeyRoster, rosterRecipientKid, rotateUserKeyRoster } from '../keys/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Resolves the collection ids the fan-out covers, whether they are a fixed set
|
|
5
5
|
* or a listing the app performs.
|
|
@@ -45,25 +45,27 @@ async function collectionIdsOf({ collections }) {
|
|
|
45
45
|
* key; supplied, self-revocation is refused up front by the rule the surface
|
|
46
46
|
* should name, rather than by the update-key check inside the edit
|
|
47
47
|
* @param options.rosterStore {EncryptionDescriptorStore} the
|
|
48
|
-
* `key-map/
|
|
49
|
-
* @param [options.
|
|
48
|
+
* `key-map/user-key.json` roster store
|
|
49
|
+
* @param [options.userKey] {UserKey} this client's cached user key
|
|
50
50
|
* @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
|
|
51
51
|
* (identity) key-agreement key -- its roster entry
|
|
52
|
+
* @param options.signEpochs {EpochsSigner} this client's epoch-configuration
|
|
53
|
+
* signer (`userKeyRosterEpochsSigner`), vouching for the rotated roster epoch
|
|
52
54
|
* @param [options.pinnedEpochId] {string} the locally pinned latest-seen
|
|
53
55
|
* roster epoch
|
|
54
|
-
* @param [options.
|
|
55
|
-
* with `{
|
|
56
|
+
* @param [options.onUserKeyAdopted] {Function} persists a rotated key: called
|
|
57
|
+
* with `{ userKey, latestEpochId, descriptor }` after the roster read and BEFORE
|
|
56
58
|
* the fan-out. The key and the epoch pin must persist atomically
|
|
57
59
|
* @param options.collections {CascadeCollections} the fan-out's work
|
|
58
60
|
* @param [options.remintRecoveryDelegations] {Function} `({ document }) =>
|
|
59
61
|
* Promise<{ reminted, skipped }>` -- the recovery-delegation re-mint stage,
|
|
60
62
|
* for a wallet that issues recovery codes
|
|
61
|
-
* @param [options.onRotationAdopted] {Function} `({
|
|
63
|
+
* @param [options.onRotationAdopted] {Function} `({ userKey }) => Promise<void>`
|
|
62
64
|
* -- the live-session adoption of a rotated key, run last so the session
|
|
63
65
|
* keeps operating without a re-login
|
|
64
66
|
* @returns {Promise<ClientRevocationResult>}
|
|
65
67
|
*/
|
|
66
|
-
export async function revokeAccountClient({ idStore, updateKeys, revokedClient, knownLatentHashes, ownSigningKeyMultibase, rosterStore,
|
|
68
|
+
export async function revokeAccountClient({ idStore, updateKeys, revokedClient, knownLatentHashes, ownSigningKeyMultibase, rosterStore, userKey, clientKeyAgreementKey, signEpochs, pinnedEpochId, onUserKeyAdopted, collections, remintRecoveryDelegations, onRotationAdopted }) {
|
|
67
69
|
if (ownSigningKeyMultibase &&
|
|
68
70
|
ownSigningKeyMultibase === revokedClient.signingKeyMultibase) {
|
|
69
71
|
throw new Error('This wallet cannot disconnect itself; use another enrolled wallet ' +
|
|
@@ -83,30 +85,44 @@ export async function revokeAccountClient({ idStore, updateKeys, revokedClient,
|
|
|
83
85
|
...(knownLatentHashes ? { knownLatentHashes } : {})
|
|
84
86
|
});
|
|
85
87
|
// 2. The roster rotation, recipients resolved from that same document.
|
|
86
|
-
|
|
88
|
+
// Whether there IS a roster is settled BEFORE the rotation: an account with
|
|
89
|
+
// no `key-map/user-key.json` (its collections are not encrypted yet) has nothing
|
|
90
|
+
// to rotate, and the rotation itself refuses an absent descriptor rather
|
|
91
|
+
// than no-op'ing. The document edit has already landed, so the client IS
|
|
92
|
+
// disconnected -- a completed cascade with nothing rotated, not a failure.
|
|
93
|
+
const roster = await rosterStore.read();
|
|
94
|
+
if (roster === null) {
|
|
95
|
+
return {
|
|
96
|
+
rotated: false,
|
|
97
|
+
collections: { outcomes: {}, failed: [] },
|
|
98
|
+
document: doc
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
await rotateUserKeyRoster({
|
|
87
102
|
store: rosterStore,
|
|
88
103
|
document: doc,
|
|
89
|
-
retireRecipientId: rosterRecipientKid(revokedClient)
|
|
104
|
+
retireRecipientId: rosterRecipientKid(revokedClient),
|
|
105
|
+
signEpochs
|
|
90
106
|
});
|
|
91
|
-
const read = await
|
|
107
|
+
const read = await readUserKeyRoster({
|
|
92
108
|
store: rosterStore,
|
|
93
|
-
...(
|
|
109
|
+
...(userKey ? { userKey } : {}),
|
|
94
110
|
clientKeyAgreementKey,
|
|
95
|
-
pinnedEpochId
|
|
111
|
+
pinnedEpochId,
|
|
112
|
+
document: doc
|
|
96
113
|
});
|
|
97
114
|
if (!read) {
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
};
|
|
115
|
+
// The roster stood a moment ago and the rotation just wrote it, so its
|
|
116
|
+
// disappearance is a real fault, not the no-roster case above: the fresh
|
|
117
|
+
// key is only readable from the roster, and reporting success here would
|
|
118
|
+
// fan out under the retired one.
|
|
119
|
+
throw new Error('The wrap-set roster vanished between its rotation and the read that ' +
|
|
120
|
+
'adopts the fresh user key; the client is disconnected, but the ' +
|
|
121
|
+
'rotation must be completed by re-running the revocation.');
|
|
106
122
|
}
|
|
107
123
|
if (read.rotated) {
|
|
108
|
-
await
|
|
109
|
-
|
|
124
|
+
await onUserKeyAdopted?.({
|
|
125
|
+
userKey: read.userKey,
|
|
110
126
|
latestEpochId: read.latestEpochId,
|
|
111
127
|
descriptor: read.descriptor
|
|
112
128
|
});
|
|
@@ -114,7 +130,7 @@ export async function revokeAccountClient({ idStore, updateKeys, revokedClient,
|
|
|
114
130
|
// 3. The collection fan-out, in parallel -- run even when this call found
|
|
115
131
|
// the roster already rotated (a re-run after a crash), because the staleness
|
|
116
132
|
// rule finds exactly the stranded collections.
|
|
117
|
-
const cascade = await
|
|
133
|
+
const cascade = await cascadeCollectionsToUserKey({
|
|
118
134
|
collectionIds: await collectionIdsOf({ collections }),
|
|
119
135
|
storeFor: collections.storeFor,
|
|
120
136
|
...(collections.isEncrypted
|
|
@@ -122,19 +138,19 @@ export async function revokeAccountClient({ idStore, updateKeys, revokedClient,
|
|
|
122
138
|
: {}),
|
|
123
139
|
rosterDescriptor: read.descriptor,
|
|
124
140
|
clientKeyAgreementKey,
|
|
125
|
-
|
|
141
|
+
userKey: read.userKey
|
|
126
142
|
});
|
|
127
143
|
// 4. The recovery re-mints, while the registry is still readable under the
|
|
128
144
|
// session's pre-adoption vault keys.
|
|
129
145
|
const recovery = await remintRecoveryDelegations?.({ document: doc });
|
|
130
146
|
if (read.rotated) {
|
|
131
|
-
await onRotationAdopted?.({
|
|
147
|
+
await onRotationAdopted?.({ userKey: read.userKey });
|
|
132
148
|
}
|
|
133
149
|
return {
|
|
134
150
|
rotated: read.rotated,
|
|
135
151
|
collections: cascade,
|
|
136
152
|
document: doc,
|
|
137
|
-
|
|
153
|
+
userKey: read.userKey,
|
|
138
154
|
rosterDescriptor: read.descriptor,
|
|
139
155
|
...(recovery ? { recovery } : {})
|
|
140
156
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revocation.js","sourceRoot":"","sources":["../../src/clients/revocation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"revocation.js","sourceRoot":"","sources":["../../src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C,EAAE,WAAW,EAAE,CAAC;QACrD,QAAQ,EAAE,WAAW,CAAC,QAAQ;QAC9B,GAAG,CAAC,WAAW,CAAC,WAAW;YACzB,CAAC,CAAC,EAAE,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE;YAC1C,CAAC,CAAC,EAAE,CAAC;QACP,gBAAgB,EAAE,IAAI,CAAC,UAAU;QACjC,qBAAqB;QACrB,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC,CAAA;IAEF,2EAA2E;IAC3E,qCAAqC;IACrC,MAAM,QAAQ,GAAG,MAAM,yBAAyB,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAA;IAErE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,iBAAiB,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;IACtD,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,WAAW,EAAE,OAAO;QACpB,QAAQ,EAAE,GAAG;QACb,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,gBAAgB,EAAE,IAAI,CAAC,UAAU;QACjC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClC,CAAA;AACH,CAAC"}
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* The login-time wrap-set roster policy: what a wallet does with
|
|
6
|
-
* `key-map/
|
|
6
|
+
* `key-map/user-key.json` when a session starts, and how it decides between
|
|
7
7
|
* refusing the session and carrying on offline.
|
|
8
8
|
*
|
|
9
9
|
* Two steps, in this order:
|
|
10
10
|
*
|
|
11
|
-
* - {@link
|
|
11
|
+
* - {@link checkUserKeyRosterAtLogin} -- one direct read of the roster, before
|
|
12
|
+
* any
|
|
12
13
|
* storage client or cipher is built (a stale key would silently fail to
|
|
13
14
|
* decrypt everything written since another client rotated it). The served
|
|
14
15
|
* roster is authenticated and checked against the locally pinned latest-seen
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
* (an unreachable server, a transport hiccup) is warned about and resolves
|
|
23
24
|
* `null`, so an offline start keeps working from the cached key.
|
|
24
25
|
*
|
|
25
|
-
* - {@link
|
|
26
|
+
* - {@link convergeUserKeyRosterToAccount} -- the roster stage of the
|
|
26
27
|
* cascade-completion sweep, which the collection fan-out then runs behind. A
|
|
27
28
|
* revocation torn between its document edit and its roster rotation leaves
|
|
28
29
|
* the roster wrapping the CURRENT key to a client the document no longer
|
|
@@ -45,25 +46,35 @@
|
|
|
45
46
|
*/
|
|
46
47
|
import type { IKeyAgreementKey } from '@interop/data-integrity-core';
|
|
47
48
|
import type { CollectionEncryption } from '@interop/was-client';
|
|
48
|
-
import type { EncryptionDescriptorStore } from '@interop/was-client/edv';
|
|
49
|
-
import { type
|
|
49
|
+
import type { EncryptionDescriptorStore, EpochsSigner } from '@interop/was-client/edv';
|
|
50
|
+
import { type UserKey, type UserKeyRosterReadResult } from '../keys/index.js';
|
|
50
51
|
import type { AccountLogPointer } from './listing.js';
|
|
51
52
|
/**
|
|
52
|
-
* What an adopted
|
|
53
|
+
* What an adopted user key carries: the key itself, the roster epoch to
|
|
53
54
|
* pin as latest-seen, and the descriptor it was read from.
|
|
54
55
|
*/
|
|
55
|
-
export interface
|
|
56
|
-
|
|
56
|
+
export interface AdoptedUserKey {
|
|
57
|
+
userKey: UserKey;
|
|
57
58
|
latestEpochId: string;
|
|
58
59
|
descriptor: CollectionEncryption;
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
61
62
|
* The login-time roster read. See the module doc for the failure semantics.
|
|
62
63
|
*
|
|
64
|
+
* A read that adopts an epoch from the roster (a rotation by another client,
|
|
65
|
+
* or this client's first read) must trace it to the account document, so the
|
|
66
|
+
* account log is fetched and verified lazily on exactly that path (via
|
|
67
|
+
* `pointer`). A log that cannot be fetched then lands in the
|
|
68
|
+
* transport-failure class -- the session carries on under the cached key,
|
|
69
|
+
* WITHOUT adopting the unverifiable rotation -- while a roster whose epoch
|
|
70
|
+
* configuration no enrolled client signed is a refusal like the other three.
|
|
71
|
+
*
|
|
63
72
|
* @param options {object}
|
|
64
73
|
* @param options.store {EncryptionDescriptorStore} the roster's descriptor
|
|
65
74
|
* store
|
|
66
|
-
* @param
|
|
75
|
+
* @param options.pointer {AccountLogPointer} where the account log lives,
|
|
76
|
+
* for the lazy document verification above
|
|
77
|
+
* @param [options.userKey] {UserKey} this client's cached user key; omitted (a
|
|
67
78
|
* freshly enrolled client's first read) the key is always taken from the
|
|
68
79
|
* roster
|
|
69
80
|
* @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
|
|
@@ -71,54 +82,65 @@ export interface AdoptedPuk {
|
|
|
71
82
|
* @param [options.pinnedEpochId] {string} the locally pinned latest-seen
|
|
72
83
|
* roster epoch
|
|
73
84
|
* @param [options.onRosterRead] {Function} called with the
|
|
74
|
-
* {@link
|
|
85
|
+
* {@link AdoptedUserKey} of every successful read (whether or not it rotated),
|
|
75
86
|
* so the epoch pin advances to the epoch just authenticated; the key and the
|
|
76
87
|
* pin must persist atomically
|
|
77
|
-
* @returns {Promise<
|
|
88
|
+
* @returns {Promise<UserKeyRosterReadResult | null>} the read, or `null` when
|
|
78
89
|
* the account has no roster yet or the server could not be reached
|
|
79
90
|
*/
|
|
80
|
-
export declare function
|
|
91
|
+
export declare function checkUserKeyRosterAtLogin({ store, pointer, userKey, clientKeyAgreementKey, pinnedEpochId, onRosterRead }: {
|
|
81
92
|
store: EncryptionDescriptorStore;
|
|
82
|
-
|
|
93
|
+
pointer: AccountLogPointer;
|
|
94
|
+
userKey?: UserKey;
|
|
83
95
|
clientKeyAgreementKey: IKeyAgreementKey;
|
|
84
96
|
pinnedEpochId?: string | null;
|
|
85
|
-
onRosterRead?: (adopted:
|
|
86
|
-
}): Promise<
|
|
97
|
+
onRosterRead?: (adopted: AdoptedUserKey) => Promise<void>;
|
|
98
|
+
}): Promise<UserKeyRosterReadResult | null>;
|
|
87
99
|
/**
|
|
88
100
|
* Converges the roster onto the account's locally verified did:webvh document,
|
|
89
101
|
* adopting a rotation the ordinary way (a roster re-read) and handing back the
|
|
90
102
|
* key and descriptor the collection fan-out should run against.
|
|
91
103
|
*
|
|
92
|
-
* Best-effort
|
|
93
|
-
*
|
|
104
|
+
* Best-effort UP TO the rotation: a log that cannot be fetched or verified, or
|
|
105
|
+
* a roster that turns out to need nothing, resolves to the unchanged input,
|
|
106
|
+
* since the fan-out is still worth running on the key this start already has.
|
|
107
|
+
* Past the rotation it is not best-effort at all -- once the roster has moved
|
|
108
|
+
* to a fresh key, that key is readable only from the roster, so a failed
|
|
109
|
+
* adoption throws rather than reporting `rotated: false` with the retired key
|
|
110
|
+
* and descriptor (which would skip `onUserKeyAdopted` and fan the collections
|
|
111
|
+
* out onto the pre-rotation epoch). The three roster refusals rethrow
|
|
112
|
+
* throughout, exactly as {@link checkUserKeyRosterAtLogin} rethrows them.
|
|
94
113
|
*
|
|
95
114
|
* @param options {object}
|
|
96
115
|
* @param options.pointer {AccountLogPointer} where the account log lives
|
|
97
116
|
* @param options.store {EncryptionDescriptorStore} the roster's descriptor
|
|
98
117
|
* store
|
|
99
|
-
* @param options.
|
|
118
|
+
* @param options.userKey {UserKey} the start's current user key
|
|
100
119
|
* @param options.descriptor {CollectionEncryption} the start's roster read
|
|
101
120
|
* @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
|
|
102
121
|
* (identity) key-agreement key
|
|
122
|
+
* @param options.signEpochs {EpochsSigner} this client's epoch-configuration
|
|
123
|
+
* signer (`userKeyRosterEpochsSigner`), for the rotation this call may perform
|
|
103
124
|
* @param [options.pinnedEpochId] {string} the locally pinned latest-seen
|
|
104
125
|
* roster epoch
|
|
105
|
-
* @param [options.
|
|
106
|
-
* {@link
|
|
126
|
+
* @param [options.onUserKeyAdopted] {Function} called with the
|
|
127
|
+
* {@link AdoptedUserKey} of a rotation, before the fan-out runs
|
|
107
128
|
* @returns {Promise<object>} whether the roster rotated on this call, the
|
|
108
129
|
* stale recipient kids found, and the key + descriptor to fan out with
|
|
109
130
|
*/
|
|
110
|
-
export declare function
|
|
131
|
+
export declare function convergeUserKeyRosterToAccount({ pointer, store, userKey, descriptor, clientKeyAgreementKey, signEpochs, pinnedEpochId, onUserKeyAdopted }: {
|
|
111
132
|
pointer: AccountLogPointer;
|
|
112
133
|
store: EncryptionDescriptorStore;
|
|
113
|
-
|
|
134
|
+
userKey: UserKey;
|
|
114
135
|
descriptor: CollectionEncryption;
|
|
115
136
|
clientKeyAgreementKey: IKeyAgreementKey;
|
|
137
|
+
signEpochs: EpochsSigner;
|
|
116
138
|
pinnedEpochId?: string | null;
|
|
117
|
-
|
|
139
|
+
onUserKeyAdopted?: (adopted: AdoptedUserKey) => Promise<void>;
|
|
118
140
|
}): Promise<{
|
|
119
141
|
rotated: boolean;
|
|
120
142
|
staleRecipientIds: string[];
|
|
121
|
-
|
|
143
|
+
userKey: UserKey;
|
|
122
144
|
descriptor: CollectionEncryption;
|
|
123
145
|
}>;
|
|
124
146
|
//# sourceMappingURL=rosterPolicy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rosterPolicy.d.ts","sourceRoot":"","sources":["../../src/clients/rosterPolicy.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"rosterPolicy.d.ts","sourceRoot":"","sources":["../../src/clients/rosterPolicy.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EACV,yBAAyB,EACzB,YAAY,EACb,MAAM,yBAAyB,CAAA;AAChC,OAAO,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