@interop/wallet-core 0.86.0 → 0.88.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 (120) hide show
  1. package/dist/ceremonyEvents.d.ts +116 -0
  2. package/dist/ceremonyEvents.d.ts.map +1 -0
  3. package/dist/ceremonyEvents.js +282 -0
  4. package/dist/ceremonyEvents.js.map +1 -0
  5. package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +17 -1
  6. package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
  7. package/dist/clientAnnex/credentialAnchoredGenesis.js +45 -3
  8. package/dist/clientAnnex/credentialAnchoredGenesis.js.map +1 -1
  9. package/dist/clientAnnex/establish.d.ts +22 -0
  10. package/dist/clientAnnex/establish.d.ts.map +1 -1
  11. package/dist/clientAnnex/establish.js +67 -7
  12. package/dist/clientAnnex/establish.js.map +1 -1
  13. package/dist/clientAnnex/forget.d.ts +35 -2
  14. package/dist/clientAnnex/forget.d.ts.map +1 -1
  15. package/dist/clientAnnex/forget.js +85 -8
  16. package/dist/clientAnnex/forget.js.map +1 -1
  17. package/dist/clientAnnex/forgetLast.d.ts +26 -2
  18. package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
  19. package/dist/clientAnnex/forgetLast.js +82 -2
  20. package/dist/clientAnnex/forgetLast.js.map +1 -1
  21. package/dist/clientAnnex/index.d.ts +6 -5
  22. package/dist/clientAnnex/index.d.ts.map +1 -1
  23. package/dist/clientAnnex/index.js +3 -3
  24. package/dist/clientAnnex/index.js.map +1 -1
  25. package/dist/clientAnnex/ladderAnchored.d.ts +7 -4
  26. package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
  27. package/dist/clientAnnex/ladderAnchored.js +11 -5
  28. package/dist/clientAnnex/ladderAnchored.js.map +1 -1
  29. package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -1
  30. package/dist/clientAnnex/recoveryLadderAnchored.js +15 -4
  31. package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
  32. package/dist/clientAnnex/selfEnroll.d.ts +23 -1
  33. package/dist/clientAnnex/selfEnroll.d.ts.map +1 -1
  34. package/dist/clientAnnex/selfEnroll.js +45 -1
  35. package/dist/clientAnnex/selfEnroll.js.map +1 -1
  36. package/dist/clients/index.d.ts +2 -2
  37. package/dist/clients/index.d.ts.map +1 -1
  38. package/dist/clients/index.js +1 -1
  39. package/dist/clients/index.js.map +1 -1
  40. package/dist/clients/revocation.d.ts +20 -1
  41. package/dist/clients/revocation.d.ts.map +1 -1
  42. package/dist/clients/revocation.js +76 -1
  43. package/dist/clients/revocation.js.map +1 -1
  44. package/dist/enrollment/enrollment.d.ts +23 -2
  45. package/dist/enrollment/enrollment.d.ts.map +1 -1
  46. package/dist/enrollment/enrollment.js +75 -4
  47. package/dist/enrollment/enrollment.js.map +1 -1
  48. package/dist/enrollment/index.d.ts +2 -2
  49. package/dist/enrollment/index.d.ts.map +1 -1
  50. package/dist/enrollment/index.js +1 -1
  51. package/dist/enrollment/index.js.map +1 -1
  52. package/dist/enrollment/onboardingResponse.d.ts +26 -5
  53. package/dist/enrollment/onboardingResponse.d.ts.map +1 -1
  54. package/dist/enrollment/onboardingResponse.js +2 -14
  55. package/dist/enrollment/onboardingResponse.js.map +1 -1
  56. package/dist/errorName.d.ts +19 -0
  57. package/dist/errorName.d.ts.map +1 -0
  58. package/dist/errorName.js +27 -0
  59. package/dist/errorName.js.map +1 -0
  60. package/dist/genesis/accountGenesis.d.ts +27 -1
  61. package/dist/genesis/accountGenesis.d.ts.map +1 -1
  62. package/dist/genesis/accountGenesis.js +60 -2
  63. package/dist/genesis/accountGenesis.js.map +1 -1
  64. package/dist/genesis/index.d.ts +2 -2
  65. package/dist/genesis/index.d.ts.map +1 -1
  66. package/dist/genesis/index.js +1 -1
  67. package/dist/genesis/index.js.map +1 -1
  68. package/dist/index.d.ts +8 -0
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +7 -0
  71. package/dist/index.js.map +1 -1
  72. package/dist/labelText.d.ts +24 -0
  73. package/dist/labelText.d.ts.map +1 -0
  74. package/dist/labelText.js +26 -0
  75. package/dist/labelText.js.map +1 -0
  76. package/dist/log.d.ts +6 -4
  77. package/dist/log.d.ts.map +1 -1
  78. package/dist/log.js +8 -5
  79. package/dist/log.js.map +1 -1
  80. package/dist/menders/ids.d.ts +4 -1
  81. package/dist/menders/ids.d.ts.map +1 -1
  82. package/dist/menders/ids.js +4 -1
  83. package/dist/menders/ids.js.map +1 -1
  84. package/dist/menders/index.d.ts +2 -1
  85. package/dist/menders/index.d.ts.map +1 -1
  86. package/dist/menders/index.js +2 -1
  87. package/dist/menders/index.js.map +1 -1
  88. package/dist/menders/runner.d.ts +41 -34
  89. package/dist/menders/runner.d.ts.map +1 -1
  90. package/dist/menders/runner.js +56 -24
  91. package/dist/menders/runner.js.map +1 -1
  92. package/dist/menders/vocabulary.d.ts +3 -1
  93. package/dist/menders/vocabulary.d.ts.map +1 -1
  94. package/dist/menders/vocabulary.js +3 -1
  95. package/dist/menders/vocabulary.js.map +1 -1
  96. package/dist/recovery/continuation.d.ts +40 -1
  97. package/dist/recovery/continuation.d.ts.map +1 -1
  98. package/dist/recovery/continuation.js +48 -1
  99. package/dist/recovery/continuation.js.map +1 -1
  100. package/dist/recovery/index.d.ts +2 -2
  101. package/dist/recovery/index.d.ts.map +1 -1
  102. package/dist/recovery/index.js +1 -1
  103. package/dist/recovery/index.js.map +1 -1
  104. package/dist/recovery/recoveryWebvh.d.ts +21 -2
  105. package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
  106. package/dist/recovery/recoveryWebvh.js +88 -31
  107. package/dist/recovery/recoveryWebvh.js.map +1 -1
  108. package/dist/space/ceremony.d.ts +3 -1
  109. package/dist/space/ceremony.d.ts.map +1 -1
  110. package/dist/space/ceremony.js +3 -1
  111. package/dist/space/ceremony.js.map +1 -1
  112. package/dist/unlock/index.d.ts +2 -2
  113. package/dist/unlock/index.d.ts.map +1 -1
  114. package/dist/unlock/index.js +1 -1
  115. package/dist/unlock/index.js.map +1 -1
  116. package/dist/unlock/retire.d.ts +21 -1
  117. package/dist/unlock/retire.d.ts.map +1 -1
  118. package/dist/unlock/retire.js +79 -1
  119. package/dist/unlock/retire.js.map +1 -1
  120. package/package.json +2 -2
@@ -0,0 +1,116 @@
1
+ import type { Logger } from './log.js';
2
+ import type { MendReportEntry } from './menders/types.js';
3
+ import type { MendOutcomeKind } from './menders/vocabulary.js';
4
+ import type { CeremonyId } from './space/ceremony.js';
5
+ /**
6
+ * A ceremony run's outcome: the mend outcome vocabulary, one closed set with
7
+ * one level map (`clean` info, `noop` debug, `partial` warn, `refused` warn,
8
+ * `failed` error).
9
+ */
10
+ export type CeremonyOutcome = MendOutcomeKind;
11
+ /**
12
+ * An event's per-site detail: scalars only, the reserved keys excluded.
13
+ * Counts, enum values, and permitted identifiers; never a record body, a
14
+ * secret, or free-form server text.
15
+ */
16
+ export type CeremonyDetail = {
17
+ ceremony?: never;
18
+ run?: never;
19
+ stage?: never;
20
+ outcome?: never;
21
+ invariant?: never;
22
+ errorName?: never;
23
+ err?: never;
24
+ } & Record<string, string | number | boolean | undefined>;
25
+ /**
26
+ * One ceremony run's emitter, minted by {@link ceremonyEvents} at the run's
27
+ * public entry point.
28
+ */
29
+ export interface CeremonyEmitter<Stage extends string> {
30
+ /**
31
+ * The run's `run` id, stamped on every event of the run.
32
+ */
33
+ readonly runId: string;
34
+ /**
35
+ * Emits `'ceremony stage'` at debug. A stage already emitted in this run is
36
+ * not emitted again, so a CAS retry that re-walks a stage stays silent.
37
+ */
38
+ stage(stage: Stage, detail?: CeremonyDetail): void;
39
+ /**
40
+ * Emits `'ceremony outcome'` at the outcome's level. `err`, when passed,
41
+ * rides `data.err` with its `errorName` beside it. Only the first call in a
42
+ * run emits.
43
+ */
44
+ outcome(outcome: CeremonyOutcome, detail?: CeremonyDetail, err?: unknown): void;
45
+ /**
46
+ * The boundary combinator: awaits `fn`, emits the outcome `classify`
47
+ * derives from its result (`clean` when omitted), and returns the result. On a throw it emits
48
+ * `noop` when the error's name is one of the ceremony's `pending` names,
49
+ * `refused` when it is one of its `refusals`, and `failed` otherwise, then
50
+ * rethrows.
51
+ */
52
+ run<T>(fn: () => Promise<T>, classify?: (result: T) => {
53
+ outcome: CeremonyOutcome;
54
+ detail?: CeremonyDetail;
55
+ }): Promise<T>;
56
+ }
57
+ /**
58
+ * Makes a server-served identifier (a collection name from a listing, a
59
+ * generation id from the annex listing) safe to carry in event detail: the
60
+ * control and bidi characters the onboarding label sanitizer strips are
61
+ * stripped, then the value is cut to {@link ONBOARDING_LABEL_MAX_LENGTH} code
62
+ * points with a `...` suffix. Unlike the label sanitizer it never refuses,
63
+ * since a log line never fails a ceremony.
64
+ *
65
+ * @param value {string}
66
+ * @returns {string}
67
+ */
68
+ export declare function servedIdentifier(value: string): string;
69
+ /**
70
+ * Mints one run's emitter at a ceremony's public entry point, outside any
71
+ * CAS-retry wrapper. `Stage` is the ceremony's exported stage union.
72
+ * `refusals` names the typed refusal classes (by `err.name`, which survives a
73
+ * linked or duplicated install where `instanceof` does not) whose throw
74
+ * classifies as `refused` rather than `failed`. `pending` names the throws a
75
+ * caller polls through ("not ready yet, retry"), which classify as `noop` so
76
+ * an ordinary wait logs at debug.
77
+ *
78
+ * @param options {object}
79
+ * @param options.ceremony {CeremonyId}
80
+ * @param options.log {Logger} the emitting module's logger
81
+ * @param [options.refusals] {ReadonlyArray<string>} the ceremony's
82
+ * refusal class names
83
+ * @param [options.pending] {ReadonlyArray<string>} the ceremony's
84
+ * not-ready-yet class names
85
+ * @returns {CeremonyEmitter<Stage>}
86
+ */
87
+ export declare function ceremonyEvents<Stage extends string>({ ceremony, log, refusals, pending }: {
88
+ ceremony: CeremonyId;
89
+ log: Logger;
90
+ refusals?: ReadonlyArray<string>;
91
+ pending?: ReadonlyArray<string>;
92
+ }): CeremonyEmitter<Stage>;
93
+ /**
94
+ * Emits one `'ceremony mender'` event from a landed mend report entry:
95
+ * `invariant`, `outcome`, `errorName` when present, the entry's detail, and
96
+ * `ceremony`, `run`, and `err` when passed. The entry's `ceremonies` array is
97
+ * not carried. A `noop` entry emits at debug. Every site that reports an entry
98
+ * passes it here unchanged, so an event cannot diverge from its report.
99
+ *
100
+ * @param options {object}
101
+ * @param options.log {Logger} the reporting site's logger
102
+ * @param options.entry {MendReportEntry} the entry as reported
103
+ * @param [options.ceremony] {string} the ceremony that just ran, on a
104
+ * ceremony-tail entry
105
+ * @param [options.run] {string} that ceremony run's `run` id, where the
106
+ * site holds its emitter
107
+ * @param [options.err] {unknown} the thrown value, where the site holds it
108
+ */
109
+ export declare function menderEvent<Ceremony extends string = CeremonyId>({ log, entry, ceremony, run, err }: {
110
+ log: Logger;
111
+ entry: MendReportEntry<Ceremony>;
112
+ ceremony?: Ceremony;
113
+ run?: string;
114
+ err?: unknown;
115
+ }): void;
116
+ //# sourceMappingURL=ceremonyEvents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ceremonyEvents.d.ts","sourceRoot":"","sources":["../src/ceremonyEvents.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,CAAA;AAgB7C;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,GAAG,CAAC,EAAE,KAAK,CAAA;IACX,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,OAAO,CAAC,EAAE,KAAK,CAAA;IACf,SAAS,CAAC,EAAE,KAAK,CAAA;IACjB,SAAS,CAAC,EAAE,KAAK,CA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MAAM,GAAG,UAAU,EAAE,EAChE,GAAG,EACH,KAAK,EACL,QAAQ,EACR,GAAG,EACH,GAAG,EACJ,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAA;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,OAAO,CAAA;CACd,GAAG,IAAI,CA4BP"}
@@ -0,0 +1,282 @@
1
+ /*!
2
+ * Copyright (c) 2026 Interop Alliance. All rights reserved.
3
+ */
4
+ /**
5
+ * The ceremony event channel: one structured event convention over the
6
+ * `Logger` seam, so a reader of the diagnostics stream can ask which
7
+ * ceremonies ran, which stage each reached, and which mender fired, without
8
+ * knowing any site's prose. Three kinds of event, each with a static message
9
+ * and reserved `data` keys:
10
+ *
11
+ * - `'ceremony stage'` (debug): `{ ceremony, run, stage, ...detail }`. The
12
+ * stage is complete as of now; `detail.prior: true` marks a stage that
13
+ * detected its own prior completion.
14
+ * - `'ceremony outcome'` (level by outcome): `{ ceremony, run, outcome,
15
+ * ...detail }`, plus `errorName` and `err` on `refused`, on `failed`, and
16
+ * on a `noop` classified from a pending throw. At most one per run. A run
17
+ * torn by tab death emits stages and no outcome.
18
+ * - `'ceremony mender'` (level by outcome): `{ invariant, outcome,
19
+ * errorName?, ...detail, ceremony?, run?, err? }`, one per reported
20
+ * mend entry.
21
+ *
22
+ * The events are additive diagnostics beside a ceremony's outcome object and
23
+ * typed errors, which stay the contract: no production code branches on one.
24
+ * Every helper catches internally and never throws, so a log line never
25
+ * fails a ceremony. `detail` is scalar-only, so an object, an array, or a
26
+ * record body cannot typecheck into an event.
27
+ *
28
+ * A root-level leaf beside `log.ts`. It takes the vocabularies it names as
29
+ * type-only imports and two import-free leaves at runtime, so every layer may
30
+ * import it.
31
+ */
32
+ import { errorNameOf } from './errorName.js';
33
+ import { LABEL_STRIPPED_CHARACTERS, ONBOARDING_LABEL_MAX_LENGTH } from './labelText.js';
34
+ /**
35
+ * The `data` keys the helpers own. A detail object cannot set one: the type
36
+ * rejects it, and the helpers drop one smuggled past the type.
37
+ */
38
+ const RESERVED_KEYS = new Set([
39
+ 'ceremony',
40
+ 'run',
41
+ 'stage',
42
+ 'outcome',
43
+ 'invariant',
44
+ 'errorName',
45
+ 'err'
46
+ ]);
47
+ /**
48
+ * The logger method each outcome emits through.
49
+ */
50
+ const OUTCOME_LEVELS = {
51
+ clean: 'info',
52
+ noop: 'debug',
53
+ partial: 'warn',
54
+ refused: 'warn',
55
+ failed: 'error'
56
+ };
57
+ /**
58
+ * A short random id naming one run. It correlates the events of a run and
59
+ * carries no authority, so a non-cryptographic source is enough, and it
60
+ * cannot throw on a platform without a WebCrypto global.
61
+ *
62
+ * @returns {string}
63
+ */
64
+ function mintRunId() {
65
+ return Math.random().toString(36).slice(2, 10).padEnd(8, '0');
66
+ }
67
+ /**
68
+ * Copies a detail's scalar values, dropping every reserved key and every
69
+ * value that is not a scalar. A throwing getter drops its own key alone.
70
+ *
71
+ * @param detail {CeremonyDetail | undefined}
72
+ * @returns {Record<string, string | number | boolean>}
73
+ */
74
+ function scalarDetail(detail) {
75
+ const copied = {};
76
+ if (detail === undefined || detail === null || typeof detail !== 'object') {
77
+ return copied;
78
+ }
79
+ let keys;
80
+ try {
81
+ keys = Object.keys(detail);
82
+ }
83
+ catch {
84
+ return copied;
85
+ }
86
+ for (const key of keys) {
87
+ if (RESERVED_KEYS.has(key)) {
88
+ continue;
89
+ }
90
+ try {
91
+ const value = detail[key];
92
+ if (typeof value === 'string' ||
93
+ typeof value === 'number' ||
94
+ typeof value === 'boolean') {
95
+ copied[key] = value;
96
+ }
97
+ }
98
+ catch {
99
+ // A throwing getter degrades to an event without that key.
100
+ }
101
+ }
102
+ return copied;
103
+ }
104
+ /**
105
+ * Emits one event, swallowing anything the logger throws.
106
+ *
107
+ * @param options {object}
108
+ * @param options.log {Logger}
109
+ * @param options.level {keyof Logger}
110
+ * @param options.msg {string}
111
+ * @param options.data {Record<string, unknown>}
112
+ */
113
+ function emit({ log, level, msg, data }) {
114
+ try {
115
+ log[level](msg, data);
116
+ }
117
+ catch {
118
+ // A log line never fails a ceremony.
119
+ }
120
+ }
121
+ /**
122
+ * The name a thrown value carries, or `'Error'` when even reading it throws.
123
+ *
124
+ * @param err {unknown}
125
+ * @returns {string}
126
+ */
127
+ function safeErrorName(err) {
128
+ try {
129
+ return errorNameOf(err);
130
+ }
131
+ catch {
132
+ return 'Error';
133
+ }
134
+ }
135
+ /**
136
+ * Makes a server-served identifier (a collection name from a listing, a
137
+ * generation id from the annex listing) safe to carry in event detail: the
138
+ * control and bidi characters the onboarding label sanitizer strips are
139
+ * stripped, then the value is cut to {@link ONBOARDING_LABEL_MAX_LENGTH} code
140
+ * points with a `...` suffix. Unlike the label sanitizer it never refuses,
141
+ * since a log line never fails a ceremony.
142
+ *
143
+ * @param value {string}
144
+ * @returns {string}
145
+ */
146
+ export function servedIdentifier(value) {
147
+ try {
148
+ const stripped = String(value).replace(LABEL_STRIPPED_CHARACTERS, '');
149
+ const codePoints = [...stripped];
150
+ if (codePoints.length <= ONBOARDING_LABEL_MAX_LENGTH) {
151
+ return stripped;
152
+ }
153
+ return `${codePoints.slice(0, ONBOARDING_LABEL_MAX_LENGTH).join('')}...`;
154
+ }
155
+ catch {
156
+ return '';
157
+ }
158
+ }
159
+ /**
160
+ * Mints one run's emitter at a ceremony's public entry point, outside any
161
+ * CAS-retry wrapper. `Stage` is the ceremony's exported stage union.
162
+ * `refusals` names the typed refusal classes (by `err.name`, which survives a
163
+ * linked or duplicated install where `instanceof` does not) whose throw
164
+ * classifies as `refused` rather than `failed`. `pending` names the throws a
165
+ * caller polls through ("not ready yet, retry"), which classify as `noop` so
166
+ * an ordinary wait logs at debug.
167
+ *
168
+ * @param options {object}
169
+ * @param options.ceremony {CeremonyId}
170
+ * @param options.log {Logger} the emitting module's logger
171
+ * @param [options.refusals] {ReadonlyArray<string>} the ceremony's
172
+ * refusal class names
173
+ * @param [options.pending] {ReadonlyArray<string>} the ceremony's
174
+ * not-ready-yet class names
175
+ * @returns {CeremonyEmitter<Stage>}
176
+ */
177
+ export function ceremonyEvents({ ceremony, log, refusals = [], pending = [] }) {
178
+ const runId = mintRunId();
179
+ const emittedStages = new Set();
180
+ let outcomeEmitted = false;
181
+ function stage(name, detail) {
182
+ if (emittedStages.has(name)) {
183
+ return;
184
+ }
185
+ emittedStages.add(name);
186
+ emit({
187
+ log,
188
+ level: 'debug',
189
+ msg: 'ceremony stage',
190
+ data: { ceremony, run: runId, stage: name, ...scalarDetail(detail) }
191
+ });
192
+ }
193
+ function outcome(kind, detail, err) {
194
+ if (outcomeEmitted) {
195
+ return;
196
+ }
197
+ outcomeEmitted = true;
198
+ const data = {
199
+ ceremony,
200
+ run: runId,
201
+ outcome: kind,
202
+ ...scalarDetail(detail)
203
+ };
204
+ if (err !== undefined) {
205
+ data.errorName = safeErrorName(err);
206
+ data.err = err;
207
+ }
208
+ emit({ log, level: OUTCOME_LEVELS[kind], msg: 'ceremony outcome', data });
209
+ }
210
+ async function run(fn, classify = () => ({ outcome: 'clean' })) {
211
+ let result;
212
+ try {
213
+ result = await fn();
214
+ }
215
+ catch (err) {
216
+ const name = safeErrorName(err);
217
+ if (pending.includes(name)) {
218
+ outcome('noop', undefined, err);
219
+ }
220
+ else {
221
+ outcome(refusals.includes(name) ? 'refused' : 'failed', undefined, err);
222
+ }
223
+ throw err;
224
+ }
225
+ try {
226
+ const classified = classify(result);
227
+ outcome(classified.outcome, classified.detail);
228
+ }
229
+ catch {
230
+ // A throwing classifier emits no outcome rather than a wrong one.
231
+ }
232
+ return result;
233
+ }
234
+ return { runId, stage, outcome, run };
235
+ }
236
+ /**
237
+ * Emits one `'ceremony mender'` event from a landed mend report entry:
238
+ * `invariant`, `outcome`, `errorName` when present, the entry's detail, and
239
+ * `ceremony`, `run`, and `err` when passed. The entry's `ceremonies` array is
240
+ * not carried. A `noop` entry emits at debug. Every site that reports an entry
241
+ * passes it here unchanged, so an event cannot diverge from its report.
242
+ *
243
+ * @param options {object}
244
+ * @param options.log {Logger} the reporting site's logger
245
+ * @param options.entry {MendReportEntry} the entry as reported
246
+ * @param [options.ceremony] {string} the ceremony that just ran, on a
247
+ * ceremony-tail entry
248
+ * @param [options.run] {string} that ceremony run's `run` id, where the
249
+ * site holds its emitter
250
+ * @param [options.err] {unknown} the thrown value, where the site holds it
251
+ */
252
+ export function menderEvent({ log, entry, ceremony, run, err }) {
253
+ try {
254
+ const data = {
255
+ invariant: entry.invariant,
256
+ outcome: entry.outcome,
257
+ ...scalarDetail(entry.detail)
258
+ };
259
+ if (entry.errorName !== undefined) {
260
+ data.errorName = entry.errorName;
261
+ }
262
+ if (ceremony !== undefined) {
263
+ data.ceremony = ceremony;
264
+ }
265
+ if (run !== undefined) {
266
+ data.run = run;
267
+ }
268
+ if (err !== undefined) {
269
+ data.err = err;
270
+ }
271
+ emit({
272
+ log,
273
+ level: OUTCOME_LEVELS[entry.outcome] ?? 'error',
274
+ msg: 'ceremony mender',
275
+ data
276
+ });
277
+ }
278
+ catch {
279
+ // A log line never fails a ceremony or a login chain.
280
+ }
281
+ }
282
+ //# sourceMappingURL=ceremonyEvents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ceremonyEvents.js","sourceRoot":"","sources":["../src/ceremonyEvents.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,gBAAgB,CAAA;AAavB;;;GAGG;AACH,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAC;IACjD,UAAU;IACV,KAAK;IACL,OAAO;IACP,SAAS;IACT,WAAW;IACX,WAAW;IACX,KAAK;CACN,CAAC,CAAA;AAyDF;;GAEG;AACH,MAAM,cAA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,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QAChB,CAAC;QACD,IAAI,CAAC;YACH,GAAG;YACH,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,OAAO;YAC/C,GAAG,EAAE,iBAAiB;YACtB,IAAI;SACL,CAAC,CAAA;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,sDAAsD;IACxD,CAAC;AACH,CAAC"}
@@ -61,7 +61,9 @@ import type { KmsAuthenticationBinding, PublishedWebvhLog, WebvhIdStore } from '
61
61
  import type { UnlockKeyAgreementPublication } from '../unlock/standingWebvh.js';
62
62
  import { type UserKey } from '../keys/index.js';
63
63
  import { type AccountGenesisResult } from '../genesis/accountGenesis.js';
64
+ import { type CeremonyEmitter } from '../ceremonyEvents.js';
64
65
  import { type StageNotifier } from '../log.js';
66
+ import { type CredentialAnchoredGenesisStage } from './stages.js';
65
67
  /**
66
68
  * The key set a credential-anchored signup mints locally before anything
67
69
  * touches the network: the data Space id and the account's user key -- nothing else.
@@ -143,7 +145,20 @@ export declare function mintCredentialAnchoredAccountKeySet(): Promise<{
143
145
  * stage adopted or minted, and which of the two it was -- the head is only
144
146
  * safely reusable downstream when this run minted it
145
147
  */
146
- export declare function ensureCredentialAnchoredAccountGenesis({ was, wasServerUrl, spaceId, ladderSeed, keyAgreement, standingRecipient, userKey, idStore, rosterStoreFor, collectionStoreFor, provideKmsAuthentication, expectedDid, onDidPublished, promoteController, onStage }: {
148
+ export declare function ensureCredentialAnchoredAccountGenesis(options: Omit<Parameters<typeof credentialAnchoredAccountGenesisCore>[0], 'events'>): Promise<AccountGenesisResult & {
149
+ published: PublishedWebvhLog;
150
+ logMinted: boolean;
151
+ }>;
152
+ /**
153
+ * The body of {@link ensureCredentialAnchoredAccountGenesis}, emitting its
154
+ * stage events through the caller's emitter. The establishment runs it under
155
+ * its own run, so one establishment emits one outcome.
156
+ *
157
+ * @param options {object} see {@link ensureCredentialAnchoredAccountGenesis},
158
+ * plus `events`, the running ceremony's emitter
159
+ * @returns {Promise<AccountGenesisResult>}
160
+ */
161
+ export declare function credentialAnchoredAccountGenesisCore({ was, wasServerUrl, spaceId, ladderSeed, keyAgreement, standingRecipient, userKey, idStore, rosterStoreFor, collectionStoreFor, provideKmsAuthentication, expectedDid, onDidPublished, promoteController, onStage, events }: {
147
162
  was: WasClient;
148
163
  wasServerUrl: string;
149
164
  spaceId: string;
@@ -169,6 +184,7 @@ export declare function ensureCredentialAnchoredAccountGenesis({ was, wasServerU
169
184
  }) => Promise<void>;
170
185
  promoteController?: boolean;
171
186
  onStage?: StageNotifier;
187
+ events: CeremonyEmitter<CredentialAnchoredGenesisStage>;
172
188
  }): Promise<AccountGenesisResult & {
173
189
  published: PublishedWebvhLog;
174
190
  logMinted: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"credentialAnchoredGenesis.d.ts","sourceRoot":"","sources":["../../src/clientAnnex/credentialAnchoredGenesis.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAwB,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAA;AAI7E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EACjB,YAAY,EACb,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAA;AAC/E,OAAO,EAGL,KAAK,OAAO,EAEb,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,8BAA8B,CAAA;AAErC,OAAO,EAAiB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,KAAK,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC,CAAA;IACnD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,CAAC,SAAS,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9D,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,MAAM,EAAE,eAAe,CAAC,8BAA8B,CAAC,CAAA;CACxD,GAAG,OAAO,CACT,oBAAoB,GAAG;IAAE,SAAS,EAAE,iBAAiB,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAC5E,CAoJA"}
@@ -58,9 +58,10 @@ import { provisionWalletSpace } from '../space/index.js';
58
58
  import { ladderVmAgent } from './zcap.js';
59
59
  import { ensureLadderAnchoredDidWebvh } from './ladderAnchored.js';
60
60
  import { ensureWalletSpaceEpochs, mintUserKey } from '../keys/index.js';
61
- import { AccountGenesisSpaceError, ensurePromotedSpaceController, mintSpaceId } from '../genesis/accountGenesis.js';
61
+ import { AccountGenesisSpaceError, ensurePromotedSpaceController, installedAny, mintSpaceId } from '../genesis/accountGenesis.js';
62
62
  import { startKmsAuthentication } from '../genesis/kmsAuthentication.js';
63
- import { stageNotifier } from '../log.js';
63
+ import { ceremonyEvents } from '../ceremonyEvents.js';
64
+ import { log, stageNotifier } from '../log.js';
64
65
  import { CONTROLLER_PROMOTION_STAGE } from './stages.js';
65
66
  /**
66
67
  * The key set a credential-anchored signup mints locally before anything
@@ -142,7 +143,32 @@ export async function mintCredentialAnchoredAccountKeySet() {
142
143
  * stage adopted or minted, and which of the two it was -- the head is only
143
144
  * safely reusable downstream when this run minted it
144
145
  */
145
- export async function ensureCredentialAnchoredAccountGenesis({ was, wasServerUrl, spaceId, ladderSeed, keyAgreement, standingRecipient, userKey, idStore, rosterStoreFor, collectionStoreFor, provideKmsAuthentication, expectedDid, onDidPublished, promoteController = true, onStage }) {
146
+ export async function ensureCredentialAnchoredAccountGenesis(options) {
147
+ const events = ceremonyEvents({
148
+ ceremony: 'credential-anchored-genesis',
149
+ log
150
+ });
151
+ return events.run(() => credentialAnchoredAccountGenesisCore({ ...options, events }), result => ({
152
+ outcome: result.failed.length > 0 || result.epochsSkipped !== undefined
153
+ ? 'partial'
154
+ : 'clean',
155
+ detail: {
156
+ failedStages: result.failed.length,
157
+ failedCollections: result.epochs?.failed.length ?? 0,
158
+ epochsSkipped: result.epochsSkipped !== undefined
159
+ }
160
+ }));
161
+ }
162
+ /**
163
+ * The body of {@link ensureCredentialAnchoredAccountGenesis}, emitting its
164
+ * stage events through the caller's emitter. The establishment runs it under
165
+ * its own run, so one establishment emits one outcome.
166
+ *
167
+ * @param options {object} see {@link ensureCredentialAnchoredAccountGenesis},
168
+ * plus `events`, the running ceremony's emitter
169
+ * @returns {Promise<AccountGenesisResult>}
170
+ */
171
+ export async function credentialAnchoredAccountGenesisCore({ was, wasServerUrl, spaceId, ladderSeed, keyAgreement, standingRecipient, userKey, idStore, rosterStoreFor, collectionStoreFor, provideKmsAuthentication, expectedDid, onDidPublished, promoteController = true, onStage, events }) {
146
172
  const failed = [];
147
173
  const stage = stageNotifier(onStage);
148
174
  const bootstrap = await ladderVmAgent({ ladderSeed });
@@ -173,12 +199,16 @@ export async function ensureCredentialAnchoredAccountGenesis({ was, wasServerUrl
173
199
  throw new AccountGenesisSpaceError({ spaceId, cause: err });
174
200
  }
175
201
  stage('space-provisioning');
202
+ events.stage('space-provisioning');
176
203
  // The join: the genesis entry carries the KMS binding, so it waits on the
177
204
  // whole stage even though the Space no longer does.
178
205
  const kmsAuthentication = await kms.join();
179
206
  if (kmsAuthentication.failed) {
180
207
  failed.push({ stage: 'kmsAuthentication', error: kmsAuthentication.error });
181
208
  }
209
+ else {
210
+ events.stage('kms-authentication');
211
+ }
182
212
  stage('kms-authentication');
183
213
  const didWebKeys = kmsAuthentication.binding?.keys;
184
214
  // 3. The ladder-anchored did:webvh genesis -- probe, adopt
@@ -198,6 +228,7 @@ export async function ensureCredentialAnchoredAccountGenesis({ was, wasServerUrl
198
228
  });
199
229
  await onDidPublished?.({ did });
200
230
  stage('webvh-genesis');
231
+ events.stage('webvh-genesis', { ...(logMinted ? {} : { prior: true }) });
201
232
  // 4. The roster genesis: epoch[0] IS the user key, wrapped once, to the
202
233
  // credential's standing key-agreement key. The store's ladder-signed
203
234
  // genesis append is the ceremony-tail license's first-entry shape.
@@ -213,6 +244,9 @@ export async function ensureCredentialAnchoredAccountGenesis({ was, wasServerUrl
213
244
  recipients: [standingRecipient],
214
245
  epoch: { epochId: userKey.id, secret: userKey.secret }
215
246
  });
247
+ events.stage('roster-genesis', {
248
+ ...(current !== null ? { prior: true } : {})
249
+ });
216
250
  }
217
251
  catch (err) {
218
252
  failed.push({ stage: 'roster', error: err });
@@ -237,6 +271,11 @@ export async function ensureCredentialAnchoredAccountGenesis({ was, wasServerUrl
237
271
  }
238
272
  else {
239
273
  epochs = fanOut;
274
+ if (fanOut.failed.length === 0) {
275
+ events.stage('collection-epochs', {
276
+ ...(installedAny(fanOut) ? {} : { prior: true })
277
+ });
278
+ }
240
279
  }
241
280
  }
242
281
  catch (err) {
@@ -255,6 +294,9 @@ export async function ensureCredentialAnchoredAccountGenesis({ was, wasServerUrl
255
294
  spaceId,
256
295
  did
257
296
  });
297
+ events.stage(CONTROLLER_PROMOTION_STAGE, {
298
+ ...(promotion === 'confirmed' ? { prior: true } : {})
299
+ });
258
300
  }
259
301
  catch (err) {
260
302
  failed.push({ stage: 'promotion', error: err });
@@ -1 +1 @@
1
- {"version":3,"file":"credentialAnchoredGenesis.js","sourceRoot":"","sources":["../../src/clientAnnex/credentialAnchoredGenesis.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,OAAO,EACL,cAAc,EAEf,MAAM,8BAA8B,CAAA;AAI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,CAAC;YACH,SAAS,GAAG,MAAM,6BAA6B,CAAC;gBAC9C,GAAG;gBACH,WAAW,EAAE,GAAG;gBAChB,OAAO;gBACP,GAAG;aACJ,CAAC,CAAA;YACF,MAAM,CAAC,KAAK,CAAC,0BAA0B,EAAE;gBACvC,GAAG,CAAC,SAAS,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACtD,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;QACjD,CAAC;QACD,KAAK,CAAC,0BAA0B,CAAC,CAAA;IACnC,CAAC;IAED,OAAO;QACL,GAAG;QACH,SAAS;QACT,SAAS;QACT,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7B,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3C,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnC,MAAM;KACP,CAAA;AACH,CAAC"}
@@ -102,6 +102,7 @@ import type { ICapabilityAgent } from '../webvh/zcap.js';
102
102
  import type { AccountPointer } from '../keyring/recordEnvelope.js';
103
103
  import { type UserKey } from '../keys/index.js';
104
104
  import { type LadderRung } from './ladder.js';
105
+ import { type CeremonyDetail, type CeremonyOutcome } from '../ceremonyEvents.js';
105
106
  import { type StageNotifier } from '../log.js';
106
107
  /**
107
108
  * The standing members an unlock-methods registry entry records for the
@@ -437,6 +438,27 @@ export declare function establishCredentialAnchoredAccount(options: {
437
438
  now?: number;
438
439
  onStage?: StageNotifier;
439
440
  }): Promise<CredentialAnchoredEstablishment>;
441
+ /**
442
+ * Grades one returned establishment for its outcome event. A collected
443
+ * best-effort failure is `partial`. An epoch skip is `partial` too, unless
444
+ * the adopted-roster arm delivered those epochs on this run: that skip is
445
+ * already converged, so the run is `clean`. Detail is counts and booleans
446
+ * alone, since this ceremony runs on transient paths, where no account
447
+ * identifier enters an event.
448
+ *
449
+ * @param options {object}
450
+ * @param options.establishment {CredentialAnchoredEstablishment}
451
+ * @param options.rosterDelivered {boolean} whether the adopted-roster arm
452
+ * delivered the skipped epochs on this run
453
+ * @returns {{ outcome: CeremonyOutcome, detail: CeremonyDetail }}
454
+ */
455
+ export declare function establishmentOutcome({ establishment, rosterDelivered }: {
456
+ establishment: Pick<CredentialAnchoredEstablishment, 'failed' | 'epochsSkipped'>;
457
+ rosterDelivered: boolean;
458
+ }): {
459
+ outcome: CeremonyOutcome;
460
+ detail: CeremonyDetail;
461
+ };
440
462
  /**
441
463
  * The re-bind every credential-anchored path ends on (the establishment's
442
464
  * stage 4, and the mend's record-downgrade re-bind): the ladder-VM-signed