@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.
Files changed (77) hide show
  1. package/README.md +13 -13
  2. package/dist/clients/index.d.ts +4 -3
  3. package/dist/clients/index.d.ts.map +1 -1
  4. package/dist/clients/index.js +3 -2
  5. package/dist/clients/index.js.map +1 -1
  6. package/dist/clients/policy.d.ts +3 -3
  7. package/dist/clients/policy.d.ts.map +1 -1
  8. package/dist/clients/policy.js +1 -1
  9. package/dist/clients/revocation.d.ts +15 -15
  10. package/dist/clients/revocation.d.ts.map +1 -1
  11. package/dist/clients/revocation.js +19 -19
  12. package/dist/clients/revocation.js.map +1 -1
  13. package/dist/clients/rosterPolicy.d.ts +26 -25
  14. package/dist/clients/rosterPolicy.d.ts.map +1 -1
  15. package/dist/clients/rosterPolicy.js +29 -29
  16. package/dist/clients/rosterPolicy.js.map +1 -1
  17. package/dist/enrollment/enrollment.d.ts +16 -16
  18. package/dist/enrollment/enrollment.d.ts.map +1 -1
  19. package/dist/enrollment/enrollment.js +19 -19
  20. package/dist/enrollment/enrollment.js.map +1 -1
  21. package/dist/enrollment/index.d.ts +1 -1
  22. package/dist/enrollment/index.js +1 -1
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.js +2 -2
  25. package/dist/keys/clientKeyRecord.d.ts +16 -16
  26. package/dist/keys/clientKeyRecord.d.ts.map +1 -1
  27. package/dist/keys/clientKeyRecord.js +39 -35
  28. package/dist/keys/clientKeyRecord.js.map +1 -1
  29. package/dist/keys/index.d.ts +19 -17
  30. package/dist/keys/index.d.ts.map +1 -1
  31. package/dist/keys/index.js +16 -14
  32. package/dist/keys/index.js.map +1 -1
  33. package/dist/keys/rosterStore.d.ts +3 -3
  34. package/dist/keys/rosterStore.d.ts.map +1 -1
  35. package/dist/keys/rosterStore.js +13 -13
  36. package/dist/keys/rosterStore.js.map +1 -1
  37. package/dist/keys/userKey.d.ts +43 -0
  38. package/dist/keys/userKey.d.ts.map +1 -0
  39. package/dist/keys/{puk.js → userKey.js} +23 -21
  40. package/dist/keys/userKey.js.map +1 -0
  41. package/dist/keys/{pukCascade.d.ts → userKeyCascade.d.ts} +69 -69
  42. package/dist/keys/userKeyCascade.d.ts.map +1 -0
  43. package/dist/keys/{pukCascade.js → userKeyCascade.js} +67 -64
  44. package/dist/keys/userKeyCascade.js.map +1 -0
  45. package/dist/keys/{pukRoster.d.ts → userKeyRoster.d.ts} +73 -74
  46. package/dist/keys/userKeyRoster.d.ts.map +1 -0
  47. package/dist/keys/{pukRoster.js → userKeyRoster.js} +86 -83
  48. package/dist/keys/userKeyRoster.js.map +1 -0
  49. package/dist/recovery/index.d.ts +1 -1
  50. package/dist/recovery/index.js +1 -1
  51. package/dist/recovery/recoveryCode.d.ts +1 -1
  52. package/dist/recovery/recoveryCode.js +6 -6
  53. package/dist/recovery/recoveryRecord.d.ts +1 -1
  54. package/dist/recovery/recoveryWebvh.d.ts +1 -1
  55. package/dist/recovery/recoveryWebvh.js +1 -1
  56. package/dist/space/activity.d.ts +17 -1
  57. package/dist/space/activity.d.ts.map +1 -1
  58. package/dist/space/activity.js +22 -1
  59. package/dist/space/activity.js.map +1 -1
  60. package/dist/space/collections.d.ts +17 -17
  61. package/dist/space/collections.d.ts.map +1 -1
  62. package/dist/space/collections.js +16 -16
  63. package/dist/space/collections.js.map +1 -1
  64. package/dist/space/index.d.ts +3 -3
  65. package/dist/space/index.d.ts.map +1 -1
  66. package/dist/space/index.js +3 -3
  67. package/dist/space/index.js.map +1 -1
  68. package/dist/webvh/didWebvh.d.ts +1 -1
  69. package/dist/webvh/didWebvh.js +6 -6
  70. package/package.json +1 -1
  71. package/dist/keys/puk.d.ts +0 -42
  72. package/dist/keys/puk.d.ts.map +0 -1
  73. package/dist/keys/puk.js.map +0 -1
  74. package/dist/keys/pukCascade.d.ts.map +0 -1
  75. package/dist/keys/pukCascade.js.map +0 -1
  76. package/dist/keys/pukRoster.d.ts.map +0 -1
  77. package/dist/keys/pukRoster.js.map +0 -1
@@ -8,10 +8,10 @@ import { clientSigningKeyMultibase } from '../webvh/zcap.js';
8
8
  * names no epoch in its own list. The server (or whoever can write to it) has
9
9
  * produced a configuration no enrolled client authenticated.
10
10
  */
11
- export class PukRosterIntegrityError extends Error {
11
+ export class UserKeyRosterIntegrityError extends Error {
12
12
  constructor(message) {
13
13
  super(message);
14
- this.name = 'PukRosterIntegrityError';
14
+ this.name = 'UserKeyRosterIntegrityError';
15
15
  }
16
16
  }
17
17
  /**
@@ -21,25 +21,25 @@ export class PukRosterIntegrityError extends Error {
21
21
  * an older consistent configuration, which a valid `epochsMac` alone cannot
22
22
  * catch; refused rather than followed.
23
23
  */
24
- export class PukRosterContinuityError extends Error {
24
+ export class UserKeyRosterContinuityError extends Error {
25
25
  pinnedEpochId;
26
26
  constructor({ pinnedEpochId }) {
27
- super('The PUK roster no longer carries the epoch this client has pinned -- ' +
27
+ super('The user key roster no longer carries the epoch this client has pinned -- ' +
28
28
  'a rolled-back or replayed roster.');
29
- this.name = 'PukRosterContinuityError';
29
+ this.name = 'UserKeyRosterContinuityError';
30
30
  this.pinnedEpochId = pinnedEpochId;
31
31
  }
32
32
  }
33
33
  /**
34
34
  * Thrown when this client holds no usable wrap in the roster's current epoch
35
35
  * (no recipient entry for its key-agreement key, or the entry fails to
36
- * unwrap). The client cannot obtain the current PUK -- it may have been
36
+ * unwrap). The client cannot obtain the current user key -- it may have been
37
37
  * rotated off the roster.
38
38
  */
39
- export class PukRosterUnwrapError extends Error {
39
+ export class UserKeyRosterUnwrapError extends Error {
40
40
  constructor(message) {
41
41
  super(message);
42
- this.name = 'PukRosterUnwrapError';
42
+ this.name = 'UserKeyRosterUnwrapError';
43
43
  }
44
44
  }
45
45
  /**
@@ -63,7 +63,7 @@ const EPOCHS_SIG_ALG = 'EdDSA';
63
63
  * agent (the `keyAgent` of `agentsFromSeed`)
64
64
  * @returns {EpochsSigner} the `signEpochs` hook for roster writes
65
65
  */
66
- export function pukRosterEpochsSigner({ keyAgent }) {
66
+ export function userKeyRosterEpochsSigner({ keyAgent }) {
67
67
  const kid = clientSigningKeyMultibase({ keyAgent });
68
68
  const signer = keyAgent.getSigner();
69
69
  return async function signEpochs({ payload }) {
@@ -82,7 +82,7 @@ export function pukRosterEpochsSigner({ keyAgent }) {
82
82
  * signature must be present and supported, its `kid` must be the public
83
83
  * multibase of one of the document's verification methods (an enrolled
84
84
  * client's signing key), and it must verify over the canonical
85
- * epoch-configuration payload. Throws {@link PukRosterIntegrityError}
85
+ * epoch-configuration payload. Throws {@link UserKeyRosterIntegrityError}
86
86
  * otherwise: a configuration no enrolled client signed.
87
87
  *
88
88
  * @param options {object}
@@ -91,16 +91,16 @@ export function pukRosterEpochsSigner({ keyAgent }) {
91
91
  * did:webvh document (never a server-supplied roster field)
92
92
  * @returns {Promise<void>}
93
93
  */
94
- export async function verifyPukRosterEpochsSig({ descriptor, document }) {
94
+ export async function verifyUserKeyRosterEpochsSig({ descriptor, document }) {
95
95
  const epochsSig = descriptor.epochsSig;
96
96
  if (!epochsSig ||
97
97
  epochsSig.v !== EPOCHS_SIG_V ||
98
98
  epochsSig.alg !== EPOCHS_SIG_ALG) {
99
- throw new PukRosterIntegrityError('The PUK roster carries no supported epoch-configuration signature.');
99
+ throw new UserKeyRosterIntegrityError('The user key roster carries no supported epoch-configuration signature.');
100
100
  }
101
101
  const backed = (document.verificationMethod ?? []).some(method => method.publicKeyMultibase === epochsSig.kid);
102
102
  if (!backed) {
103
- throw new PukRosterIntegrityError('The PUK roster epoch configuration is signed by a key the account ' +
103
+ throw new UserKeyRosterIntegrityError('The user key roster epoch configuration is signed by a key the account ' +
104
104
  'document does not back.');
105
105
  }
106
106
  let signature;
@@ -108,7 +108,7 @@ export async function verifyPukRosterEpochsSig({ descriptor, document }) {
108
108
  signature = base64urlnopad.decode(epochsSig.sig);
109
109
  }
110
110
  catch {
111
- throw new PukRosterIntegrityError('The PUK roster epoch-configuration signature is malformed.');
111
+ throw new UserKeyRosterIntegrityError('The user key roster epoch-configuration signature is malformed.');
112
112
  }
113
113
  const verifier = new Ed25519VerificationKey({
114
114
  controller: `did:key:${epochsSig.kid}`,
@@ -119,7 +119,7 @@ export async function verifyPukRosterEpochsSig({ descriptor, document }) {
119
119
  signature
120
120
  });
121
121
  if (!verified) {
122
- throw new PukRosterIntegrityError('The PUK roster epoch-configuration signature failed verification.');
122
+ throw new UserKeyRosterIntegrityError('The user key roster epoch-configuration signature failed verification.');
123
123
  }
124
124
  }
125
125
  /**
@@ -167,7 +167,7 @@ function multibaseFragmentOf(id) {
167
167
  * did:webvh document (never a server-supplied roster field)
168
168
  * @returns {function} a `resolveRecipientKey` for `removeRecipient`
169
169
  */
170
- export function pukRosterRecipientResolver({ document }) {
170
+ export function userKeyRosterRecipientResolver({ document }) {
171
171
  // Materialize the document's keyAgreement VMs once: embedded VMs verbatim,
172
172
  // string references resolved against `verificationMethod`.
173
173
  const byId = new Map();
@@ -199,25 +199,25 @@ export function pukRosterRecipientResolver({ document }) {
199
199
  };
200
200
  }
201
201
  /**
202
- * Ensures the roster exists, create-if-absent: an absent roster is
203
- * initialized with the account's existing PUK installed as the first epoch,
204
- * wrapped to this client's key-agreement key; an existing roster is returned
205
- * as-is (authentication is the read path's job, and provisioning must never
206
- * clobber an established roster). Idempotent -- losing the guarded-create
207
- * race to a concurrent first init converges on the winner's roster.
202
+ * Ensures the roster exists, create-if-absent: an absent roster is initialized
203
+ * with the account's existing user key installed as the first epoch, wrapped to
204
+ * this client's key-agreement key; an existing roster is returned as-is
205
+ * (authentication is the read path's job, and provisioning must never clobber
206
+ * an established roster). Idempotent -- losing the guarded-create race to a
207
+ * concurrent first init converges on the winner's roster.
208
208
  *
209
209
  * @param options {object}
210
210
  * @param options.store {EncryptionDescriptorStore} the roster's descriptor
211
211
  * store
212
- * @param options.puk {Puk} the account's per-user key
212
+ * @param options.userKey {UserKey} the account's user key
213
213
  * @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
214
214
  * (identity) key-agreement key -- the roster recipient
215
215
  * @param options.signEpochs {EpochsSigner} this client's epoch-configuration
216
- * signer ({@link pukRosterEpochsSigner}), so the first configuration is
216
+ * signer ({@link userKeyRosterEpochsSigner}), so the first configuration is
217
217
  * vouched for by an enrollable key rather than only its own MAC
218
218
  * @returns {Promise<CollectionEncryption>} the roster descriptor
219
219
  */
220
- export async function ensurePukRoster({ store, puk, clientKeyAgreementKey, signEpochs }) {
220
+ export async function ensureUserKeyRoster({ store, userKey, clientKeyAgreementKey, signEpochs }) {
221
221
  const current = await store.read();
222
222
  if (current !== null) {
223
223
  return current.descriptor;
@@ -225,12 +225,12 @@ export async function ensurePukRoster({ store, puk, clientKeyAgreementKey, signE
225
225
  return initRecipients({
226
226
  store,
227
227
  recipients: [ownerRecipient({ keyAgreementKey: clientKeyAgreementKey })],
228
- epoch: { epochId: puk.id, secret: puk.secret },
228
+ epoch: { epochId: userKey.id, secret: userKey.secret },
229
229
  signEpochs
230
230
  });
231
231
  }
232
232
  /**
233
- * Wraps the PUK to a client being enrolled -- the roster half of the
233
+ * Wraps the user key to a client being enrolled -- the roster half of the
234
234
  * enrollment ceremony, and deliberately its FIRST write (decryption material
235
235
  * before authorization, the push order): the wrap lands before the did:webvh
236
236
  * log entries, so no enrolled client is ever authorized but blind, and a tear
@@ -255,10 +255,10 @@ export async function ensurePukRoster({ store, puk, clientKeyAgreementKey, signE
255
255
  * re-wrapping
256
256
  * @returns {Promise<CollectionEncryption>} the refreshed roster descriptor
257
257
  */
258
- export async function addPukRosterRecipient({ store, recipient, ownerKeyAgreementKey }) {
258
+ export async function addUserKeyRosterRecipient({ store, recipient, ownerKeyAgreementKey }) {
259
259
  const current = await store.read();
260
260
  if (current === null) {
261
- throw new Error('The PUK roster does not exist yet; the account must finish ' +
261
+ throw new Error('The user key roster does not exist yet; the account must finish ' +
262
262
  'provisioning before a client can be enrolled.');
263
263
  }
264
264
  const descriptor = current.descriptor;
@@ -277,16 +277,16 @@ export async function addPukRosterRecipient({ store, recipient, ownerKeyAgreemen
277
277
  });
278
278
  }
279
279
  /**
280
- * Rotates the PUK roster off one recipient -- the roster half of revoking an
281
- * enrolled wallet client or a recovery code. A thin, deliberate composition
280
+ * Rotates the user key roster off one recipient -- the roster half of revoking
281
+ * an enrolled wallet client or a recovery code. A thin, deliberate composition
282
282
  * of was-client's `removeRecipient` with the two roster-specific choices
283
- * spelled once: the remaining recipients are resolved from the locally
284
- * verified did:webvh document ("the roster delivers, never sources" -- an
285
- * entry with no matching `keyAgreement` verification method is dropped and
286
- * never receives a wrap), and the pull axis is a no-op, because for a roster
287
- * recipient the pull axis IS the document edit the caller performed first --
288
- * under the current-key-set rule the removed party's server-side access died
289
- * the moment its verification method left the document.
283
+ * spelled once: the remaining recipients are resolved from the locally verified
284
+ * did:webvh document ("the roster delivers, never sources" -- an entry with no
285
+ * matching `keyAgreement` verification method is dropped and never receives a
286
+ * wrap), and the pull axis is a no-op, because for a roster recipient the pull
287
+ * axis IS the document edit the caller performed first -- under the
288
+ * current-key-set rule the removed party's server-side access died the moment
289
+ * its verification method left the document.
290
290
  *
291
291
  * @param options {object}
292
292
  * @param options.store {EncryptionDescriptorStore} the roster's descriptor
@@ -296,15 +296,15 @@ export async function addPukRosterRecipient({ store, recipient, ownerKeyAgreemen
296
296
  * @param options.retireRecipientId {string} the removed recipient's roster
297
297
  * kid
298
298
  * @param options.signEpochs {EpochsSigner} the rotating client's
299
- * epoch-configuration signer ({@link pukRosterEpochsSigner}), vouching for
299
+ * epoch-configuration signer ({@link userKeyRosterEpochsSigner}), vouching for
300
300
  * the fresh epoch so other clients' rotated reads accept it
301
301
  * @returns {Promise<CollectionEncryption>} the rotated roster descriptor
302
302
  */
303
- export async function rotatePukRoster({ store, document, retireRecipientId, signEpochs }) {
303
+ export async function rotateUserKeyRoster({ store, document, retireRecipientId, signEpochs }) {
304
304
  return removeRecipient({
305
305
  store,
306
306
  recipientId: retireRecipientId,
307
- resolveRecipientKey: pukRosterRecipientResolver({ document }),
307
+ resolveRecipientKey: userKeyRosterRecipientResolver({ document }),
308
308
  pull: async () => { },
309
309
  signEpochs
310
310
  });
@@ -313,7 +313,7 @@ export async function rotatePukRoster({ store, document, retireRecipientId, sign
313
313
  * Converges the roster onto the account document: the standing detector for a
314
314
  * revocation cascade torn between its two halves. The cascade edits the
315
315
  * document first and rotates the roster second, so a client that crashes in
316
- * between leaves a roster that keeps wrapping the CURRENT per-user key to a
316
+ * between leaves a roster that keeps wrapping the CURRENT user key to a
317
317
  * recipient the document no longer keys -- durable, silent, and permanent,
318
318
  * since the revoked client's document edit will never be re-run.
319
319
  *
@@ -321,7 +321,7 @@ export async function rotatePukRoster({ store, document, retireRecipientId, sign
321
321
  * document-backed resolver cannot answer for is exactly a recipient the
322
322
  * document no longer keys, so a healthy account reads the descriptor and
323
323
  * writes nothing. When any such recipient is found the roster is rotated away
324
- * from ALL of them at once -- a single {@link rotatePukRoster} suffices,
324
+ * from ALL of them at once -- a single {@link rotateUserKeyRoster} suffices,
325
325
  * because the resolver drops every unbacked entry from the fresh epoch, not
326
326
  * just the one named as retiring.
327
327
  *
@@ -330,8 +330,8 @@ export async function rotatePukRoster({ store, document, retireRecipientId, sign
330
330
  * account), not a cascade to finish, and completing it would lock every
331
331
  * client out of the account.
332
332
  *
333
- * The fresh per-user key itself is not returned: the caller adopts it the
334
- * ordinary way, by re-reading the roster ({@link readPukRoster}) once
333
+ * The fresh user key itself is not returned: the caller adopts it the
334
+ * ordinary way, by re-reading the roster ({@link readUserKeyRoster}) once
335
335
  * `rotated` says there is something to adopt, and then runs the collection
336
336
  * fan-out.
337
337
  *
@@ -344,13 +344,13 @@ export async function rotatePukRoster({ store, document, retireRecipientId, sign
344
344
  * has just read (a login-time roster read), to save a re-read; omitted, the
345
345
  * roster is read fresh
346
346
  * @param options.signEpochs {EpochsSigner} the converging client's
347
- * epoch-configuration signer ({@link pukRosterEpochsSigner}), for the
347
+ * epoch-configuration signer ({@link userKeyRosterEpochsSigner}), for the
348
348
  * rotation this call may perform
349
349
  * @returns {Promise<object>} whether the roster rotated on this call, the
350
350
  * stale recipient kids found, and the roster descriptor as it now stands
351
351
  * (`null` when the account has no roster yet)
352
352
  */
353
- export async function convergePukRosterToDocument({ store, document, descriptor, signEpochs }) {
353
+ export async function convergeUserKeyRosterToDocument({ store, document, descriptor, signEpochs }) {
354
354
  let roster = descriptor;
355
355
  if (!roster) {
356
356
  const read = await store.read();
@@ -362,9 +362,9 @@ export async function convergePukRosterToDocument({ store, document, descriptor,
362
362
  const currentEpochId = roster.currentEpoch;
363
363
  const currentEpoch = (roster.epochs ?? []).find(epoch => epoch.id === currentEpochId);
364
364
  if (!currentEpoch) {
365
- throw new PukRosterIntegrityError('The PUK roster names no current epoch in its own epoch list.');
365
+ throw new UserKeyRosterIntegrityError('The user key roster names no current epoch in its own epoch list.');
366
366
  }
367
- const resolveRecipientKey = pukRosterRecipientResolver({ document });
367
+ const resolveRecipientKey = userKeyRosterRecipientResolver({ document });
368
368
  const staleRecipientIds = [];
369
369
  let backed = 0;
370
370
  for (const entry of currentEpoch.recipients) {
@@ -380,12 +380,12 @@ export async function convergePukRosterToDocument({ store, document, descriptor,
380
380
  return { rotated: false, staleRecipientIds, descriptor: roster };
381
381
  }
382
382
  if (backed === 0) {
383
- throw new PukRosterIntegrityError('No PUK roster recipient is keyed by the account document; refusing ' +
383
+ throw new UserKeyRosterIntegrityError('No user key roster recipient is keyed by the account document; refusing ' +
384
384
  'to rotate the roster onto no one.');
385
385
  }
386
386
  // One rotation retires them all: the fresh epoch is wrapped only to the
387
387
  // recipients the resolver answers for.
388
- const rotated = await rotatePukRoster({
388
+ const rotated = await rotateUserKeyRoster({
389
389
  store,
390
390
  document,
391
391
  retireRecipientId: staleRecipientIds[0],
@@ -400,39 +400,39 @@ export async function convergePukRosterToDocument({ store, document, descriptor,
400
400
  *
401
401
  * 1. **Continuity**: the served epochs must contain the pinned latest-seen
402
402
  * epoch, and `currentEpoch` must not precede it in the append-only list
403
- * (`PukRosterContinuityError` -- the rollback/replay refusal).
404
- * 2. **Possession**: `currentEpoch === puk.id` confirms the cached PUK
403
+ * (`UserKeyRosterContinuityError` -- the rollback/replay refusal).
404
+ * 2. **Possession**: `currentEpoch === userKey.id` confirms the cached user key
405
405
  * current; otherwise the current epoch was rotated by another client and
406
406
  * this client's wrap is unwrapped with its own key-agreement key
407
- * (`PukRosterUnwrapError` when it holds none).
407
+ * (`UserKeyRosterUnwrapError` when it holds none).
408
408
  * 3. **Provenance** (the rotated/first-read path only): the epoch
409
409
  * configuration's `epochsSig` is verified against the locally verified
410
- * did:webvh document ({@link verifyPukRosterEpochsSig}) BEFORE the epoch
410
+ * did:webvh document ({@link verifyUserKeyRosterEpochsSig}) BEFORE the epoch
411
411
  * it delivers is adopted. On this path the `epochsMac` alone proves
412
412
  * nothing against the host -- its key is unwrapped from the served
413
413
  * descriptor itself -- so an epoch no enrolled client signed is refused
414
- * (`PukRosterIntegrityError`). The cached-current path needs no signature:
414
+ * (`UserKeyRosterIntegrityError`). The cached-current path needs no signature:
415
415
  * there the MAC is keyed by a secret this client already trusts.
416
416
  * 4. **Authentication**: the descriptor's `epochsMac` is verified under the
417
- * current epoch's secret (`PukRosterIntegrityError` on any mismatch -- a
417
+ * current epoch's secret (`UserKeyRosterIntegrityError` on any mismatch -- a
418
418
  * fabricated configuration).
419
419
  *
420
- * A rotated read returns the fresh PUK; its Ed25519 signing seed does not
420
+ * A rotated read returns the fresh user key; its Ed25519 signing seed does not
421
421
  * travel through the roster (the roster wraps the key-agreement secret
422
- * alone), so the returned PUK carries none.
422
+ * alone), so the returned user key carries none.
423
423
  *
424
- * A caller with no cached PUK at all -- a freshly enrolled client making its
425
- * first post-enrollment read -- omits `puk` and always takes the unwrap path;
426
- * the result's `rotated` is then true (the PUK was adopted from the roster).
427
- * Every unwrap-path caller must therefore supply the account document (or a
428
- * way to resolve it): `document` when it already holds a verified copy, or
429
- * `resolveDocument` to fetch-and-verify lazily, only when the read actually
424
+ * A caller with no cached user key at all -- a freshly enrolled client making
425
+ * its first post-enrollment read -- omits `userKey` and always takes the unwrap
426
+ * path; the result's `rotated` is then true (the user key was adopted from the
427
+ * roster). Every unwrap-path caller must therefore supply the account document
428
+ * (or a way to resolve it): `document` when it already holds a verified copy,
429
+ * or `resolveDocument` to fetch-and-verify lazily, only when the read actually
430
430
  * rotates.
431
431
  *
432
432
  * @param options {object}
433
433
  * @param options.store {EncryptionDescriptorStore} the roster's descriptor
434
434
  * store
435
- * @param [options.puk] {Puk} this client's cached PUK, when it holds one
435
+ * @param [options.userKey] {UserKey} this client's cached user key, when it holds one
436
436
  * @param options.clientKeyAgreementKey {IKeyAgreementKey} this client's own
437
437
  * (identity) key-agreement key, unwrapping a rotated epoch
438
438
  * @param [options.pinnedEpochId] {string} the locally pinned latest-seen
@@ -442,9 +442,9 @@ export async function convergePukRosterToDocument({ store, document, descriptor,
442
442
  * @param [options.resolveDocument] {function} resolves the locally verified
443
443
  * did:webvh document on demand; called only when the read takes the
444
444
  * rotated/first-read path
445
- * @returns {Promise<PukRosterReadResult | null>}
445
+ * @returns {Promise<UserKeyRosterReadResult | null>}
446
446
  */
447
- export async function readPukRoster({ store, puk, clientKeyAgreementKey, pinnedEpochId, document, resolveDocument }) {
447
+ export async function readUserKeyRoster({ store, userKey, clientKeyAgreementKey, pinnedEpochId, document, resolveDocument }) {
448
448
  const current = await store.read();
449
449
  if (current === null) {
450
450
  return null;
@@ -455,23 +455,23 @@ export async function readPukRoster({ store, puk, clientKeyAgreementKey, pinnedE
455
455
  ? epochIds.indexOf(descriptor.currentEpoch)
456
456
  : -1;
457
457
  if (currentIndex === -1) {
458
- throw new PukRosterIntegrityError('The PUK roster names no current epoch in its own epoch list.');
458
+ throw new UserKeyRosterIntegrityError('The user key roster names no current epoch in its own epoch list.');
459
459
  }
460
460
  if (pinnedEpochId) {
461
461
  const pinnedIndex = epochIds.indexOf(pinnedEpochId);
462
462
  if (pinnedIndex === -1 || currentIndex < pinnedIndex) {
463
- throw new PukRosterContinuityError({ pinnedEpochId });
463
+ throw new UserKeyRosterContinuityError({ pinnedEpochId });
464
464
  }
465
465
  }
466
466
  // The epochsMac construction's own version/alg are the caller's to check.
467
467
  const epochsMac = descriptor.epochsMac;
468
468
  if (!epochsMac || epochsMac.v !== 1 || epochsMac.alg !== 'HS256') {
469
- throw new PukRosterIntegrityError('The PUK roster carries no supported epoch-configuration MAC.');
469
+ throw new UserKeyRosterIntegrityError('The user key roster carries no supported epoch-configuration MAC.');
470
470
  }
471
- let currentPuk;
471
+ let currentUserKey;
472
472
  let rotated;
473
- if (puk && descriptor.currentEpoch === puk.id) {
474
- currentPuk = puk;
473
+ if (userKey && descriptor.currentEpoch === userKey.id) {
474
+ currentUserKey = userKey;
475
475
  rotated = false;
476
476
  }
477
477
  else {
@@ -483,35 +483,38 @@ export async function readPukRoster({ store, puk, clientKeyAgreementKey, pinnedE
483
483
  // itself.
484
484
  const accountDocument = document ?? (resolveDocument ? await resolveDocument() : undefined);
485
485
  if (!accountDocument) {
486
- throw new Error('A PUK roster read that adopts an epoch from the roster needs the ' +
486
+ throw new Error('A user key roster read that adopts an epoch from the roster needs the ' +
487
487
  'account document (pass `document` or `resolveDocument`) to verify ' +
488
488
  'the epoch configuration signature.');
489
489
  }
490
- await verifyPukRosterEpochsSig({ descriptor, document: accountDocument });
490
+ await verifyUserKeyRosterEpochsSig({
491
+ descriptor,
492
+ document: accountDocument
493
+ });
491
494
  // Unwrap this client's entry in the current epoch with its own
492
495
  // key-agreement key (rotation delivery).
493
496
  const entry = descriptor.epochs[currentIndex].recipients.find(recipient => recipient.header.kid === clientKeyAgreementKey.id);
494
497
  if (!entry) {
495
- throw new PukRosterUnwrapError('The PUK roster current epoch carries no wrap for this client.');
498
+ throw new UserKeyRosterUnwrapError('The user key roster current epoch carries no wrap for this client.');
496
499
  }
497
500
  const secret = await unwrapEpochSecret({
498
501
  entry,
499
502
  keyAgreementKey: clientKeyAgreementKey
500
503
  });
501
504
  if (!secret) {
502
- throw new PukRosterUnwrapError("This client's PUK roster entry failed to unwrap.");
505
+ throw new UserKeyRosterUnwrapError("This client's user key roster entry failed to unwrap.");
503
506
  }
504
- currentPuk = { id: descriptor.currentEpoch, secret };
507
+ currentUserKey = { id: descriptor.currentEpoch, secret };
505
508
  rotated = true;
506
509
  }
507
- if (!(await verifyEpochsMac({ descriptor, epochSecret: currentPuk.secret }))) {
508
- throw new PukRosterIntegrityError('The PUK roster epoch configuration failed authentication.');
510
+ if (!(await verifyEpochsMac({ descriptor, epochSecret: currentUserKey.secret }))) {
511
+ throw new UserKeyRosterIntegrityError('The user key roster epoch configuration failed authentication.');
509
512
  }
510
513
  return {
511
514
  descriptor,
512
- puk: currentPuk,
515
+ userKey: currentUserKey,
513
516
  rotated,
514
517
  latestEpochId: descriptor.currentEpoch
515
518
  };
516
519
  }
517
- //# sourceMappingURL=pukRoster.js.map
520
+ //# sourceMappingURL=userKeyRoster.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userKeyRoster.js","sourceRoot":"","sources":["../../src/keys/userKeyRoster.ts"],"names":[],"mappings":"AAwDA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,eAAe,EAIhB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EACL,yBAAyB,EAE1B,MAAM,kBAAkB,CAAA;AAGzB;;;;;GAKG;AACH,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IACpD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAA;IAC3C,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,4BAA6B,SAAQ,KAAK;IACrD,aAAa,CAAQ;IACrB,YAA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ACF,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,wBAAwB,CAChC,uDAAuD,CACxD,CAAA;QACH,CAAC;QACD,cAAc,GAAG,EAAE,EAAE,EAAE,UAAU,CAAC,YAAa,EAAE,MAAM,EAAE,CAAA;QACzD,OAAO,GAAG,IAAI,CAAA;IAChB,CAAC;IAED,IACE,CAAC,CAAC,MAAM,eAAe,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,EAC5E,CAAC;QACD,MAAM,IAAI,2BAA2B,CACnC,gEAAgE,CACjE,CAAA;IACH,CAAC;IAED,OAAO;QACL,UAAU;QACV,OAAO,EAAE,cAAc;QACvB,OAAO;QACP,aAAa,EAAE,UAAU,CAAC,YAAa;KACxC,CAAA;AACH,CAAC"}
@@ -14,7 +14,7 @@
14
14
  * single did:webvh update key whose hash stands pre-committed.
15
15
  * - `wrapRecoveryRecord` / `unwrapRecoveryRecord` -- the keyring-record
16
16
  * sibling carrying the account pointer plus the pre-minted
17
- * PUT-on-`did.jsonl` delegation (never a seed, never a PUK wrap).
17
+ * PUT-on-`did.jsonl` delegation (never a seed, never a user key wrap).
18
18
  * - `publishRecoveryKey` / `removeRecoveryKey` / `recoverWebvhClient` -- the
19
19
  * document half: issuance's split posture, revocation's removal, and the
20
20
  * self-enrolling recovery continuation.
@@ -14,7 +14,7 @@
14
14
  * single did:webvh update key whose hash stands pre-committed.
15
15
  * - `wrapRecoveryRecord` / `unwrapRecoveryRecord` -- the keyring-record
16
16
  * sibling carrying the account pointer plus the pre-minted
17
- * PUT-on-`did.jsonl` delegation (never a seed, never a PUK wrap).
17
+ * PUT-on-`did.jsonl` delegation (never a seed, never a user key wrap).
18
18
  * - `publishRecoveryKey` / `removeRecoveryKey` / `recoverWebvhClient` -- the
19
19
  * document half: issuance's split posture, revocation's removal, and the
20
20
  * self-enrolling recovery continuation.
@@ -83,7 +83,7 @@ export interface RecoveryClient {
83
83
  keyAgreementKeyMultibase: string;
84
84
  updateKeyMultibase: string;
85
85
  /**
86
- * The kid of the code's PUK-roster entry -- its key-agreement key's id
86
+ * The kid of the code's user-key-roster entry -- its key-agreement key's id
87
87
  * exactly as `agentsFromSeed` derives it (`did:key:<ed>#<x>`), so the wrap
88
88
  * minted at issuance is the one the recovery flow's roster read looks for.
89
89
  */
@@ -5,12 +5,12 @@
5
5
  * The recovery-code format layer and its deterministic derivations. A recovery
6
6
  * code is 16 random bytes rendered as base58 (Bitcoin alphabet), shown to the
7
7
  * user exactly once at issuance. Under the roster identity model the code is a
8
- * **minimal always-enrolled wallet client**: everything the code needs to
9
- * act -- the unlock identity that locates its keyring record, the client
10
- * key set behind its `keyAgreement` verification method and PUK-roster wrap,
11
- * and the did:webvh update key whose hash stands pre-committed in
12
- * `nextKeyHashes` -- derives deterministically from the code's bytes, so the
13
- * key material exists nowhere until the code is typed.
8
+ * **minimal always-enrolled wallet client**: everything the code needs to act
9
+ * -- the unlock identity that locates its keyring record, the client key set
10
+ * behind its `keyAgreement` verification method and user-key-roster wrap, and
11
+ * the did:webvh update key whose hash stands pre-committed in `nextKeyHashes`
12
+ * -- derives deterministically from the code's bytes, so the key material
13
+ * exists nowhere until the code is typed.
14
14
  *
15
15
  * The derivations are wire-level: two wallet apps must produce byte-identical
16
16
  * output for the same code, or a code issued in one could not recover in the
@@ -7,7 +7,7 @@
7
7
  * is the ordinary keyring record's (controller, email, account pointer) PLUS
8
8
  * the pre-minted PUT-on-`did.jsonl` delegation -- the narrow zcap bridge that
9
9
  * lets the code-derived client write its self-enrolling log continuation. It
10
- * carries **no key material of any kind**: never a seed, never a PUK wrap
10
+ * carries **no key material of any kind**: never a seed, never a user key wrap
11
11
  * (wraps live doc-and-roster only), so the record stays a pure pointer.
12
12
  *
13
13
  * The wrap reuses the keyring cipher context verbatim, so a recovery record
@@ -64,7 +64,7 @@ export declare function publishRecoveryKey({ idStore, updateKeys, recovery }: {
64
64
  * REVOCATION (run by an enrolled client, root authority): removes a recovery
65
65
  * code's posture from the document -- its `keyAgreement` verification method
66
66
  * and its committed update-key hash -- in one entry. Idempotent. The
67
- * roster-side half (rotating the PUK epoch off the code's wrap) is the
67
+ * roster-side half (rotating the user key epoch off the code's wrap) is the
68
68
  * caller's, and runs after this so the resolver's document no longer backs
69
69
  * the removed entry.
70
70
  *
@@ -165,7 +165,7 @@ export async function publishRecoveryKey({ idStore, updateKeys, recovery }) {
165
165
  * REVOCATION (run by an enrolled client, root authority): removes a recovery
166
166
  * code's posture from the document -- its `keyAgreement` verification method
167
167
  * and its committed update-key hash -- in one entry. Idempotent. The
168
- * roster-side half (rotating the PUK epoch off the code's wrap) is the
168
+ * roster-side half (rotating the user key epoch off the code's wrap) is the
169
169
  * caller's, and runs after this so the resolver's document no longer backs
170
170
  * the removed entry.
171
171
  *
@@ -161,6 +161,22 @@ export declare function addHistoryLogin({ user, origin, grants, appConnect, id,
161
161
  id?: string;
162
162
  created?: string;
163
163
  }): WalletActivity;
164
+ /**
165
+ * The Login activity for a local wallet unlock -- the user opened their own
166
+ * wallet, no relying party involved ({@link addHistoryLogin} covers "Login
167
+ * with Wallet" grants to an origin).
168
+ *
169
+ * @param options {object}
170
+ * @param [options.user] {Actor} omitted when the wallet has no account email
171
+ * @param [options.id] {string}
172
+ * @param [options.created] {string}
173
+ * @returns {WalletActivity}
174
+ */
175
+ export declare function addHistoryWalletLogin({ user, id, created }?: {
176
+ user?: Actor;
177
+ id?: string;
178
+ created?: string;
179
+ }): WalletActivity;
164
180
  /**
165
181
  * The Revoke activity: the user revoked a connected app's access, retiring its
166
182
  * app-key credential and its storage grants.
@@ -179,7 +195,7 @@ export declare function addHistoryLogin({ user, origin, grants, appConnect, id,
179
195
  /**
180
196
  * The ClientRevoke activity: the user disconnected an enrolled wallet client
181
197
  * -- its verification methods and update key left the did:webvh document, the
182
- * PUK rotated, and the encrypted collections re-epoch'd (the revocation
198
+ * user key rotated, and the encrypted collections re-epoch'd (the revocation
183
199
  * cascade).
184
200
  *
185
201
  * @param options {object}
@@ -1 +1 @@
1
- {"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../src/space/activity.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;CAUhB,CAAA;AAEV;;GAEG;AACH,KAAK,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAY5C;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,EAAE,EACF,OAAO,EACR,EAAE;IACD,IAAI,EAAE,KAAK,CAAA;IACX,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,GAAG,cAAc,CAUjB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,MAAM,EACN,MAAM,EACN,EAAE,EACF,OAAO,EACR,EAAE;IACD,KAAK,EAAE,OAAO,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,GAAG,cAAc,CAYjB;AAgCD;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,GAAG,EACH,IAAI,EACJ,EAAE,EACF,OAAO,EACR,EAAE;IACD,GAAG,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B"}
@@ -189,6 +189,27 @@ export function addHistoryLogin({ user, origin, grants, appConnect, id, created
189
189
  created: stamped.created
190
190
  };
191
191
  }
192
+ /**
193
+ * The Login activity for a local wallet unlock -- the user opened their own
194
+ * wallet, no relying party involved ({@link addHistoryLogin} covers "Login
195
+ * with Wallet" grants to an origin).
196
+ *
197
+ * @param options {object}
198
+ * @param [options.user] {Actor} omitted when the wallet has no account email
199
+ * @param [options.id] {string}
200
+ * @param [options.created] {string}
201
+ * @returns {WalletActivity}
202
+ */
203
+ export function addHistoryWalletLogin({ user, id, created } = {}) {
204
+ const stamped = stamp(id, created);
205
+ return {
206
+ id: stamped.id,
207
+ type: [ACTIVITY_TYPE.Login],
208
+ summary: 'Logged in to wallet.',
209
+ ...(user ? { actor: { email: user.email } } : {}),
210
+ created: stamped.created
211
+ };
212
+ }
192
213
  /**
193
214
  * The Revoke activity: the user revoked a connected app's access, retiring its
194
215
  * app-key credential and its storage grants.
@@ -207,7 +228,7 @@ export function addHistoryLogin({ user, origin, grants, appConnect, id, created
207
228
  /**
208
229
  * The ClientRevoke activity: the user disconnected an enrolled wallet client
209
230
  * -- its verification methods and update key left the did:webvh document, the
210
- * PUK rotated, and the encrypted collections re-epoch'd (the revocation
231
+ * user key rotated, and the encrypted collections re-epoch'd (the revocation
211
232
  * cascade).
212
233
  *
213
234
  * @param options {object}