@oxyhq/contracts 0.16.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/devicePairing.js +138 -0
- package/dist/cjs/deviceSession.js +9 -0
- package/dist/cjs/index.js +21 -3
- package/dist/cjs/sessionStatus.js +15 -0
- package/dist/cjs/transparency.js +89 -0
- package/dist/cjs/userResponse.js +27 -1
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/devicePairing.js +135 -0
- package/dist/esm/deviceSession.js +9 -0
- package/dist/esm/index.js +7 -1
- package/dist/esm/sessionStatus.js +15 -0
- package/dist/esm/transparency.js +86 -0
- package/dist/esm/userResponse.js +26 -0
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/devicePairing.d.ts +130 -0
- package/dist/types/deviceSession.d.ts +11 -0
- package/dist/types/index.d.ts +6 -2
- package/dist/types/keyRecovery.d.ts +4 -4
- package/dist/types/keyRotation.d.ts +2 -2
- package/dist/types/sessionStatus.d.ts +27 -6
- package/dist/types/transparency.d.ts +392 -0
- package/dist/types/userResponse.d.ts +256 -0
- package/package.json +3 -3
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* One signer's endorsement of a checkpoint's signed fields.
|
|
4
|
+
*
|
|
5
|
+
* The operator and every independent witness produce this same shape over the
|
|
6
|
+
* SAME bytes, so the array on a checkpoint can grow without coordination.
|
|
7
|
+
*/
|
|
8
|
+
export declare const transparencyCheckpointSignatureSchema: z.ZodObject<{
|
|
9
|
+
/** Uncompressed hex public key of the signer. */
|
|
10
|
+
publicKey: z.ZodString;
|
|
11
|
+
alg: z.ZodLiteral<"ES256K-DER-SHA256">;
|
|
12
|
+
/** DER-encoded hex secp256k1 signature over the checkpoint signing input. */
|
|
13
|
+
signature: z.ZodString;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
publicKey: string;
|
|
16
|
+
alg: "ES256K-DER-SHA256";
|
|
17
|
+
signature: string;
|
|
18
|
+
}, {
|
|
19
|
+
publicKey: string;
|
|
20
|
+
alg: "ES256K-DER-SHA256";
|
|
21
|
+
signature: string;
|
|
22
|
+
}>;
|
|
23
|
+
/** Where a checkpoint root was published on a public chain. */
|
|
24
|
+
export declare const transparencyAnchorSchema: z.ZodObject<{
|
|
25
|
+
/** Chain/network identifier, e.g. `faircoin-main`. */
|
|
26
|
+
network: z.ZodString;
|
|
27
|
+
txid: z.ZodString;
|
|
28
|
+
confirmations: z.ZodNumber;
|
|
29
|
+
/** When the anchoring transaction was broadcast (ms epoch). */
|
|
30
|
+
anchoredAt: z.ZodNumber;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
network: string;
|
|
33
|
+
txid: string;
|
|
34
|
+
confirmations: number;
|
|
35
|
+
anchoredAt: number;
|
|
36
|
+
}, {
|
|
37
|
+
network: string;
|
|
38
|
+
txid: string;
|
|
39
|
+
confirmations: number;
|
|
40
|
+
anchoredAt: number;
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* A published checkpoint.
|
|
44
|
+
*
|
|
45
|
+
* `signatures` is non-empty by contract: an unsigned root commits nobody and
|
|
46
|
+
* must never be served as a checkpoint. `anchors` may be empty — a checkpoint is
|
|
47
|
+
* published immediately and anchored asynchronously, so "not yet anchored" is a
|
|
48
|
+
* normal, temporary state rather than an error.
|
|
49
|
+
*/
|
|
50
|
+
export declare const transparencyCheckpointSchema: z.ZodObject<{
|
|
51
|
+
index: z.ZodNumber;
|
|
52
|
+
/** End of the committed period (ms epoch). */
|
|
53
|
+
periodEnd: z.ZodNumber;
|
|
54
|
+
/** Number of subjects (leaves) committed. */
|
|
55
|
+
treeSize: z.ZodNumber;
|
|
56
|
+
root: z.ZodString;
|
|
57
|
+
/** Hash of the previous checkpoint; `null` only at genesis. */
|
|
58
|
+
prevCheckpointHash: z.ZodNullable<z.ZodString>;
|
|
59
|
+
signatures: z.ZodArray<z.ZodObject<{
|
|
60
|
+
/** Uncompressed hex public key of the signer. */
|
|
61
|
+
publicKey: z.ZodString;
|
|
62
|
+
alg: z.ZodLiteral<"ES256K-DER-SHA256">;
|
|
63
|
+
/** DER-encoded hex secp256k1 signature over the checkpoint signing input. */
|
|
64
|
+
signature: z.ZodString;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
publicKey: string;
|
|
67
|
+
alg: "ES256K-DER-SHA256";
|
|
68
|
+
signature: string;
|
|
69
|
+
}, {
|
|
70
|
+
publicKey: string;
|
|
71
|
+
alg: "ES256K-DER-SHA256";
|
|
72
|
+
signature: string;
|
|
73
|
+
}>, "many">;
|
|
74
|
+
anchors: z.ZodArray<z.ZodObject<{
|
|
75
|
+
/** Chain/network identifier, e.g. `faircoin-main`. */
|
|
76
|
+
network: z.ZodString;
|
|
77
|
+
txid: z.ZodString;
|
|
78
|
+
confirmations: z.ZodNumber;
|
|
79
|
+
/** When the anchoring transaction was broadcast (ms epoch). */
|
|
80
|
+
anchoredAt: z.ZodNumber;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
network: string;
|
|
83
|
+
txid: string;
|
|
84
|
+
confirmations: number;
|
|
85
|
+
anchoredAt: number;
|
|
86
|
+
}, {
|
|
87
|
+
network: string;
|
|
88
|
+
txid: string;
|
|
89
|
+
confirmations: number;
|
|
90
|
+
anchoredAt: number;
|
|
91
|
+
}>, "many">;
|
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
|
93
|
+
index: number;
|
|
94
|
+
periodEnd: number;
|
|
95
|
+
treeSize: number;
|
|
96
|
+
root: string;
|
|
97
|
+
prevCheckpointHash: string | null;
|
|
98
|
+
signatures: {
|
|
99
|
+
publicKey: string;
|
|
100
|
+
alg: "ES256K-DER-SHA256";
|
|
101
|
+
signature: string;
|
|
102
|
+
}[];
|
|
103
|
+
anchors: {
|
|
104
|
+
network: string;
|
|
105
|
+
txid: string;
|
|
106
|
+
confirmations: number;
|
|
107
|
+
anchoredAt: number;
|
|
108
|
+
}[];
|
|
109
|
+
}, {
|
|
110
|
+
index: number;
|
|
111
|
+
periodEnd: number;
|
|
112
|
+
treeSize: number;
|
|
113
|
+
root: string;
|
|
114
|
+
prevCheckpointHash: string | null;
|
|
115
|
+
signatures: {
|
|
116
|
+
publicKey: string;
|
|
117
|
+
alg: "ES256K-DER-SHA256";
|
|
118
|
+
signature: string;
|
|
119
|
+
}[];
|
|
120
|
+
anchors: {
|
|
121
|
+
network: string;
|
|
122
|
+
txid: string;
|
|
123
|
+
confirmations: number;
|
|
124
|
+
anchoredAt: number;
|
|
125
|
+
}[];
|
|
126
|
+
}>;
|
|
127
|
+
/**
|
|
128
|
+
* An inclusion proof for one subject against one checkpoint.
|
|
129
|
+
*
|
|
130
|
+
* Carries the leaf PREIMAGE (`subjectDid`, `seq`, `headRecordId`) as well as the
|
|
131
|
+
* `leaf` digest so the verifier re-derives the leaf itself rather than trusting
|
|
132
|
+
* the server's hash, then walks `proof` up to the checkpoint's `root`.
|
|
133
|
+
*/
|
|
134
|
+
export declare const transparencyInclusionProofSchema: z.ZodObject<{
|
|
135
|
+
checkpoint: z.ZodObject<{
|
|
136
|
+
index: z.ZodNumber;
|
|
137
|
+
/** End of the committed period (ms epoch). */
|
|
138
|
+
periodEnd: z.ZodNumber;
|
|
139
|
+
/** Number of subjects (leaves) committed. */
|
|
140
|
+
treeSize: z.ZodNumber;
|
|
141
|
+
root: z.ZodString;
|
|
142
|
+
/** Hash of the previous checkpoint; `null` only at genesis. */
|
|
143
|
+
prevCheckpointHash: z.ZodNullable<z.ZodString>;
|
|
144
|
+
signatures: z.ZodArray<z.ZodObject<{
|
|
145
|
+
/** Uncompressed hex public key of the signer. */
|
|
146
|
+
publicKey: z.ZodString;
|
|
147
|
+
alg: z.ZodLiteral<"ES256K-DER-SHA256">;
|
|
148
|
+
/** DER-encoded hex secp256k1 signature over the checkpoint signing input. */
|
|
149
|
+
signature: z.ZodString;
|
|
150
|
+
}, "strip", z.ZodTypeAny, {
|
|
151
|
+
publicKey: string;
|
|
152
|
+
alg: "ES256K-DER-SHA256";
|
|
153
|
+
signature: string;
|
|
154
|
+
}, {
|
|
155
|
+
publicKey: string;
|
|
156
|
+
alg: "ES256K-DER-SHA256";
|
|
157
|
+
signature: string;
|
|
158
|
+
}>, "many">;
|
|
159
|
+
anchors: z.ZodArray<z.ZodObject<{
|
|
160
|
+
/** Chain/network identifier, e.g. `faircoin-main`. */
|
|
161
|
+
network: z.ZodString;
|
|
162
|
+
txid: z.ZodString;
|
|
163
|
+
confirmations: z.ZodNumber;
|
|
164
|
+
/** When the anchoring transaction was broadcast (ms epoch). */
|
|
165
|
+
anchoredAt: z.ZodNumber;
|
|
166
|
+
}, "strip", z.ZodTypeAny, {
|
|
167
|
+
network: string;
|
|
168
|
+
txid: string;
|
|
169
|
+
confirmations: number;
|
|
170
|
+
anchoredAt: number;
|
|
171
|
+
}, {
|
|
172
|
+
network: string;
|
|
173
|
+
txid: string;
|
|
174
|
+
confirmations: number;
|
|
175
|
+
anchoredAt: number;
|
|
176
|
+
}>, "many">;
|
|
177
|
+
}, "strip", z.ZodTypeAny, {
|
|
178
|
+
index: number;
|
|
179
|
+
periodEnd: number;
|
|
180
|
+
treeSize: number;
|
|
181
|
+
root: string;
|
|
182
|
+
prevCheckpointHash: string | null;
|
|
183
|
+
signatures: {
|
|
184
|
+
publicKey: string;
|
|
185
|
+
alg: "ES256K-DER-SHA256";
|
|
186
|
+
signature: string;
|
|
187
|
+
}[];
|
|
188
|
+
anchors: {
|
|
189
|
+
network: string;
|
|
190
|
+
txid: string;
|
|
191
|
+
confirmations: number;
|
|
192
|
+
anchoredAt: number;
|
|
193
|
+
}[];
|
|
194
|
+
}, {
|
|
195
|
+
index: number;
|
|
196
|
+
periodEnd: number;
|
|
197
|
+
treeSize: number;
|
|
198
|
+
root: string;
|
|
199
|
+
prevCheckpointHash: string | null;
|
|
200
|
+
signatures: {
|
|
201
|
+
publicKey: string;
|
|
202
|
+
alg: "ES256K-DER-SHA256";
|
|
203
|
+
signature: string;
|
|
204
|
+
}[];
|
|
205
|
+
anchors: {
|
|
206
|
+
network: string;
|
|
207
|
+
txid: string;
|
|
208
|
+
confirmations: number;
|
|
209
|
+
anchoredAt: number;
|
|
210
|
+
}[];
|
|
211
|
+
}>;
|
|
212
|
+
subjectDid: z.ZodString;
|
|
213
|
+
seq: z.ZodNumber;
|
|
214
|
+
headRecordId: z.ZodString;
|
|
215
|
+
leaf: z.ZodString;
|
|
216
|
+
leafIndex: z.ZodNumber;
|
|
217
|
+
/** Audit path, leaf-adjacent sibling first; empty for a single-leaf tree. */
|
|
218
|
+
proof: z.ZodArray<z.ZodString, "many">;
|
|
219
|
+
}, "strip", z.ZodTypeAny, {
|
|
220
|
+
seq: number;
|
|
221
|
+
proof: string[];
|
|
222
|
+
headRecordId: string;
|
|
223
|
+
checkpoint: {
|
|
224
|
+
index: number;
|
|
225
|
+
periodEnd: number;
|
|
226
|
+
treeSize: number;
|
|
227
|
+
root: string;
|
|
228
|
+
prevCheckpointHash: string | null;
|
|
229
|
+
signatures: {
|
|
230
|
+
publicKey: string;
|
|
231
|
+
alg: "ES256K-DER-SHA256";
|
|
232
|
+
signature: string;
|
|
233
|
+
}[];
|
|
234
|
+
anchors: {
|
|
235
|
+
network: string;
|
|
236
|
+
txid: string;
|
|
237
|
+
confirmations: number;
|
|
238
|
+
anchoredAt: number;
|
|
239
|
+
}[];
|
|
240
|
+
};
|
|
241
|
+
subjectDid: string;
|
|
242
|
+
leaf: string;
|
|
243
|
+
leafIndex: number;
|
|
244
|
+
}, {
|
|
245
|
+
seq: number;
|
|
246
|
+
proof: string[];
|
|
247
|
+
headRecordId: string;
|
|
248
|
+
checkpoint: {
|
|
249
|
+
index: number;
|
|
250
|
+
periodEnd: number;
|
|
251
|
+
treeSize: number;
|
|
252
|
+
root: string;
|
|
253
|
+
prevCheckpointHash: string | null;
|
|
254
|
+
signatures: {
|
|
255
|
+
publicKey: string;
|
|
256
|
+
alg: "ES256K-DER-SHA256";
|
|
257
|
+
signature: string;
|
|
258
|
+
}[];
|
|
259
|
+
anchors: {
|
|
260
|
+
network: string;
|
|
261
|
+
txid: string;
|
|
262
|
+
confirmations: number;
|
|
263
|
+
anchoredAt: number;
|
|
264
|
+
}[];
|
|
265
|
+
};
|
|
266
|
+
subjectDid: string;
|
|
267
|
+
leaf: string;
|
|
268
|
+
leafIndex: number;
|
|
269
|
+
}>;
|
|
270
|
+
/** A page of the checkpoint chain, oldest first, for walking `prevCheckpointHash`. */
|
|
271
|
+
export declare const transparencyCheckpointListSchema: z.ZodObject<{
|
|
272
|
+
checkpoints: z.ZodArray<z.ZodObject<{
|
|
273
|
+
index: z.ZodNumber;
|
|
274
|
+
/** End of the committed period (ms epoch). */
|
|
275
|
+
periodEnd: z.ZodNumber;
|
|
276
|
+
/** Number of subjects (leaves) committed. */
|
|
277
|
+
treeSize: z.ZodNumber;
|
|
278
|
+
root: z.ZodString;
|
|
279
|
+
/** Hash of the previous checkpoint; `null` only at genesis. */
|
|
280
|
+
prevCheckpointHash: z.ZodNullable<z.ZodString>;
|
|
281
|
+
signatures: z.ZodArray<z.ZodObject<{
|
|
282
|
+
/** Uncompressed hex public key of the signer. */
|
|
283
|
+
publicKey: z.ZodString;
|
|
284
|
+
alg: z.ZodLiteral<"ES256K-DER-SHA256">;
|
|
285
|
+
/** DER-encoded hex secp256k1 signature over the checkpoint signing input. */
|
|
286
|
+
signature: z.ZodString;
|
|
287
|
+
}, "strip", z.ZodTypeAny, {
|
|
288
|
+
publicKey: string;
|
|
289
|
+
alg: "ES256K-DER-SHA256";
|
|
290
|
+
signature: string;
|
|
291
|
+
}, {
|
|
292
|
+
publicKey: string;
|
|
293
|
+
alg: "ES256K-DER-SHA256";
|
|
294
|
+
signature: string;
|
|
295
|
+
}>, "many">;
|
|
296
|
+
anchors: z.ZodArray<z.ZodObject<{
|
|
297
|
+
/** Chain/network identifier, e.g. `faircoin-main`. */
|
|
298
|
+
network: z.ZodString;
|
|
299
|
+
txid: z.ZodString;
|
|
300
|
+
confirmations: z.ZodNumber;
|
|
301
|
+
/** When the anchoring transaction was broadcast (ms epoch). */
|
|
302
|
+
anchoredAt: z.ZodNumber;
|
|
303
|
+
}, "strip", z.ZodTypeAny, {
|
|
304
|
+
network: string;
|
|
305
|
+
txid: string;
|
|
306
|
+
confirmations: number;
|
|
307
|
+
anchoredAt: number;
|
|
308
|
+
}, {
|
|
309
|
+
network: string;
|
|
310
|
+
txid: string;
|
|
311
|
+
confirmations: number;
|
|
312
|
+
anchoredAt: number;
|
|
313
|
+
}>, "many">;
|
|
314
|
+
}, "strip", z.ZodTypeAny, {
|
|
315
|
+
index: number;
|
|
316
|
+
periodEnd: number;
|
|
317
|
+
treeSize: number;
|
|
318
|
+
root: string;
|
|
319
|
+
prevCheckpointHash: string | null;
|
|
320
|
+
signatures: {
|
|
321
|
+
publicKey: string;
|
|
322
|
+
alg: "ES256K-DER-SHA256";
|
|
323
|
+
signature: string;
|
|
324
|
+
}[];
|
|
325
|
+
anchors: {
|
|
326
|
+
network: string;
|
|
327
|
+
txid: string;
|
|
328
|
+
confirmations: number;
|
|
329
|
+
anchoredAt: number;
|
|
330
|
+
}[];
|
|
331
|
+
}, {
|
|
332
|
+
index: number;
|
|
333
|
+
periodEnd: number;
|
|
334
|
+
treeSize: number;
|
|
335
|
+
root: string;
|
|
336
|
+
prevCheckpointHash: string | null;
|
|
337
|
+
signatures: {
|
|
338
|
+
publicKey: string;
|
|
339
|
+
alg: "ES256K-DER-SHA256";
|
|
340
|
+
signature: string;
|
|
341
|
+
}[];
|
|
342
|
+
anchors: {
|
|
343
|
+
network: string;
|
|
344
|
+
txid: string;
|
|
345
|
+
confirmations: number;
|
|
346
|
+
anchoredAt: number;
|
|
347
|
+
}[];
|
|
348
|
+
}>, "many">;
|
|
349
|
+
}, "strip", z.ZodTypeAny, {
|
|
350
|
+
checkpoints: {
|
|
351
|
+
index: number;
|
|
352
|
+
periodEnd: number;
|
|
353
|
+
treeSize: number;
|
|
354
|
+
root: string;
|
|
355
|
+
prevCheckpointHash: string | null;
|
|
356
|
+
signatures: {
|
|
357
|
+
publicKey: string;
|
|
358
|
+
alg: "ES256K-DER-SHA256";
|
|
359
|
+
signature: string;
|
|
360
|
+
}[];
|
|
361
|
+
anchors: {
|
|
362
|
+
network: string;
|
|
363
|
+
txid: string;
|
|
364
|
+
confirmations: number;
|
|
365
|
+
anchoredAt: number;
|
|
366
|
+
}[];
|
|
367
|
+
}[];
|
|
368
|
+
}, {
|
|
369
|
+
checkpoints: {
|
|
370
|
+
index: number;
|
|
371
|
+
periodEnd: number;
|
|
372
|
+
treeSize: number;
|
|
373
|
+
root: string;
|
|
374
|
+
prevCheckpointHash: string | null;
|
|
375
|
+
signatures: {
|
|
376
|
+
publicKey: string;
|
|
377
|
+
alg: "ES256K-DER-SHA256";
|
|
378
|
+
signature: string;
|
|
379
|
+
}[];
|
|
380
|
+
anchors: {
|
|
381
|
+
network: string;
|
|
382
|
+
txid: string;
|
|
383
|
+
confirmations: number;
|
|
384
|
+
anchoredAt: number;
|
|
385
|
+
}[];
|
|
386
|
+
}[];
|
|
387
|
+
}>;
|
|
388
|
+
export type TransparencyCheckpointSignature = z.infer<typeof transparencyCheckpointSignatureSchema>;
|
|
389
|
+
export type TransparencyAnchor = z.infer<typeof transparencyAnchorSchema>;
|
|
390
|
+
export type TransparencyCheckpoint = z.infer<typeof transparencyCheckpointSchema>;
|
|
391
|
+
export type TransparencyInclusionProof = z.infer<typeof transparencyInclusionProofSchema>;
|
|
392
|
+
export type TransparencyCheckpointList = z.infer<typeof transparencyCheckpointListSchema>;
|