@interop/wallet-core 0.17.1 → 0.19.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 +15 -15
- package/dist/clients/revocation.d.ts.map +1 -1
- package/dist/clients/revocation.js +19 -19
- package/dist/clients/revocation.js.map +1 -1
- package/dist/clients/rosterPolicy.d.ts +26 -25
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/clients/rosterPolicy.js +29 -29
- package/dist/clients/rosterPolicy.js.map +1 -1
- package/dist/enrollment/enrollment.d.ts +16 -16
- package/dist/enrollment/enrollment.d.ts.map +1 -1
- package/dist/enrollment/enrollment.js +19 -19
- 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 +16 -16
- package/dist/keys/clientKeyRecord.d.ts.map +1 -1
- package/dist/keys/clientKeyRecord.js +39 -35
- 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} +67 -64
- package/dist/keys/userKeyCascade.js.map +1 -0
- package/dist/keys/{pukRoster.d.ts → userKeyRoster.d.ts} +73 -74
- package/dist/keys/userKeyRoster.d.ts.map +1 -0
- package/dist/keys/{pukRoster.js → userKeyRoster.js} +86 -83
- 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/space/activity.d.ts +17 -1
- package/dist/space/activity.d.ts.map +1 -1
- package/dist/space/activity.js +22 -1
- package/dist/space/activity.js.map +1 -1
- package/dist/space/collections.d.ts +17 -17
- package/dist/space/collections.d.ts.map +1 -1
- package/dist/space/collections.js +16 -16
- package/dist/space/collections.js.map +1 -1
- package/dist/space/index.d.ts +3 -3
- package/dist/space/index.d.ts.map +1 -1
- package/dist/space/index.js +3 -3
- package/dist/space/index.js.map +1 -1
- package/dist/webvh/didWebvh.d.ts +1 -1
- package/dist/webvh/didWebvh.js +6 -6
- package/package.json +1 -1
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { convergeUserKeyRosterToDocument, UserKeyRosterContinuityError, UserKeyRosterIntegrityError, UserKeyRosterUnwrapError, readUserKeyRoster } from '../keys/index.js';
|
|
2
2
|
import { verifyAccountLog } from '../webvh/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Whether a thrown error is one of the three roster refusals -- a rolled-back
|
|
@@ -11,9 +11,9 @@ import { verifyAccountLog } from '../webvh/index.js';
|
|
|
11
11
|
* @returns {boolean}
|
|
12
12
|
*/
|
|
13
13
|
function isRosterRefusal(err) {
|
|
14
|
-
return (err instanceof
|
|
15
|
-
err instanceof
|
|
16
|
-
err instanceof
|
|
14
|
+
return (err instanceof UserKeyRosterContinuityError ||
|
|
15
|
+
err instanceof UserKeyRosterIntegrityError ||
|
|
16
|
+
err instanceof UserKeyRosterUnwrapError);
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* The login-time roster read. See the module doc for the failure semantics.
|
|
@@ -31,7 +31,7 @@ function isRosterRefusal(err) {
|
|
|
31
31
|
* store
|
|
32
32
|
* @param options.pointer {AccountLogPointer} where the account log lives,
|
|
33
33
|
* for the lazy document verification above
|
|
34
|
-
* @param [options.
|
|
34
|
+
* @param [options.userKey] {UserKey} this client's cached user key; omitted (a
|
|
35
35
|
* freshly enrolled client's first read) the key is always taken from the
|
|
36
36
|
* roster
|
|
37
37
|
* @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
|
|
@@ -39,17 +39,17 @@ function isRosterRefusal(err) {
|
|
|
39
39
|
* @param [options.pinnedEpochId] {string} the locally pinned latest-seen
|
|
40
40
|
* roster epoch
|
|
41
41
|
* @param [options.onRosterRead] {Function} called with the
|
|
42
|
-
* {@link
|
|
42
|
+
* {@link AdoptedUserKey} of every successful read (whether or not it rotated),
|
|
43
43
|
* so the epoch pin advances to the epoch just authenticated; the key and the
|
|
44
44
|
* pin must persist atomically
|
|
45
|
-
* @returns {Promise<
|
|
45
|
+
* @returns {Promise<UserKeyRosterReadResult | null>} the read, or `null` when
|
|
46
46
|
* the account has no roster yet or the server could not be reached
|
|
47
47
|
*/
|
|
48
|
-
export async function
|
|
48
|
+
export async function checkUserKeyRosterAtLogin({ store, pointer, userKey, clientKeyAgreementKey, pinnedEpochId, onRosterRead }) {
|
|
49
49
|
try {
|
|
50
|
-
const read = await
|
|
50
|
+
const read = await readUserKeyRoster({
|
|
51
51
|
store,
|
|
52
|
-
...(
|
|
52
|
+
...(userKey ? { userKey } : {}),
|
|
53
53
|
clientKeyAgreementKey,
|
|
54
54
|
pinnedEpochId,
|
|
55
55
|
resolveDocument: async () => (await verifyAccountLog(pointer)).doc
|
|
@@ -58,7 +58,7 @@ export async function checkPukRosterAtLogin({ store, pointer, puk, clientKeyAgre
|
|
|
58
58
|
return null;
|
|
59
59
|
}
|
|
60
60
|
await onRosterRead?.({
|
|
61
|
-
|
|
61
|
+
userKey: read.userKey,
|
|
62
62
|
latestEpochId: read.latestEpochId,
|
|
63
63
|
descriptor: read.descriptor
|
|
64
64
|
});
|
|
@@ -71,7 +71,7 @@ export async function checkPukRosterAtLogin({ store, pointer, puk, clientKeyAgre
|
|
|
71
71
|
// An unreachable server (or any transport hiccup) must not lock the user
|
|
72
72
|
// out of an offline start: the cached key stays authoritative.
|
|
73
73
|
console.warn('The wrap-set roster check failed; continuing with the cached ' +
|
|
74
|
-
'
|
|
74
|
+
'user key:', err);
|
|
75
75
|
return null;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
@@ -86,32 +86,32 @@ export async function checkPukRosterAtLogin({ store, pointer, puk, clientKeyAgre
|
|
|
86
86
|
* Past the rotation it is not best-effort at all -- once the roster has moved
|
|
87
87
|
* to a fresh key, that key is readable only from the roster, so a failed
|
|
88
88
|
* adoption throws rather than reporting `rotated: false` with the retired key
|
|
89
|
-
* and descriptor (which would skip `
|
|
90
|
-
* onto the pre-rotation epoch). The three roster refusals rethrow
|
|
91
|
-
* exactly as {@link
|
|
89
|
+
* and descriptor (which would skip `onUserKeyAdopted` and fan the collections
|
|
90
|
+
* out onto the pre-rotation epoch). The three roster refusals rethrow
|
|
91
|
+
* throughout, exactly as {@link checkUserKeyRosterAtLogin} rethrows them.
|
|
92
92
|
*
|
|
93
93
|
* @param options {object}
|
|
94
94
|
* @param options.pointer {AccountLogPointer} where the account log lives
|
|
95
95
|
* @param options.store {EncryptionDescriptorStore} the roster's descriptor
|
|
96
96
|
* store
|
|
97
|
-
* @param options.
|
|
97
|
+
* @param options.userKey {UserKey} the start's current user key
|
|
98
98
|
* @param options.descriptor {CollectionEncryption} the start's roster read
|
|
99
99
|
* @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
|
|
100
100
|
* (identity) key-agreement key
|
|
101
101
|
* @param options.signEpochs {EpochsSigner} this client's epoch-configuration
|
|
102
|
-
* signer (`
|
|
102
|
+
* signer (`userKeyRosterEpochsSigner`), for the rotation this call may perform
|
|
103
103
|
* @param [options.pinnedEpochId] {string} the locally pinned latest-seen
|
|
104
104
|
* roster epoch
|
|
105
|
-
* @param [options.
|
|
106
|
-
* {@link
|
|
105
|
+
* @param [options.onUserKeyAdopted] {Function} called with the
|
|
106
|
+
* {@link AdoptedUserKey} of a rotation, before the fan-out runs
|
|
107
107
|
* @returns {Promise<object>} whether the roster rotated on this call, the
|
|
108
108
|
* stale recipient kids found, and the key + descriptor to fan out with
|
|
109
109
|
*/
|
|
110
|
-
export async function
|
|
110
|
+
export async function convergeUserKeyRosterToAccount({ pointer, store, userKey, descriptor, clientKeyAgreementKey, signEpochs, pinnedEpochId, onUserKeyAdopted }) {
|
|
111
111
|
const unchanged = {
|
|
112
112
|
rotated: false,
|
|
113
113
|
staleRecipientIds: [],
|
|
114
|
-
|
|
114
|
+
userKey,
|
|
115
115
|
descriptor
|
|
116
116
|
};
|
|
117
117
|
let rotated;
|
|
@@ -120,7 +120,7 @@ export async function convergePukRosterToAccount({ pointer, store, puk, descript
|
|
|
120
120
|
try {
|
|
121
121
|
const { doc } = await verifyAccountLog(pointer);
|
|
122
122
|
accountDocument = doc;
|
|
123
|
-
const converged = await
|
|
123
|
+
const converged = await convergeUserKeyRosterToDocument({
|
|
124
124
|
store,
|
|
125
125
|
document: doc,
|
|
126
126
|
descriptor,
|
|
@@ -147,9 +147,9 @@ export async function convergePukRosterToAccount({ pointer, store, puk, descript
|
|
|
147
147
|
// here cannot resolve to the unchanged input -- the roster HAS moved.
|
|
148
148
|
let read;
|
|
149
149
|
try {
|
|
150
|
-
read = await
|
|
150
|
+
read = await readUserKeyRoster({
|
|
151
151
|
store,
|
|
152
|
-
|
|
152
|
+
userKey,
|
|
153
153
|
clientKeyAgreementKey,
|
|
154
154
|
pinnedEpochId,
|
|
155
155
|
document: accountDocument
|
|
@@ -159,24 +159,24 @@ export async function convergePukRosterToAccount({ pointer, store, puk, descript
|
|
|
159
159
|
if (isRosterRefusal(err)) {
|
|
160
160
|
throw err;
|
|
161
161
|
}
|
|
162
|
-
throw new Error('The wrap-set roster was rotated onto a fresh
|
|
162
|
+
throw new Error('The wrap-set roster was rotated onto a fresh user key, but the ' +
|
|
163
163
|
'read that adopts it failed; this session must not continue under ' +
|
|
164
164
|
'the retired key.', { cause: err });
|
|
165
165
|
}
|
|
166
166
|
if (!read) {
|
|
167
|
-
throw new Error('The wrap-set roster was rotated onto a fresh
|
|
167
|
+
throw new Error('The wrap-set roster was rotated onto a fresh user key and then ' +
|
|
168
168
|
'reported absent; this session must not continue under the retired ' +
|
|
169
169
|
'key.');
|
|
170
170
|
}
|
|
171
|
-
await
|
|
172
|
-
|
|
171
|
+
await onUserKeyAdopted?.({
|
|
172
|
+
userKey: read.userKey,
|
|
173
173
|
latestEpochId: read.latestEpochId,
|
|
174
174
|
descriptor: read.descriptor
|
|
175
175
|
});
|
|
176
176
|
return {
|
|
177
177
|
rotated: true,
|
|
178
178
|
staleRecipientIds,
|
|
179
|
-
|
|
179
|
+
userKey: read.userKey,
|
|
180
180
|
descriptor: read.descriptor
|
|
181
181
|
};
|
|
182
182
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rosterPolicy.js","sourceRoot":"","sources":["../../src/clients/rosterPolicy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"r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+CAA+C,CAClD,CAAA;IAED,yEAAyE;IACzE,wEAAwE;IACxE,sEAAsE;IACtE,IAAI,IAAoC,CAAA;IACxC,IAAI,CAAC;QACH,IAAI,GAAG,MAAM,iBAAiB,CAAC;YAC7B,KAAK;YACL,OAAO;YACP,qBAAqB;YACrB,aAAa;YACb,QAAQ,EAAE,eAAe;SAC1B,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,GAAG,CAAA;QACX,CAAC;QACD,MAAM,IAAI,KAAK,CACb,iEAAiE;YAC/D,mEAAmE;YACnE,kBAAkB,EACpB,EAAE,KAAK,EAAE,GAAG,EAAE,CACf,CAAA;IACH,CAAC;IACD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACb,iEAAiE;YAC/D,oEAAoE;YACpE,MAAM,CACT,CAAA;IACH,CAAC;IACD,MAAM,gBAAgB,EAAE,CAAC;QACvB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC,CAAA;IACF,OAAO;QACL,OAAO,EAAE,IAAI;QACb,iBAAiB;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAA;AACH,CAAC"}
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
* two browsers in the room today; the same payload renders as a QR for a
|
|
11
11
|
* camera-holding wallet). Nothing travels back over the channel: the account
|
|
12
12
|
* pointer comes out of the keyring (the enrollee holds the unlock secret), and
|
|
13
|
-
* the
|
|
13
|
+
* the user key comes back through the wrap-set roster.
|
|
14
14
|
*
|
|
15
15
|
* Push, not pull, in the recovery-anchor order (decryption material before
|
|
16
|
-
* authorization): the enrolling client wraps the
|
|
17
|
-
* key-agreement key in `key-map/
|
|
16
|
+
* authorization): the enrolling client wraps the user key to the new client's
|
|
17
|
+
* key-agreement key in `key-map/user-key.json` FIRST, then writes the two
|
|
18
18
|
* did:webvh log entries (commit, then add-VMs-and-update-key). No
|
|
19
19
|
* authorized-but-blind window exists at any point, and both tear points
|
|
20
20
|
* resume by re-running the ceremony with the same code -- a tear after the
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
* `<did:webvh>#<multibase>` key -- the server authorizes it under the
|
|
26
26
|
* current-key-set rule the moment the add entry publishes. Persisting the key
|
|
27
27
|
* set under the app's own unlock layer is the caller's job: this module hands
|
|
28
|
-
* back the
|
|
28
|
+
* back the user key and the roster epoch to pin, and stops there.
|
|
29
29
|
*/
|
|
30
30
|
import type { IKeyAgreementKey } from '@interop/data-integrity-core';
|
|
31
31
|
import type { EncryptionDescriptorStore } from '@interop/was-client/edv';
|
|
32
32
|
import type { ClientWebvhUpdateKeys, WebvhEnrollmentKeys, WebvhIdStore } from '../webvh/didWebvh.js';
|
|
33
|
-
import type {
|
|
33
|
+
import type { UserKey } from '../keys/userKey.js';
|
|
34
34
|
import type { AccountPointer } from '../keyring/record.js';
|
|
35
35
|
/**
|
|
36
36
|
* The public halves a connect code carries -- the same four multibases
|
|
@@ -113,8 +113,8 @@ export declare function mintEnrollmentRequest(): Promise<{
|
|
|
113
113
|
clientDid: string;
|
|
114
114
|
}>;
|
|
115
115
|
/**
|
|
116
|
-
* ENROLLING CLIENT: the whole approval, in the push order -- the
|
|
117
|
-
* into the roster first (escrow: every epoch, so the new client reads
|
|
116
|
+
* ENROLLING CLIENT: the whole approval, in the push order -- the user key
|
|
117
|
+
* wrapped into the roster first (escrow: every epoch, so the new client reads
|
|
118
118
|
* pre-enrollment history), then the two log entries. Quorum-of-one: this
|
|
119
119
|
* client's own update key signs both entries. Idempotent at every stage, so
|
|
120
120
|
* re-approving the same code after any tear converges.
|
|
@@ -126,19 +126,19 @@ export declare function mintEnrollmentRequest(): Promise<{
|
|
|
126
126
|
* @param options.clientKeyAgreementKey {IKeyAgreementKey} the approving
|
|
127
127
|
* client's own (identity) key-agreement key, unwrapping each epoch for
|
|
128
128
|
* re-wrapping
|
|
129
|
-
* @param options.
|
|
130
|
-
* `key-map/
|
|
129
|
+
* @param options.userKeyRosterStore {EncryptionDescriptorStore} the account's
|
|
130
|
+
* `key-map/user-key.json` descriptor store
|
|
131
131
|
* @param options.idStore {WebvhIdStore} the account's `id` collection
|
|
132
132
|
* @returns {Promise<object>} the account's did:webvh, plus the enrollee's
|
|
133
133
|
* own identity as this call already knows it: its did:key and its signing-key
|
|
134
134
|
* multibase (the key a label or a listing row is filed under), so the caller
|
|
135
135
|
* needs no second parse of the connect code
|
|
136
136
|
*/
|
|
137
|
-
export declare function approveEnrollment({ request, clientWebvhKeys, clientKeyAgreementKey,
|
|
137
|
+
export declare function approveEnrollment({ request, clientWebvhKeys, clientKeyAgreementKey, userKeyRosterStore, idStore }: {
|
|
138
138
|
request: EnrollmentRequest;
|
|
139
139
|
clientWebvhKeys: ClientWebvhUpdateKeys;
|
|
140
140
|
clientKeyAgreementKey: IKeyAgreementKey;
|
|
141
|
-
|
|
141
|
+
userKeyRosterStore: EncryptionDescriptorStore;
|
|
142
142
|
idStore: WebvhIdStore;
|
|
143
143
|
}): Promise<{
|
|
144
144
|
did: string;
|
|
@@ -149,12 +149,12 @@ export declare function approveEnrollment({ request, clientWebvhKeys, clientKeyA
|
|
|
149
149
|
* ENROLLEE, step two (after the other client approves): verifies the
|
|
150
150
|
* enrollment from the world-readable log and performs this client's first
|
|
151
151
|
* roster read -- signed with its just-published `<did:webvh>#<multibase>`
|
|
152
|
-
* key -- to obtain the
|
|
152
|
+
* key -- to obtain the user key.
|
|
153
153
|
*
|
|
154
154
|
* The portable core of the completion step: the caller supplies the account
|
|
155
155
|
* pointer (from its own keyring lookup) and persists what comes back -- the
|
|
156
|
-
*
|
|
157
|
-
* layer. After that, an ordinary unlock finds an enrolled client.
|
|
156
|
+
* user key, the roster epoch to pin, and the key set itself -- under its own
|
|
157
|
+
* unlock layer. After that, an ordinary unlock finds an enrolled client.
|
|
158
158
|
*
|
|
159
159
|
* Throws `EnrollmentPendingError` while the add entry is not published yet
|
|
160
160
|
* (complete again once the other client finishes); any integrity failure
|
|
@@ -167,14 +167,14 @@ export declare function approveEnrollment({ request, clientWebvhKeys, clientKeyA
|
|
|
167
167
|
* `mintEnrollmentRequest`
|
|
168
168
|
* @param options.pointer {AccountPointer} the account pointer the enrollee's
|
|
169
169
|
* keyring lookup recovered
|
|
170
|
-
* @returns {Promise<{
|
|
170
|
+
* @returns {Promise<{ userKey: UserKey, latestEpochId: string }>}
|
|
171
171
|
*/
|
|
172
172
|
export declare function completeEnrollmentCore({ clientSeed, webvhUpdateKeys, pointer }: {
|
|
173
173
|
clientSeed: Uint8Array;
|
|
174
174
|
webvhUpdateKeys: ClientWebvhUpdateKeys;
|
|
175
175
|
pointer: AccountPointer;
|
|
176
176
|
}): Promise<{
|
|
177
|
-
|
|
177
|
+
userKey: UserKey;
|
|
178
178
|
latestEpochId: string;
|
|
179
179
|
}>;
|
|
180
180
|
//# sourceMappingURL=enrollment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enrollment.d.ts","sourceRoot":"","sources":["../../src/enrollment/enrollment.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAYxE,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,YAAY,EACb,MAAM,sBAAsB,CAAA;AAU7B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"enrollment.d.ts","sourceRoot":"","sources":["../../src/enrollment/enrollment.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GA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AC,EACtC,OAAO,EACP,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,OAAO,EACR,EAAE;IACD,OAAO,EAAE,iBAAiB,CAAA;IAC1B,eAAe,EAAE,qBAAqB,CAAA;IACtC,qBAAqB,EAAE,gBAAgB,CAAA;IACvC,kBAAkB,EAAE,yBAAyB,CAAA;IAC7C,OAAO,EAAE,YAAY,CAAA;CACtB,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,CAAC,CAsB3E;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,sBAAsB,CAAC,EAC3C,UAAU,EACV,eAAe,EACf,OAAO,EACR,EAAE;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,eAAe,EAAE,qBAAqB,CAAA;IACtC,OAAO,EAAE,cAAc,CAAA;CACxB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC,CAmEvD"}
|
|
@@ -4,9 +4,9 @@ import { agentsFromSeed } from '../identity/agents.js';
|
|
|
4
4
|
import { enrollWebvhClient, mintClientWebvhUpdateKeys, updateKeyMultibase } from '../webvh/didWebvh.js';
|
|
5
5
|
import { clientSigningKeyMultibase, isWebvhDid, webvhZcapClient } from '../webvh/zcap.js';
|
|
6
6
|
import { AccountLogMissingError, verifyAccountLog } from '../webvh/verifyLog.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { addUserKeyRosterRecipient } from '../keys/userKeyRoster.js';
|
|
8
|
+
import { readUserKeyRoster, rosterRecipientKid } from '../keys/userKeyRoster.js';
|
|
9
|
+
import { userKeyRosterDescriptorStore } from '../keys/rosterStore.js';
|
|
10
10
|
import { CONNECT_CODE_PREFIX } from './connectCode.js';
|
|
11
11
|
/**
|
|
12
12
|
* The connect-code payload version this build mints and accepts.
|
|
@@ -207,8 +207,8 @@ export async function mintEnrollmentRequest() {
|
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
209
|
/**
|
|
210
|
-
* ENROLLING CLIENT: the whole approval, in the push order -- the
|
|
211
|
-
* into the roster first (escrow: every epoch, so the new client reads
|
|
210
|
+
* ENROLLING CLIENT: the whole approval, in the push order -- the user key
|
|
211
|
+
* wrapped into the roster first (escrow: every epoch, so the new client reads
|
|
212
212
|
* pre-enrollment history), then the two log entries. Quorum-of-one: this
|
|
213
213
|
* client's own update key signs both entries. Idempotent at every stage, so
|
|
214
214
|
* re-approving the same code after any tear converges.
|
|
@@ -220,19 +220,19 @@ export async function mintEnrollmentRequest() {
|
|
|
220
220
|
* @param options.clientKeyAgreementKey {IKeyAgreementKey} the approving
|
|
221
221
|
* client's own (identity) key-agreement key, unwrapping each epoch for
|
|
222
222
|
* re-wrapping
|
|
223
|
-
* @param options.
|
|
224
|
-
* `key-map/
|
|
223
|
+
* @param options.userKeyRosterStore {EncryptionDescriptorStore} the account's
|
|
224
|
+
* `key-map/user-key.json` descriptor store
|
|
225
225
|
* @param options.idStore {WebvhIdStore} the account's `id` collection
|
|
226
226
|
* @returns {Promise<object>} the account's did:webvh, plus the enrollee's
|
|
227
227
|
* own identity as this call already knows it: its did:key and its signing-key
|
|
228
228
|
* multibase (the key a label or a listing row is filed under), so the caller
|
|
229
229
|
* needs no second parse of the connect code
|
|
230
230
|
*/
|
|
231
|
-
export async function approveEnrollment({ request, clientWebvhKeys, clientKeyAgreementKey,
|
|
231
|
+
export async function approveEnrollment({ request, clientWebvhKeys, clientKeyAgreementKey, userKeyRosterStore, idStore }) {
|
|
232
232
|
// Decryption material before authorization: the wrap lands first, so no
|
|
233
233
|
// enrolled client is ever authorized but blind.
|
|
234
|
-
await
|
|
235
|
-
store:
|
|
234
|
+
await addUserKeyRosterRecipient({
|
|
235
|
+
store: userKeyRosterStore,
|
|
236
236
|
recipient: {
|
|
237
237
|
id: enrollmentRecipientKid({ request }),
|
|
238
238
|
publicKeyMultibase: request.keyAgreementKeyMultibase
|
|
@@ -254,12 +254,12 @@ export async function approveEnrollment({ request, clientWebvhKeys, clientKeyAgr
|
|
|
254
254
|
* ENROLLEE, step two (after the other client approves): verifies the
|
|
255
255
|
* enrollment from the world-readable log and performs this client's first
|
|
256
256
|
* roster read -- signed with its just-published `<did:webvh>#<multibase>`
|
|
257
|
-
* key -- to obtain the
|
|
257
|
+
* key -- to obtain the user key.
|
|
258
258
|
*
|
|
259
259
|
* The portable core of the completion step: the caller supplies the account
|
|
260
260
|
* pointer (from its own keyring lookup) and persists what comes back -- the
|
|
261
|
-
*
|
|
262
|
-
* layer. After that, an ordinary unlock finds an enrolled client.
|
|
261
|
+
* user key, the roster epoch to pin, and the key set itself -- under its own
|
|
262
|
+
* unlock layer. After that, an ordinary unlock finds an enrolled client.
|
|
263
263
|
*
|
|
264
264
|
* Throws `EnrollmentPendingError` while the add entry is not published yet
|
|
265
265
|
* (complete again once the other client finishes); any integrity failure
|
|
@@ -272,7 +272,7 @@ export async function approveEnrollment({ request, clientWebvhKeys, clientKeyAgr
|
|
|
272
272
|
* `mintEnrollmentRequest`
|
|
273
273
|
* @param options.pointer {AccountPointer} the account pointer the enrollee's
|
|
274
274
|
* keyring lookup recovered
|
|
275
|
-
* @returns {Promise<{
|
|
275
|
+
* @returns {Promise<{ userKey: UserKey, latestEpochId: string }>}
|
|
276
276
|
*/
|
|
277
277
|
export async function completeEnrollmentCore({ clientSeed, webvhUpdateKeys, pointer }) {
|
|
278
278
|
const did = pointer.did;
|
|
@@ -310,27 +310,27 @@ export async function completeEnrollmentCore({ clientSeed, webvhUpdateKeys, poin
|
|
|
310
310
|
throw new EnrollmentPendingError();
|
|
311
311
|
}
|
|
312
312
|
// The first roster read: signed with the `<did:webvh>#<multibase>` keyId
|
|
313
|
-
// the add entry just published, unwrapping the
|
|
313
|
+
// the add entry just published, unwrapping the user key the enrolling client
|
|
314
314
|
// escrowed to this client's key-agreement key. The verified document just
|
|
315
315
|
// resolved above is what the roster's epoch-configuration signature is
|
|
316
316
|
// checked against -- a first read adopts whatever epoch the roster serves,
|
|
317
317
|
// so it must trace to a key the document backs, not to the served
|
|
318
318
|
// descriptor's own MAC.
|
|
319
319
|
const zcapClient = webvhZcapClient({ keyAgent, did });
|
|
320
|
-
const store =
|
|
320
|
+
const store = userKeyRosterDescriptorStore({
|
|
321
321
|
storageServerUrl: pointer.host,
|
|
322
322
|
zcapClient,
|
|
323
323
|
spaceId: pointer.spaceId
|
|
324
324
|
});
|
|
325
|
-
const read = await
|
|
325
|
+
const read = await readUserKeyRoster({
|
|
326
326
|
store,
|
|
327
327
|
clientKeyAgreementKey: keyAgreementKey,
|
|
328
328
|
document: verified.doc
|
|
329
329
|
});
|
|
330
330
|
if (!read) {
|
|
331
|
-
throw new Error('The account has no
|
|
331
|
+
throw new Error('The account has no user key roster; it must finish provisioning before ' +
|
|
332
332
|
'a client can be enrolled.');
|
|
333
333
|
}
|
|
334
|
-
return {
|
|
334
|
+
return { userKey: read.userKey, latestEpochId: read.latestEpochId };
|
|
335
335
|
}
|
|
336
336
|
//# sourceMappingURL=enrollment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enrollment.js","sourceRoot":"","sources":["../../src/enrollment/enrollment.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EACL,eAAe,EACf,4BAA4B,EAC7B,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,sBAAsB,CAAA;AAM7B,OAAO,EACL,yBAAyB,EACzB,UAAU,EACV,eAAe,EAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACh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AO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC;QACnC,KAAK;QACL,qBAAqB,EAAE,eAAe;QACtC,QAAQ,EAAE,QAAQ,CAAC,GAAG;KACvB,CAAC,CAAA;IACF,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACb,yEAAyE;YACvE,2BAA2B,CAC9B,CAAA;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAA;AACrE,CAAC"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* - `approveEnrollment` -- the enrolling client's half, in the push order
|
|
15
15
|
* (roster wrap, then the two did:webvh log entries).
|
|
16
16
|
* - `completeEnrollmentCore` -- the enrollee's half: verify from the published
|
|
17
|
-
* log, read the roster, hand back the
|
|
17
|
+
* log, read the roster, hand back the user key and the epoch to pin. Persisting
|
|
18
18
|
* the key set stays with the caller's own unlock layer.
|
|
19
19
|
*/
|
|
20
20
|
export { approveEnrollment, completeEnrollmentCore, encodeEnrollmentRequest, EnrollmentPendingError, enrollmentClientDid, enrollmentRecipientKid, mintEnrollmentRequest, parseEnrollmentRequest } from './enrollment.js';
|
package/dist/enrollment/index.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* - `approveEnrollment` -- the enrolling client's half, in the push order
|
|
15
15
|
* (roster wrap, then the two did:webvh log entries).
|
|
16
16
|
* - `completeEnrollmentCore` -- the enrollee's half: verify from the published
|
|
17
|
-
* log, read the roster, hand back the
|
|
17
|
+
* log, read the roster, hand back the user key and the epoch to pin. Persisting
|
|
18
18
|
* the key set stays with the caller's own unlock layer.
|
|
19
19
|
*/
|
|
20
20
|
export { approveEnrollment, completeEnrollmentCore, encodeEnrollmentRequest, EnrollmentPendingError, enrollmentClientDid, enrollmentRecipientKid, mintEnrollmentRequest, parseEnrollmentRequest } from './enrollment.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
* - `@interop/wallet-core/webvh` -- the account's did:webvh identity: the
|
|
20
20
|
* hosted DID log, its per-client update-key rotation, the client enrollment
|
|
21
21
|
* entries, and ZCap signing under the did:webvh verification-method id.
|
|
22
|
-
* - `@interop/wallet-core/keys` -- the
|
|
23
|
-
* `key-map/
|
|
22
|
+
* - `@interop/wallet-core/keys` -- the user key and its
|
|
23
|
+
* `key-map/user-key.json` wrap-set roster.
|
|
24
24
|
* - `@interop/wallet-core/descriptors` -- collection encryption-descriptor
|
|
25
25
|
* acquisition (fetch / cache / offline fallback) and the unknown-epoch
|
|
26
26
|
* refresh policy, including a self-refreshing EDV document cipher.
|
package/dist/index.js
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
* - `@interop/wallet-core/webvh` -- the account's did:webvh identity: the
|
|
20
20
|
* hosted DID log, its per-client update-key rotation, the client enrollment
|
|
21
21
|
* entries, and ZCap signing under the did:webvh verification-method id.
|
|
22
|
-
* - `@interop/wallet-core/keys` -- the
|
|
23
|
-
* `key-map/
|
|
22
|
+
* - `@interop/wallet-core/keys` -- the user key and its
|
|
23
|
+
* `key-map/user-key.json` wrap-set roster.
|
|
24
24
|
* - `@interop/wallet-core/descriptors` -- collection encryption-descriptor
|
|
25
25
|
* acquisition (fetch / cache / offline fallback) and the unknown-epoch
|
|
26
26
|
* refresh policy, including a self-refreshing EDV document cipher.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { ClientWebvhUpdateKeys } from '../webvh/didWebvh.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { UserKey } from './userKey.js';
|
|
3
3
|
/**
|
|
4
4
|
* A client-key record's contents, decoded.
|
|
5
5
|
*
|
|
6
6
|
* `clientSeed` is the only always-present member: the rest are absent on
|
|
7
|
-
* records written before that member existed (a
|
|
7
|
+
* records written before that member existed (a user-key-less account, a record
|
|
8
8
|
* written before the update keys became client-held, a first client whose own
|
|
9
9
|
* did:key IS the account controller), or simply not stored by the app.
|
|
10
10
|
*/
|
|
11
11
|
export interface ClientKeyRecord {
|
|
12
12
|
clientSeed: Uint8Array;
|
|
13
|
-
|
|
13
|
+
userKey?: UserKey;
|
|
14
14
|
webvhUpdateKeys?: ClientWebvhUpdateKeys;
|
|
15
15
|
controller?: string;
|
|
16
16
|
pointerDid?: string;
|
|
@@ -22,7 +22,7 @@ export interface ClientKeyRecord {
|
|
|
22
22
|
*/
|
|
23
23
|
export interface ClientKeyRecordJson {
|
|
24
24
|
clientSeed: string;
|
|
25
|
-
|
|
25
|
+
userKey?: {
|
|
26
26
|
id: string;
|
|
27
27
|
secret: string;
|
|
28
28
|
signingSeed?: string;
|
|
@@ -38,28 +38,28 @@ export interface ClientKeyRecordJson {
|
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* A record whose every member is present: what an ENROLLED client holds once
|
|
41
|
-
* the enrollment ceremony has landed (a key set, a delivered
|
|
41
|
+
* the enrollment ceremony has landed (a key set, a delivered user key, its own
|
|
42
42
|
* update-key seeds, and the account it belongs to).
|
|
43
43
|
*/
|
|
44
44
|
export interface EnrolledClientKeyRecord extends ClientKeyRecord {
|
|
45
|
-
|
|
45
|
+
userKey: UserKey;
|
|
46
46
|
webvhUpdateKeys: ClientWebvhUpdateKeys;
|
|
47
47
|
controller: string;
|
|
48
48
|
pointerDid: string;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
* Parses and validates the optional `
|
|
52
|
-
* `undefined` (a record written for an account minted before the
|
|
53
|
-
* present-but-malformed one throws.
|
|
51
|
+
* Parses and validates the optional `userKey` member. An absent member resolves
|
|
52
|
+
* to `undefined` (a record written for an account minted before the user key);
|
|
53
|
+
* a present-but-malformed one throws.
|
|
54
54
|
*
|
|
55
|
-
* The signing seed is absent on a
|
|
55
|
+
* The signing seed is absent on a user key adopted from a roster rotation (the
|
|
56
56
|
* roster wraps the key-agreement secret alone); when present it must be
|
|
57
57
|
* well-formed.
|
|
58
58
|
*
|
|
59
|
-
* @param value {unknown} the record's `
|
|
60
|
-
* @returns {
|
|
59
|
+
* @param value {unknown} the record's `userKey` member
|
|
60
|
+
* @returns {UserKey | undefined}
|
|
61
61
|
*/
|
|
62
|
-
export declare function
|
|
62
|
+
export declare function parseClientRecordUserKey(value: unknown): UserKey | undefined;
|
|
63
63
|
/**
|
|
64
64
|
* Parses and validates the optional `webvh` member: this client's did:webvh
|
|
65
65
|
* update-key seeds. An absent member resolves to `undefined` (a record written
|
|
@@ -78,7 +78,7 @@ export declare function parseClientRecordWebvhKeys(value: unknown): ClientWebvhU
|
|
|
78
78
|
*
|
|
79
79
|
* @param options {object}
|
|
80
80
|
* @param options.clientSeed {Uint8Array} this client's 32-byte seed
|
|
81
|
-
* @param [options.
|
|
81
|
+
* @param [options.userKey] {UserKey} the cached user key
|
|
82
82
|
* @param [options.webvhUpdateKeys] {ClientWebvhUpdateKeys} this client's
|
|
83
83
|
* did:webvh update-key seeds
|
|
84
84
|
* @param [options.controller] {string} the account controller this key set
|
|
@@ -89,9 +89,9 @@ export declare function parseClientRecordWebvhKeys(value: unknown): ClientWebvhU
|
|
|
89
89
|
* to now
|
|
90
90
|
* @returns {ClientKeyRecordJson}
|
|
91
91
|
*/
|
|
92
|
-
export declare function encodeClientKeyRecord({ clientSeed,
|
|
92
|
+
export declare function encodeClientKeyRecord({ clientSeed, userKey, webvhUpdateKeys, controller, pointerDid, createdAt }: {
|
|
93
93
|
clientSeed: Uint8Array;
|
|
94
|
-
|
|
94
|
+
userKey?: UserKey;
|
|
95
95
|
webvhUpdateKeys?: ClientWebvhUpdateKeys;
|
|
96
96
|
controller?: string;
|
|
97
97
|
pointerDid?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientKeyRecord.d.ts","sourceRoot":"","sources":["../../src/keys/clientKeyRecord.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clientKeyRec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