@ixo/action-protocol 0.0.0-stage → 0.5.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/CHANGELOG.md +46 -0
- package/README.md +99 -2
- package/package.json +30 -4
- package/src/index.d.ts +559 -0
- package/src/index.js +1335 -0
- package/src/operation-schema.js +181 -0
- package/src/outcome-signature.js +217 -0
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
export type FormField = {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
type: "text" | "email" | "tel" | "textarea";
|
|
5
|
+
required: boolean;
|
|
6
|
+
value: string;
|
|
7
|
+
source: "user" | "record" | "suggestion";
|
|
8
|
+
};
|
|
9
|
+
export type ActionOperationV1 =
|
|
10
|
+
| P2Operation
|
|
11
|
+
| {
|
|
12
|
+
kind: "form.submit.v1";
|
|
13
|
+
formId: string;
|
|
14
|
+
destination: string;
|
|
15
|
+
fields: FormField[];
|
|
16
|
+
declaration: string | null;
|
|
17
|
+
}
|
|
18
|
+
| {
|
|
19
|
+
kind: "ixo.bank.send.v1";
|
|
20
|
+
chainId: string;
|
|
21
|
+
network: "ixo mainnet" | "ixo testnet" | "ixo devnet";
|
|
22
|
+
fromAddress: string;
|
|
23
|
+
toAddress: string;
|
|
24
|
+
amountBaseUnits: string;
|
|
25
|
+
/** Any bank denom (0.3.0); parseOperation fills "uixo" when absent. */
|
|
26
|
+
denom: string;
|
|
27
|
+
/** Optional since 0.3.0 and ignored by the Hub (it simulates the fee). */
|
|
28
|
+
feeBaseUnits?: string;
|
|
29
|
+
memo: string;
|
|
30
|
+
}
|
|
31
|
+
| {
|
|
32
|
+
kind: "resource.read.v1";
|
|
33
|
+
resourceId: string;
|
|
34
|
+
ownerDid: string;
|
|
35
|
+
url: string;
|
|
36
|
+
version: string;
|
|
37
|
+
contentDigest: string;
|
|
38
|
+
};
|
|
39
|
+
export type ActionReferenceV1 = {
|
|
40
|
+
version: "ixo.auth-action/1";
|
|
41
|
+
id: string;
|
|
42
|
+
accountId: string;
|
|
43
|
+
bindingId: string;
|
|
44
|
+
bindingRevision: number;
|
|
45
|
+
revision: number;
|
|
46
|
+
digest: string;
|
|
47
|
+
url: string;
|
|
48
|
+
expiresAt: number;
|
|
49
|
+
title: string;
|
|
50
|
+
};
|
|
51
|
+
export type ActionReceiptV1 =
|
|
52
|
+
| P2Receipt
|
|
53
|
+
| {
|
|
54
|
+
kind: "form.submission.v1";
|
|
55
|
+
actionId: string;
|
|
56
|
+
revision: number;
|
|
57
|
+
digest: string;
|
|
58
|
+
valuesDigest: string;
|
|
59
|
+
submittedAt: number;
|
|
60
|
+
submissionId: string;
|
|
61
|
+
}
|
|
62
|
+
| {
|
|
63
|
+
kind: "ixo.bank.send.v1";
|
|
64
|
+
actionId: string;
|
|
65
|
+
revision: number;
|
|
66
|
+
digest: string;
|
|
67
|
+
chainId: string;
|
|
68
|
+
txHash: string;
|
|
69
|
+
height: number | null;
|
|
70
|
+
code: number | null;
|
|
71
|
+
/**
|
|
72
|
+
* Present only when the signed tx was never included in a block
|
|
73
|
+
* (`height` is null): `check_tx_rejected` carries the CheckTx `code`,
|
|
74
|
+
* `expired_not_included` has `code: null` (timeout height passed).
|
|
75
|
+
*/
|
|
76
|
+
reason?: "check_tx_rejected" | "expired_not_included";
|
|
77
|
+
/** 0.3.0: the denom and base-unit amount that moved. */
|
|
78
|
+
denom?: string;
|
|
79
|
+
amountBaseUnits?: string;
|
|
80
|
+
};
|
|
81
|
+
export type ActionOutcomeStatus =
|
|
82
|
+
| "authorized"
|
|
83
|
+
| "declined"
|
|
84
|
+
| "submitted"
|
|
85
|
+
| "succeeded"
|
|
86
|
+
| "failed"
|
|
87
|
+
| "unknown"
|
|
88
|
+
/** v2 only: the action expired before it executed. */
|
|
89
|
+
| "expired"
|
|
90
|
+
/** v2 only: the action was withdrawn (superseded / requires review) before it executed. */
|
|
91
|
+
| "cancelled";
|
|
92
|
+
export type ActionOutcomeV1 = {
|
|
93
|
+
version: "ixo.auth-outcome/1" | "ixo.auth-outcome/2";
|
|
94
|
+
eventId: string;
|
|
95
|
+
reference: ActionReferenceV1;
|
|
96
|
+
ownerDid: string;
|
|
97
|
+
authorizedRevision: number;
|
|
98
|
+
authorizedDigest: string;
|
|
99
|
+
sequence: number;
|
|
100
|
+
status: ActionOutcomeStatus;
|
|
101
|
+
receipt: ActionReceiptV1 | null;
|
|
102
|
+
occurredAt: number;
|
|
103
|
+
};
|
|
104
|
+
export type ActionReviewView = {
|
|
105
|
+
reference: ActionReferenceV1;
|
|
106
|
+
requester: string;
|
|
107
|
+
operation: ActionOperationV1;
|
|
108
|
+
reviewStatus:
|
|
109
|
+
| "prepared"
|
|
110
|
+
| "superseded"
|
|
111
|
+
| "declined"
|
|
112
|
+
| "expired"
|
|
113
|
+
| "revoked"
|
|
114
|
+
| "signing"
|
|
115
|
+
| "authorized";
|
|
116
|
+
operationStatus:
|
|
117
|
+
| "awaiting_authorization"
|
|
118
|
+
| "admitted"
|
|
119
|
+
| "submitted"
|
|
120
|
+
| "succeeded"
|
|
121
|
+
| "failed"
|
|
122
|
+
| "requires_review"
|
|
123
|
+
| "unknown"
|
|
124
|
+
/** Terminal: nothing was executed (for example the owner declined). */
|
|
125
|
+
| "not_started";
|
|
126
|
+
revision: number;
|
|
127
|
+
digest: string;
|
|
128
|
+
canEdit: boolean;
|
|
129
|
+
canApprove: boolean;
|
|
130
|
+
canSign: boolean;
|
|
131
|
+
receipt: ActionReceiptV1 | null;
|
|
132
|
+
signedTxHash: string | null;
|
|
133
|
+
resourceUrl: string | null;
|
|
134
|
+
chatUrl: string;
|
|
135
|
+
service?: {
|
|
136
|
+
continuationUrl: string | null;
|
|
137
|
+
accountLabel: string | null;
|
|
138
|
+
resource: ResourceDescriptor | null;
|
|
139
|
+
} | null;
|
|
140
|
+
/** 0.3.0: Hub-computed transfer display (bank sends only). */
|
|
141
|
+
transfer?: TransferDisplay | null;
|
|
142
|
+
};
|
|
143
|
+
export type TransferDisplay = {
|
|
144
|
+
denom: string;
|
|
145
|
+
symbol: string;
|
|
146
|
+
decimals: number;
|
|
147
|
+
/**
|
|
148
|
+
* true only for uixo and ibc/ denoms with metadata. false: the symbol and
|
|
149
|
+
* decimals are not trusted (decimals is 0, amountDisplay is base units);
|
|
150
|
+
* show the full denom and an "unverified token" marker.
|
|
151
|
+
*/
|
|
152
|
+
verified: boolean;
|
|
153
|
+
amountDisplay: string;
|
|
154
|
+
feeBaseUnits: string;
|
|
155
|
+
feeDenom: "uixo";
|
|
156
|
+
feeDisplay: string;
|
|
157
|
+
gasLimit: number;
|
|
158
|
+
/** The fee granter frozen into the SignDoc, or null when the user pays. */
|
|
159
|
+
feeGranter: string | null;
|
|
160
|
+
};
|
|
161
|
+
export type ActionCapabilitiesV1 = {
|
|
162
|
+
version: "ixo.auth-capabilities/1" | "ixo.auth-capabilities/2";
|
|
163
|
+
accountId: string;
|
|
164
|
+
oracleDid: string;
|
|
165
|
+
network: "ixo mainnet" | "ixo testnet" | "ixo devnet" | null;
|
|
166
|
+
resourceOrigin: string | null;
|
|
167
|
+
operations: ActionOperationV1["kind"][];
|
|
168
|
+
forms: {
|
|
169
|
+
formId: string;
|
|
170
|
+
destination: string;
|
|
171
|
+
fields: Omit<FormField, "value" | "source">[];
|
|
172
|
+
declaration: string | null;
|
|
173
|
+
}[];
|
|
174
|
+
transfer:
|
|
175
|
+
| { maxAmountUixo: string; maxFeeUixo: string }
|
|
176
|
+
| {
|
|
177
|
+
/** Optional per-denom amount caps (empty = no cap). */
|
|
178
|
+
limits: { denom: string; maxAmountBaseUnits: string }[];
|
|
179
|
+
/** The Hub-wide simulated-fee ceiling. */
|
|
180
|
+
maxFeeUixo?: string;
|
|
181
|
+
}
|
|
182
|
+
| null;
|
|
183
|
+
};
|
|
184
|
+
export declare function canonicalJson(value: unknown): string;
|
|
185
|
+
export declare function digestOf(value: unknown): Promise<string>;
|
|
186
|
+
export declare function parseOperation(value: unknown): ActionOperationV1;
|
|
187
|
+
export declare function parseReference(value: unknown): ActionReferenceV1;
|
|
188
|
+
export declare function assertHubReferenceUrl(
|
|
189
|
+
value: unknown,
|
|
190
|
+
configuredOrigin: string,
|
|
191
|
+
): ActionReferenceV1;
|
|
192
|
+
export declare function parseReceipt(value: unknown): ActionReceiptV1;
|
|
193
|
+
export declare function parseOutcome(value: unknown): ActionOutcomeV1;
|
|
194
|
+
export declare function parseReviewView(value: unknown): ActionReviewView;
|
|
195
|
+
export declare function parseCapabilities(value: unknown): ActionCapabilitiesV1;
|
|
196
|
+
|
|
197
|
+
export type GmailOperation =
|
|
198
|
+
| {
|
|
199
|
+
kind: "gmail.connect.v1";
|
|
200
|
+
purpose: string;
|
|
201
|
+
connectionId: string | null;
|
|
202
|
+
accountLabel: string | null;
|
|
203
|
+
scopes: string[];
|
|
204
|
+
}
|
|
205
|
+
| { kind: "gmail.disconnect.v1"; connectionId: string; accountLabel: string }
|
|
206
|
+
| {
|
|
207
|
+
kind: "gmail.message.send.v1";
|
|
208
|
+
connectionId: string;
|
|
209
|
+
accountLabel: string;
|
|
210
|
+
to: string;
|
|
211
|
+
subject: string;
|
|
212
|
+
body: string;
|
|
213
|
+
};
|
|
214
|
+
export type P2Operation =
|
|
215
|
+
| GmailOperation
|
|
216
|
+
| {
|
|
217
|
+
kind: "statement.sign.v1";
|
|
218
|
+
statement: string;
|
|
219
|
+
purpose: string;
|
|
220
|
+
audienceId: string;
|
|
221
|
+
}
|
|
222
|
+
| {
|
|
223
|
+
kind: "calendar.connect.v1";
|
|
224
|
+
purpose: string;
|
|
225
|
+
connectionId: string | null;
|
|
226
|
+
accountLabel: string | null;
|
|
227
|
+
scopes: string[];
|
|
228
|
+
}
|
|
229
|
+
| {
|
|
230
|
+
kind: "calendar.disconnect.v1";
|
|
231
|
+
connectionId: string;
|
|
232
|
+
accountLabel: string;
|
|
233
|
+
}
|
|
234
|
+
| {
|
|
235
|
+
kind: "calendar.event.create.v1";
|
|
236
|
+
connectionId: string;
|
|
237
|
+
accountLabel: string;
|
|
238
|
+
calendarId: "primary";
|
|
239
|
+
title: string;
|
|
240
|
+
description: string;
|
|
241
|
+
startsAt: string;
|
|
242
|
+
endsAt: string;
|
|
243
|
+
timeZone: string;
|
|
244
|
+
}
|
|
245
|
+
| {
|
|
246
|
+
kind: "vfs.access.request.v1";
|
|
247
|
+
targetId: string;
|
|
248
|
+
title: string;
|
|
249
|
+
ability: "read";
|
|
250
|
+
purpose: string;
|
|
251
|
+
}
|
|
252
|
+
| { kind: "vfs.text.save.v1"; filename: string; text: string };
|
|
253
|
+
export type ActionOperation = ActionOperationV1;
|
|
254
|
+
export type ActionReceipt = ActionReceiptV1;
|
|
255
|
+
export type ServiceName = "calendar" | "gmail" | "vfs";
|
|
256
|
+
export type ReceiptTuple = {
|
|
257
|
+
actionId: string;
|
|
258
|
+
revision: number;
|
|
259
|
+
digest: string;
|
|
260
|
+
};
|
|
261
|
+
export type GmailReceipt = ReceiptTuple &
|
|
262
|
+
(
|
|
263
|
+
| {
|
|
264
|
+
kind: "gmail.connected.v1";
|
|
265
|
+
connectionId: string;
|
|
266
|
+
scopesDigest: string;
|
|
267
|
+
verifiedAt: number;
|
|
268
|
+
}
|
|
269
|
+
| {
|
|
270
|
+
kind: "gmail.disconnected.v1";
|
|
271
|
+
connectionId: string;
|
|
272
|
+
localRevokedAt: number;
|
|
273
|
+
providerDisconnected: boolean | null;
|
|
274
|
+
verifiedAt: number;
|
|
275
|
+
}
|
|
276
|
+
| {
|
|
277
|
+
kind: "gmail.message.accepted.v1";
|
|
278
|
+
connectionId: string;
|
|
279
|
+
messageId: string;
|
|
280
|
+
contentDigest: string;
|
|
281
|
+
mimeDigest: string;
|
|
282
|
+
acceptedAt: number;
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
export type P2Receipt =
|
|
286
|
+
| GmailReceipt
|
|
287
|
+
| (ReceiptTuple &
|
|
288
|
+
(
|
|
289
|
+
| {
|
|
290
|
+
kind: "statement.signed.v1";
|
|
291
|
+
statementDigest: string;
|
|
292
|
+
proofDigest: string;
|
|
293
|
+
signerDid: string;
|
|
294
|
+
signedAt: number;
|
|
295
|
+
}
|
|
296
|
+
| {
|
|
297
|
+
kind: "calendar.connected.v1";
|
|
298
|
+
connectionId: string;
|
|
299
|
+
scopesDigest: string;
|
|
300
|
+
verifiedAt: number;
|
|
301
|
+
}
|
|
302
|
+
| {
|
|
303
|
+
kind: "calendar.disconnected.v1";
|
|
304
|
+
connectionId: string;
|
|
305
|
+
localRevokedAt: number;
|
|
306
|
+
providerDisconnected: boolean | null;
|
|
307
|
+
verifiedAt: number;
|
|
308
|
+
}
|
|
309
|
+
| {
|
|
310
|
+
kind: "calendar.event.created.v1";
|
|
311
|
+
connectionId: string;
|
|
312
|
+
eventId: string;
|
|
313
|
+
eventDigest: string;
|
|
314
|
+
verifiedAt: number;
|
|
315
|
+
}
|
|
316
|
+
| {
|
|
317
|
+
kind: "vfs.access.requested.v1";
|
|
318
|
+
requestId: string;
|
|
319
|
+
targetId: string;
|
|
320
|
+
state: "pending_owner";
|
|
321
|
+
requestedAt: number;
|
|
322
|
+
}
|
|
323
|
+
| {
|
|
324
|
+
kind: "vfs.text.saved.v1";
|
|
325
|
+
fileId: string;
|
|
326
|
+
cid: string;
|
|
327
|
+
version: number;
|
|
328
|
+
contentDigest: string;
|
|
329
|
+
private: true;
|
|
330
|
+
verifiedAt: number;
|
|
331
|
+
}
|
|
332
|
+
| {
|
|
333
|
+
kind: "service.failure.v1";
|
|
334
|
+
service: ServiceName;
|
|
335
|
+
code:
|
|
336
|
+
| "permission_denied"
|
|
337
|
+
| "changed"
|
|
338
|
+
| "rejected"
|
|
339
|
+
| "conflict"
|
|
340
|
+
| "expired"
|
|
341
|
+
| "unavailable";
|
|
342
|
+
failedAt: number;
|
|
343
|
+
}
|
|
344
|
+
));
|
|
345
|
+
export type ResourceDescriptor = {
|
|
346
|
+
id: string;
|
|
347
|
+
title: string;
|
|
348
|
+
ownerDid: string;
|
|
349
|
+
url: string;
|
|
350
|
+
version: string;
|
|
351
|
+
contentDigest: string;
|
|
352
|
+
cid: string;
|
|
353
|
+
fileId: string;
|
|
354
|
+
};
|
|
355
|
+
export type ServiceAuthorizationV1 = ReceiptTuple & {
|
|
356
|
+
version: "ixo.auth-authorization/1";
|
|
357
|
+
mode: "prepare" | "execute";
|
|
358
|
+
service: ServiceName;
|
|
359
|
+
hubOrigin: string;
|
|
360
|
+
accountId: string;
|
|
361
|
+
ownerDid: string;
|
|
362
|
+
oracleDid: string;
|
|
363
|
+
bindingId: string;
|
|
364
|
+
bindingRevision: number;
|
|
365
|
+
consentVersion: string;
|
|
366
|
+
policyVersion: number;
|
|
367
|
+
network: "mainnet" | "testnet" | "devnet";
|
|
368
|
+
operation: ActionOperationV1;
|
|
369
|
+
issuedAt: number;
|
|
370
|
+
expiresAt: number;
|
|
371
|
+
nonce: string;
|
|
372
|
+
};
|
|
373
|
+
export type ServiceCommand = {
|
|
374
|
+
authorization: ServiceAuthorizationV1;
|
|
375
|
+
ownerInvocation: string;
|
|
376
|
+
subscriptionDelegation: string | null;
|
|
377
|
+
};
|
|
378
|
+
export type ServiceCommandV1 = ServiceCommand;
|
|
379
|
+
export type ServicePreparationV1 = ReceiptTuple & {
|
|
380
|
+
version: "ixo.auth-preparation/1";
|
|
381
|
+
accountId: string;
|
|
382
|
+
status: "pending" | "ready" | "unknown";
|
|
383
|
+
operation: Extract<
|
|
384
|
+
ActionOperationV1,
|
|
385
|
+
{ kind: "calendar.connect.v1" | "gmail.connect.v1" }
|
|
386
|
+
>;
|
|
387
|
+
continuationUrl: string | null;
|
|
388
|
+
};
|
|
389
|
+
export type ServiceResultV1 = ReceiptTuple & {
|
|
390
|
+
version: "ixo.auth-service-result/1";
|
|
391
|
+
accountId: string;
|
|
392
|
+
authorizationDigest: string;
|
|
393
|
+
sequence: number;
|
|
394
|
+
status: "pending" | "succeeded" | "failed" | "unknown";
|
|
395
|
+
receipt: ActionReceiptV1 | null;
|
|
396
|
+
continuationUrl: string | null;
|
|
397
|
+
accountLabel: string | null;
|
|
398
|
+
resource: ResourceDescriptor | null;
|
|
399
|
+
checkedAt: number;
|
|
400
|
+
};
|
|
401
|
+
export type HubActionOptionsV1 = {
|
|
402
|
+
version: "ixo.auth-options/1";
|
|
403
|
+
accountId: string;
|
|
404
|
+
ownerDid: string;
|
|
405
|
+
bindingId: string;
|
|
406
|
+
bindingRevision: number;
|
|
407
|
+
connections: { id: string; label: string; scopes: string[] }[];
|
|
408
|
+
targets: { id: string; title: string }[];
|
|
409
|
+
resources: ResourceDescriptor[];
|
|
410
|
+
};
|
|
411
|
+
export type HubActionOptionsV2 = Omit<
|
|
412
|
+
HubActionOptionsV1,
|
|
413
|
+
"version" | "connections"
|
|
414
|
+
> & {
|
|
415
|
+
version: "ixo.auth-options/2";
|
|
416
|
+
connections: {
|
|
417
|
+
service: "calendar" | "gmail";
|
|
418
|
+
id: string;
|
|
419
|
+
label: string;
|
|
420
|
+
scopes: string[];
|
|
421
|
+
}[];
|
|
422
|
+
};
|
|
423
|
+
/** 0.5.0: one owner bank balance with the Hub's trusted display. */
|
|
424
|
+
export type OptionsToken = {
|
|
425
|
+
denom: string;
|
|
426
|
+
symbol: string;
|
|
427
|
+
decimals: number;
|
|
428
|
+
/** false: untrusted metadata (decimals 0, base units); name the full denom. */
|
|
429
|
+
verified: boolean;
|
|
430
|
+
balanceBaseUnits: string;
|
|
431
|
+
};
|
|
432
|
+
export type HubActionOptionsV3 = Omit<HubActionOptionsV2, "version"> & {
|
|
433
|
+
version: "ixo.auth-options/3";
|
|
434
|
+
/** null when bank sends are off for the account, the owner has no address, or the chain did not answer. */
|
|
435
|
+
transfer: { tokens: OptionsToken[] } | null;
|
|
436
|
+
};
|
|
437
|
+
export type HubActionOptions =
|
|
438
|
+
| HubActionOptionsV1
|
|
439
|
+
| HubActionOptionsV2
|
|
440
|
+
| HubActionOptionsV3;
|
|
441
|
+
export declare function parseOptionsTransfer(input: unknown): {
|
|
442
|
+
tokens: OptionsToken[];
|
|
443
|
+
};
|
|
444
|
+
export type StatementProofBody = ReceiptTuple & {
|
|
445
|
+
version: "ixo.statement-proof/1";
|
|
446
|
+
accountId: string;
|
|
447
|
+
ownerDid: string;
|
|
448
|
+
network: "mainnet" | "testnet" | "devnet";
|
|
449
|
+
audience: string;
|
|
450
|
+
purpose: string;
|
|
451
|
+
statementDigest: string;
|
|
452
|
+
issuedAt: number;
|
|
453
|
+
nonce: string;
|
|
454
|
+
};
|
|
455
|
+
export type StatementProof = {
|
|
456
|
+
body: StatementProofBody;
|
|
457
|
+
publicKey: string;
|
|
458
|
+
signature: string;
|
|
459
|
+
statement: string;
|
|
460
|
+
};
|
|
461
|
+
export declare const operationKinds: readonly [
|
|
462
|
+
ActionOperationV1["kind"],
|
|
463
|
+
...ActionOperationV1["kind"][],
|
|
464
|
+
];
|
|
465
|
+
export declare const operationJsonSchema: {
|
|
466
|
+
readonly $schema: string;
|
|
467
|
+
readonly oneOf: Record<string, unknown>[];
|
|
468
|
+
};
|
|
469
|
+
export declare function privateTextPath(
|
|
470
|
+
actionId: string,
|
|
471
|
+
filename: string,
|
|
472
|
+
): string;
|
|
473
|
+
export declare function serviceForOperation(
|
|
474
|
+
operation: ActionOperationV1 | ActionOperationV1["kind"],
|
|
475
|
+
): ServiceName | null;
|
|
476
|
+
export declare function assertReceiptForOperation(
|
|
477
|
+
operation: ActionOperationV1,
|
|
478
|
+
receipt: ActionReceiptV1,
|
|
479
|
+
status?: string,
|
|
480
|
+
): ActionReceiptV1;
|
|
481
|
+
export declare function parseResourceDescriptor(
|
|
482
|
+
input: unknown,
|
|
483
|
+
): ResourceDescriptor;
|
|
484
|
+
export declare function parseServiceAuthorization(
|
|
485
|
+
input: unknown,
|
|
486
|
+
): ServiceAuthorizationV1;
|
|
487
|
+
export declare function parseServiceCommand(input: unknown): ServiceCommand;
|
|
488
|
+
export declare function parseServicePreparation(
|
|
489
|
+
input: unknown,
|
|
490
|
+
): ServicePreparationV1;
|
|
491
|
+
export declare function parseServiceResult(input: unknown): ServiceResultV1;
|
|
492
|
+
export declare function parseActionOptions(input: unknown): HubActionOptions;
|
|
493
|
+
export declare const parseHubActionOptions: typeof parseActionOptions;
|
|
494
|
+
export declare function parseStatementProofBody(
|
|
495
|
+
input: unknown,
|
|
496
|
+
): StatementProofBody;
|
|
497
|
+
export declare function parseStatementProof(input: unknown): StatementProof;
|
|
498
|
+
export declare const OUTCOME_VERSION_V1: "ixo.auth-outcome/1";
|
|
499
|
+
export declare const OUTCOME_VERSION_V2: "ixo.auth-outcome/2";
|
|
500
|
+
export declare const CAPABILITIES_VERSION_V1: "ixo.auth-capabilities/1";
|
|
501
|
+
export declare const CAPABILITIES_VERSION_V2: "ixo.auth-capabilities/2";
|
|
502
|
+
export declare const OUTCOME_SEQUENCE: Readonly<Record<ActionOutcomeStatus, number>>;
|
|
503
|
+
export declare const BANK_NOT_INCLUDED_REASONS: readonly [
|
|
504
|
+
"check_tx_rejected",
|
|
505
|
+
"expired_not_included",
|
|
506
|
+
];
|
|
507
|
+
/** The outcome in the caller's envelope version, or null when v1 cannot express it. */
|
|
508
|
+
export declare function outcomeForVersion(
|
|
509
|
+
value: unknown,
|
|
510
|
+
version: "ixo.auth-outcome/1" | "ixo.auth-outcome/2",
|
|
511
|
+
): ActionOutcomeV1 | null;
|
|
512
|
+
/** Operation kinds a v1 capabilities envelope may list (the 0.1.0 set). */
|
|
513
|
+
export declare const V1_OPERATION_KINDS: readonly [
|
|
514
|
+
"form.submit.v1",
|
|
515
|
+
"ixo.bank.send.v1",
|
|
516
|
+
"resource.read.v1",
|
|
517
|
+
];
|
|
518
|
+
export declare const NETWORKS: readonly ["ixo mainnet", "ixo testnet", "ixo devnet"];
|
|
519
|
+
export declare const SERVICE_NETWORKS: readonly ["mainnet", "testnet", "devnet"];
|
|
520
|
+
export declare const DENOM: RegExp;
|
|
521
|
+
export declare function parseTransferDisplay(value: unknown): TransferDisplay;
|
|
522
|
+
export declare const OUTCOME_SIGNATURE_HEADERS: Readonly<{
|
|
523
|
+
timestamp: "x-auth-hub-timestamp";
|
|
524
|
+
keyId: "x-auth-hub-key-id";
|
|
525
|
+
signature: "x-auth-hub-signature";
|
|
526
|
+
}>;
|
|
527
|
+
export declare const OUTCOME_SIGNATURE_MAX_SKEW_SECONDS: 300;
|
|
528
|
+
/** Validates an exact https origin (the receiver's audience) and returns it. */
|
|
529
|
+
export declare function outcomeAudience(value: string): string;
|
|
530
|
+
export declare function outcomeSigningPayload(
|
|
531
|
+
timestamp: number,
|
|
532
|
+
audience: string,
|
|
533
|
+
rawBody: string | Uint8Array,
|
|
534
|
+
): Promise<Uint8Array>;
|
|
535
|
+
export declare function signOutcomeRequest(input: {
|
|
536
|
+
privateKey: CryptoKey;
|
|
537
|
+
keyId: string;
|
|
538
|
+
/** The receiving oracle's https origin. */
|
|
539
|
+
audience: string;
|
|
540
|
+
rawBody: string | Uint8Array;
|
|
541
|
+
timestamp?: number;
|
|
542
|
+
}): Promise<Record<string, string>>;
|
|
543
|
+
export declare function verifyOutcomeRequest(input: {
|
|
544
|
+
rawBody: string | Uint8Array;
|
|
545
|
+
headers: Headers | Record<string, string | undefined>;
|
|
546
|
+
publicKey: Uint8Array | CryptoKey;
|
|
547
|
+
expectedKeyId: string;
|
|
548
|
+
/** The receiver's own public https origin, from configuration (required). */
|
|
549
|
+
expectedAudience: string;
|
|
550
|
+
now?: number;
|
|
551
|
+
maxSkewSeconds?: number;
|
|
552
|
+
}): Promise<boolean>;
|
|
553
|
+
export declare function ed25519PublicKeyFromMultibase(multibase: string): Uint8Array;
|
|
554
|
+
export declare function publicKeyFromDidDocument(
|
|
555
|
+
document: unknown,
|
|
556
|
+
keyId: string,
|
|
557
|
+
): Uint8Array;
|
|
558
|
+
/** The exact 0.1.0 receipt shape for v1 callers (drops the 0.3.0 bank fields). */
|
|
559
|
+
export declare function v1Receipt<T extends ActionReceiptV1 | null>(receipt: T): T;
|