@oxyhq/contracts 0.17.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 +17 -1
- package/dist/cjs/sessionStatus.js +15 -0
- package/dist/cjs/transparency.js +89 -0
- 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 +6 -0
- package/dist/esm/sessionStatus.js +15 -0
- package/dist/esm/transparency.js +86 -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 +4 -0
- package/dist/types/keyRecovery.d.ts +4 -4
- package/dist/types/keyRotation.d.ts +2 -2
- package/dist/types/sessionStatus.d.ts +21 -0
- package/dist/types/transparency.d.ts +392 -0
- package/package.json +3 -3
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device-to-device identity transfer contracts (b3 Feature 2 — "add a device").
|
|
3
|
+
*
|
|
4
|
+
* SINGLE SOURCE OF TRUTH for the wire shape of the short-lived, unauthenticated
|
|
5
|
+
* relay that carries E2E-encrypted key material from an existing (old) device to
|
|
6
|
+
* a fresh (new) device so both end up holding the SAME secp256k1 private key
|
|
7
|
+
* (key cloning). The relay is E2E-encrypted via an ephemeral secp256k1 ECDH
|
|
8
|
+
* handshake: the server stores only the two ephemeral public keys plus an opaque
|
|
9
|
+
* AEAD ciphertext + nonce and NEVER holds a decryption key.
|
|
10
|
+
*
|
|
11
|
+
* Flow:
|
|
12
|
+
* 1. New device (no identity) generates an ephemeral pair and calls
|
|
13
|
+
* `POST /identity/device-transfer/init { newEphPub, newDeviceLabel? }` →
|
|
14
|
+
* `{ pairingId, expiresAt }`. The QR carries ONLY `pairingId` (not
|
|
15
|
+
* self-contained — mirrors the QR sign-in `approve-info` resolution).
|
|
16
|
+
* 2. Old device (has identity) scans, resolves the request via
|
|
17
|
+
* `GET /identity/device-transfer/:pairingId` (returns `newEphPub` + label),
|
|
18
|
+
* derives `transferKey = HKDF(ECDH(oldEphPriv, newEphPub), pairingId,
|
|
19
|
+
* 'oxy-device-transfer-v1')`, AEAD-encrypts `{ privateKey, publicKey }`, and
|
|
20
|
+
* calls `POST /identity/device-transfer/:pairingId/approve` with the
|
|
21
|
+
* ciphertext PLUS a fresh signature over
|
|
22
|
+
* `{ action:'approve_device_transfer', pairingId, timestamp }` made with the
|
|
23
|
+
* CURRENT identity key (dual-proof: a bearer alone cannot exfiltrate the key).
|
|
24
|
+
* 3. New device (socket push or poll fallback) re-derives the same
|
|
25
|
+
* `transferKey` from `ECDH(newEphPriv, oldEphPub)`, decrypts, and imports the
|
|
26
|
+
* private key, then completes a NORMAL challenge/verify sign-in.
|
|
27
|
+
*
|
|
28
|
+
* The load-bearing response shapes are declared as explicit `interface`s (same
|
|
29
|
+
* `moduleResolution: node` rationale as `UserNameResponse` / the identity/civic
|
|
30
|
+
* contracts: a nested `z.infer<>` can degrade to `{}` under a consumer's
|
|
31
|
+
* `moduleResolution: "node"`), with the runtime schemas annotated
|
|
32
|
+
* `z.ZodType<Interface>`.
|
|
33
|
+
*
|
|
34
|
+
* Platform-agnostic — zod only, no react/react-native/expo, ESM-safe.
|
|
35
|
+
*/
|
|
36
|
+
import { z } from 'zod';
|
|
37
|
+
/**
|
|
38
|
+
* Pairing lifecycle:
|
|
39
|
+
* - `pending` — created by the new device, awaiting the old device's approval.
|
|
40
|
+
* - `approved` — the old device sealed and posted the encrypted key material.
|
|
41
|
+
* - `denied` — the old device explicitly cancelled the transfer.
|
|
42
|
+
* - `expired` — the 3-minute TTL elapsed before approval.
|
|
43
|
+
*/
|
|
44
|
+
export declare const devicePairingStatusSchema: z.ZodEnum<["pending", "approved", "denied", "expired"]>;
|
|
45
|
+
export type DevicePairingStatus = z.infer<typeof devicePairingStatusSchema>;
|
|
46
|
+
/** Request body for `POST /identity/device-transfer/init` (public). */
|
|
47
|
+
export declare const deviceTransferInitRequestSchema: z.ZodObject<{
|
|
48
|
+
/** The new device's ephemeral secp256k1 public key (single-use). */
|
|
49
|
+
newEphPub: z.ZodString;
|
|
50
|
+
/** Optional human-readable label for the new device (e.g. "iPhone 15"). */
|
|
51
|
+
newDeviceLabel: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
newEphPub: string;
|
|
54
|
+
newDeviceLabel?: string | undefined;
|
|
55
|
+
}, {
|
|
56
|
+
newEphPub: string;
|
|
57
|
+
newDeviceLabel?: string | undefined;
|
|
58
|
+
}>;
|
|
59
|
+
export type DeviceTransferInitRequest = z.infer<typeof deviceTransferInitRequestSchema>;
|
|
60
|
+
export interface DeviceTransferInitResponse {
|
|
61
|
+
/** 128-bit single-use handle carried in the QR. Also the HKDF salt. */
|
|
62
|
+
pairingId: string;
|
|
63
|
+
/** ISO-8601 expiry (3 minutes from creation). */
|
|
64
|
+
expiresAt: string;
|
|
65
|
+
}
|
|
66
|
+
export declare const deviceTransferInitResponseSchema: z.ZodType<DeviceTransferInitResponse>;
|
|
67
|
+
export interface DeviceTransferInfoResponse {
|
|
68
|
+
pairingId: string;
|
|
69
|
+
/** The new device's ephemeral public key (so the old device can ECDH). */
|
|
70
|
+
newDeviceEphemeralPublicKey: string;
|
|
71
|
+
/** Optional new-device label supplied at init. */
|
|
72
|
+
newDeviceLabel: string | null;
|
|
73
|
+
status: DevicePairingStatus;
|
|
74
|
+
/** ISO-8601 expiry. */
|
|
75
|
+
expiresAt: string;
|
|
76
|
+
/**
|
|
77
|
+
* The old device's ephemeral public key — present ONLY once `status` is
|
|
78
|
+
* `approved` (so the new device can re-derive the shared secret).
|
|
79
|
+
*/
|
|
80
|
+
oldDeviceEphemeralPublicKey: string | null;
|
|
81
|
+
/** AEAD ciphertext (hex) — present ONLY once `status` is `approved`. */
|
|
82
|
+
ciphertext: string | null;
|
|
83
|
+
/** AEAD nonce (hex) — present ONLY once `status` is `approved`. */
|
|
84
|
+
nonce: string | null;
|
|
85
|
+
}
|
|
86
|
+
export declare const deviceTransferInfoResponseSchema: z.ZodType<DeviceTransferInfoResponse>;
|
|
87
|
+
/**
|
|
88
|
+
* Request body for `POST /identity/device-transfer/:pairingId/approve`
|
|
89
|
+
* (bearer-authenticated AND signature-proven). The `signature` covers
|
|
90
|
+
* `JSON.stringify({ action:'approve_device_transfer', pairingId, timestamp })`
|
|
91
|
+
* made with the caller's CURRENT identity key — dual-proof so a bearer token
|
|
92
|
+
* alone can never exfiltrate the private key.
|
|
93
|
+
*/
|
|
94
|
+
export declare const deviceTransferApproveRequestSchema: z.ZodObject<{
|
|
95
|
+
/** The old device's ephemeral secp256k1 public key (single-use). */
|
|
96
|
+
oldEphPub: z.ZodString;
|
|
97
|
+
/** AEAD ciphertext of `{ privateKey, publicKey }`, hex. */
|
|
98
|
+
ciphertext: z.ZodString;
|
|
99
|
+
/** AEAD nonce, hex (24 bytes). */
|
|
100
|
+
nonce: z.ZodString;
|
|
101
|
+
/** ECDSA (DER, hex) signature proving control of the CURRENT identity key. */
|
|
102
|
+
signature: z.ZodString;
|
|
103
|
+
/** Signing timestamp (ms since epoch) — freshness-checked server-side. */
|
|
104
|
+
timestamp: z.ZodNumber;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
signature: string;
|
|
107
|
+
nonce: string;
|
|
108
|
+
ciphertext: string;
|
|
109
|
+
oldEphPub: string;
|
|
110
|
+
timestamp: number;
|
|
111
|
+
}, {
|
|
112
|
+
signature: string;
|
|
113
|
+
nonce: string;
|
|
114
|
+
ciphertext: string;
|
|
115
|
+
oldEphPub: string;
|
|
116
|
+
timestamp: number;
|
|
117
|
+
}>;
|
|
118
|
+
export type DeviceTransferApproveRequest = z.infer<typeof deviceTransferApproveRequestSchema>;
|
|
119
|
+
export interface DeviceTransferApproveResponse {
|
|
120
|
+
success: boolean;
|
|
121
|
+
pairingId: string;
|
|
122
|
+
status: DevicePairingStatus;
|
|
123
|
+
}
|
|
124
|
+
export declare const deviceTransferApproveResponseSchema: z.ZodType<DeviceTransferApproveResponse>;
|
|
125
|
+
export interface DeviceTransferDenyResponse {
|
|
126
|
+
success: boolean;
|
|
127
|
+
pairingId: string;
|
|
128
|
+
status: DevicePairingStatus;
|
|
129
|
+
}
|
|
130
|
+
export declare const deviceTransferDenyResponseSchema: z.ZodType<DeviceTransferDenyResponse>;
|
|
@@ -169,16 +169,27 @@ export type DeviceSessionSync = z.infer<typeof deviceSessionSyncSchema>;
|
|
|
169
169
|
* possession of the secret IS the proof of device ownership. The server matches
|
|
170
170
|
* `sha256(deviceSecret)` against the device's stored `secretHash` (constant-time)
|
|
171
171
|
* and mints a short access token for the device's active account.
|
|
172
|
+
*
|
|
173
|
+
* `accountId` pins the mint to ONE account of that device instead of whichever
|
|
174
|
+
* account is currently active. It exists for identity-bound clients (Commons),
|
|
175
|
+
* whose authenticated user is determined by a local cryptographic key and must
|
|
176
|
+
* never follow an account switch made by another app on the same device. The
|
|
177
|
+
* account must already be a member of the device session; the mint NEVER
|
|
178
|
+
* mutates `activeAccountId`, so pinning is read-only with respect to the device
|
|
179
|
+
* state every other app observes.
|
|
172
180
|
*/
|
|
173
181
|
export declare const deviceTokenMintRequestSchema: z.ZodObject<{
|
|
174
182
|
deviceId: z.ZodString;
|
|
175
183
|
deviceSecret: z.ZodString;
|
|
184
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
176
185
|
}, "strip", z.ZodTypeAny, {
|
|
177
186
|
deviceId: string;
|
|
178
187
|
deviceSecret: string;
|
|
188
|
+
accountId?: string | undefined;
|
|
179
189
|
}, {
|
|
180
190
|
deviceId: string;
|
|
181
191
|
deviceSecret: string;
|
|
192
|
+
accountId?: string | undefined;
|
|
182
193
|
}>;
|
|
183
194
|
/**
|
|
184
195
|
* Wire shape of a successful `POST /session/device/token`: the freshly-minted
|
package/dist/types/index.d.ts
CHANGED
|
@@ -39,3 +39,7 @@ export { updatePlatformSchema, updateStatusSchema, updateAssetStatusSchema, sha2
|
|
|
39
39
|
export type { UpdatePlatform, UpdateStatus, UpdateAssetStatus, AssetInitItem, AssetInitRequest, AssetUploadTicket, AssetInitResponse, AssetCompleteRequest, AssetCompleteResultItem, AssetCompleteResponse, UpdateAssetRef, CreateUpdateRequest, Update, CreateUpdateResponse, RollbackToEmbeddedEntry, Channel, ChannelListResponse, UpdateListResponse, RollbackRequest, RollbackToEmbeddedRequest, PromoteRequest, UpdateRolloutPatch, } from './updates';
|
|
40
40
|
export { webauthnRegisterOptionsRequestSchema, webauthnLoginOptionsRequestSchema, webauthnRegisterVerifyRequestSchema, webauthnLoginVerifyRequestSchema, } from './webauthn';
|
|
41
41
|
export type { WebauthnRegisterOptionsRequest, WebauthnLoginOptionsRequest, WebauthnRegisterVerifyRequest, WebauthnLoginVerifyRequest, } from './webauthn';
|
|
42
|
+
export { devicePairingStatusSchema, deviceTransferInitRequestSchema, deviceTransferInitResponseSchema, deviceTransferInfoResponseSchema, deviceTransferApproveRequestSchema, deviceTransferApproveResponseSchema, deviceTransferDenyResponseSchema, } from './devicePairing';
|
|
43
|
+
export type { DevicePairingStatus, DeviceTransferInitRequest, DeviceTransferInitResponse, DeviceTransferInfoResponse, DeviceTransferApproveRequest, DeviceTransferApproveResponse, DeviceTransferDenyResponse, } from './devicePairing';
|
|
44
|
+
export { transparencyCheckpointSignatureSchema, transparencyAnchorSchema, transparencyCheckpointSchema, transparencyInclusionProofSchema, transparencyCheckpointListSchema, } from './transparency';
|
|
45
|
+
export type { TransparencyCheckpointSignature, TransparencyAnchor, TransparencyCheckpoint, TransparencyInclusionProof, TransparencyCheckpointList, } from './transparency';
|
|
@@ -61,17 +61,17 @@ export declare const encryptedBackupEnvelopeSchema: z.ZodObject<{
|
|
|
61
61
|
}, "strip", z.ZodTypeAny, {
|
|
62
62
|
version: number;
|
|
63
63
|
nonce: string;
|
|
64
|
+
ciphertext: string;
|
|
64
65
|
algorithm: "xchacha20poly1305";
|
|
65
66
|
kdfInfo: string;
|
|
66
|
-
ciphertext: string;
|
|
67
67
|
publicKeyHint: string;
|
|
68
68
|
createdAt: string;
|
|
69
69
|
}, {
|
|
70
70
|
version: number;
|
|
71
71
|
nonce: string;
|
|
72
|
+
ciphertext: string;
|
|
72
73
|
algorithm: "xchacha20poly1305";
|
|
73
74
|
kdfInfo: string;
|
|
74
|
-
ciphertext: string;
|
|
75
75
|
publicKeyHint: string;
|
|
76
76
|
createdAt: string;
|
|
77
77
|
}>;
|
|
@@ -100,18 +100,18 @@ export declare const backupUploadRequestSchema: z.ZodObject<{
|
|
|
100
100
|
}, "strip", z.ZodTypeAny, {
|
|
101
101
|
version: number;
|
|
102
102
|
nonce: string;
|
|
103
|
+
ciphertext: string;
|
|
103
104
|
algorithm: "xchacha20poly1305";
|
|
104
105
|
kdfInfo: string;
|
|
105
|
-
ciphertext: string;
|
|
106
106
|
publicKeyHint: string;
|
|
107
107
|
createdAt: string;
|
|
108
108
|
lookupId: string;
|
|
109
109
|
}, {
|
|
110
110
|
version: number;
|
|
111
111
|
nonce: string;
|
|
112
|
+
ciphertext: string;
|
|
112
113
|
algorithm: "xchacha20poly1305";
|
|
113
114
|
kdfInfo: string;
|
|
114
|
-
ciphertext: string;
|
|
115
115
|
publicKeyHint: string;
|
|
116
116
|
createdAt: string;
|
|
117
117
|
lookupId: string;
|
|
@@ -72,17 +72,17 @@ export declare const rotateKeyCompleteRequestSchema: z.ZodObject<{
|
|
|
72
72
|
signOutEverywhere: z.ZodOptional<z.ZodBoolean>;
|
|
73
73
|
}, "strip", z.ZodTypeAny, {
|
|
74
74
|
signature: string;
|
|
75
|
+
timestamp: number;
|
|
75
76
|
challenge: string;
|
|
76
77
|
newPublicKey: string;
|
|
77
78
|
newKeyProof: string;
|
|
78
|
-
timestamp: number;
|
|
79
79
|
signOutEverywhere?: boolean | undefined;
|
|
80
80
|
}, {
|
|
81
81
|
signature: string;
|
|
82
|
+
timestamp: number;
|
|
82
83
|
challenge: string;
|
|
83
84
|
newPublicKey: string;
|
|
84
85
|
newKeyProof: string;
|
|
85
|
-
timestamp: number;
|
|
86
86
|
signOutEverywhere?: boolean | undefined;
|
|
87
87
|
}>;
|
|
88
88
|
export type RotateKeyCompleteRequest = z.infer<typeof rotateKeyCompleteRequestSchema>;
|
|
@@ -113,6 +113,14 @@ export type PublicApplicationResponse = z.infer<typeof publicApplicationSchema>;
|
|
|
113
113
|
* current producer and are never `null`, but stay `.optional()` so the contract
|
|
114
114
|
* tolerates leaner shapes from other producers of this same payload without a
|
|
115
115
|
* coordinated bump.
|
|
116
|
+
*
|
|
117
|
+
* `pushSentAt` / `openedAt` are DELIVERY PROGRESS, not authorization state: they
|
|
118
|
+
* let a waiting surface render "Check Commons on your phone" → "Opened in
|
|
119
|
+
* Commons" without inventing competing statuses. `status` remains the only
|
|
120
|
+
* authority on whether the request is pending, authorized, cancelled or expired.
|
|
121
|
+
* Both are `.nullable().optional()` for the same reason as `sessionId` — the
|
|
122
|
+
* producer always emits the key with `null` until that step happens, and an
|
|
123
|
+
* older API that omits them entirely must degrade, not fail the parse.
|
|
116
124
|
*/
|
|
117
125
|
export declare const sessionStatusSchema: z.ZodObject<{
|
|
118
126
|
status: z.ZodString;
|
|
@@ -162,6 +170,13 @@ export declare const sessionStatusSchema: z.ZodObject<{
|
|
|
162
170
|
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
163
171
|
publicKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
164
172
|
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
173
|
+
/**
|
|
174
|
+
* What approving this request does. Legacy rows read as `device_sign_in`.
|
|
175
|
+
* OAuth-bound sessions finalize into an authorization code (no `sessionId`).
|
|
176
|
+
*/
|
|
177
|
+
purpose: z.ZodOptional<z.ZodEnum<["device_sign_in", "oauth_authorization"]>>;
|
|
178
|
+
pushSentAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
179
|
+
openedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
165
180
|
}, "strip", z.ZodTypeAny, {
|
|
166
181
|
status: string;
|
|
167
182
|
publicKey?: string | null | undefined;
|
|
@@ -184,6 +199,9 @@ export declare const sessionStatusSchema: z.ZodObject<{
|
|
|
184
199
|
termsUrl?: string | undefined;
|
|
185
200
|
developerName?: string | undefined;
|
|
186
201
|
} | null | undefined;
|
|
202
|
+
purpose?: "device_sign_in" | "oauth_authorization" | undefined;
|
|
203
|
+
pushSentAt?: string | null | undefined;
|
|
204
|
+
openedAt?: string | null | undefined;
|
|
187
205
|
}, {
|
|
188
206
|
status: string;
|
|
189
207
|
publicKey?: string | null | undefined;
|
|
@@ -206,5 +224,8 @@ export declare const sessionStatusSchema: z.ZodObject<{
|
|
|
206
224
|
termsUrl?: string | undefined;
|
|
207
225
|
developerName?: string | undefined;
|
|
208
226
|
} | null | undefined;
|
|
227
|
+
purpose?: "device_sign_in" | "oauth_authorization" | undefined;
|
|
228
|
+
pushSentAt?: string | null | undefined;
|
|
229
|
+
openedAt?: string | null | undefined;
|
|
209
230
|
}>;
|
|
210
231
|
export type SessionStatusResponse = z.infer<typeof sessionStatusSchema>;
|
|
@@ -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>;
|