@dopamint-fun/open-sdk 0.1.0-dev.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.
@@ -0,0 +1,139 @@
1
+ import { type SessionContext } from "./sessionWire.js";
2
+ export declare const SESSION_JOINED_TAG = 2;
3
+ export declare const PARTICIPANT_VIEW_TAG = 3;
4
+ export declare const ACTION_ACKNOWLEDGED_TAG = 5;
5
+ export declare const ACTION_PENDING_TAG = 6;
6
+ export declare const ACTION_REJECTED_TAG = 7;
7
+ export declare const ACTION_COMMITTED_TAG = 8;
8
+ export declare const SESSION_RESUMED_TAG = 11;
9
+ export declare const SESSION_TERMINAL_TAG = 12;
10
+ export declare const SESSION_ERROR_TAG = 13;
11
+ export declare const SEAT_AUTHORIZATION_CHALLENGE_TAG = 15;
12
+ export declare const SEAT_AUTHORIZATION_RESPONSE_TAG = 16;
13
+ export declare const MAX_TRANSPORT_FRAME_BYTES: number;
14
+ export interface WireEnvelope {
15
+ message: string;
16
+ }
17
+ export declare function encodeAckFrame(context: SessionContext, cursor: number | bigint | ResumeCursor): Uint8Array;
18
+ export declare function encodeEnvelope(wire: Uint8Array): WireEnvelope;
19
+ export declare function decodeEnvelope(envelope: WireEnvelope): Uint8Array;
20
+ export interface StateRef {
21
+ nonce: bigint;
22
+ commitment: Uint8Array;
23
+ }
24
+ export interface ReceiptRef {
25
+ digest: Uint8Array;
26
+ resultingState: StateRef;
27
+ }
28
+ export interface ResumeCursor {
29
+ sequence: bigint;
30
+ witnessedReceipt: ReceiptRef | null;
31
+ }
32
+ export interface ViewSnapshot {
33
+ state: StateRef;
34
+ participantView: Uint8Array;
35
+ participantViewSchema: number;
36
+ legalActions: Uint8Array;
37
+ legalActionsSchema: number;
38
+ participantDeadlineMs: bigint;
39
+ latestReceipt: ReceiptRef | null;
40
+ }
41
+ export interface SessionPolicy {
42
+ maxParticipantViewBytes: bigint;
43
+ maxActionPayloadBytes: bigint;
44
+ maxLegalActionSchemaBytes: bigint;
45
+ maxArtifactReferences: number;
46
+ maxUnacknowledgedEvents: bigint;
47
+ replayWindowEvents: bigint;
48
+ rateWindowMs: bigint;
49
+ maxActionsPerRateWindow: number;
50
+ actionBurst: number;
51
+ }
52
+ export interface SeatAuthChallenge {
53
+ context: SessionContext;
54
+ actionId: Uint8Array;
55
+ authorizationPayload: Uint8Array;
56
+ coordinatorProof: Uint8Array;
57
+ coordinatorPublicKey: Uint8Array;
58
+ }
59
+ export type AuthorityMessage = {
60
+ type: "sessionJoined";
61
+ context: SessionContext;
62
+ sequence: bigint;
63
+ policy: SessionPolicy;
64
+ view: ViewSnapshot;
65
+ cursor: ResumeCursor;
66
+ } | {
67
+ type: "participantView";
68
+ context: SessionContext;
69
+ sequence: bigint;
70
+ view: ViewSnapshot;
71
+ cursor: ResumeCursor;
72
+ } | {
73
+ type: "actionAcknowledged";
74
+ context: SessionContext;
75
+ sequence: bigint;
76
+ actionId: Uint8Array;
77
+ } | {
78
+ type: "actionPending";
79
+ context: SessionContext;
80
+ sequence: bigint;
81
+ } | {
82
+ type: "actionRejected";
83
+ context: SessionContext;
84
+ sequence: bigint;
85
+ actionId: Uint8Array;
86
+ view: ViewSnapshot;
87
+ cursor: ResumeCursor;
88
+ } | {
89
+ type: "actionCommitted";
90
+ context: SessionContext;
91
+ sequence: bigint;
92
+ actionId: Uint8Array;
93
+ view: ViewSnapshot;
94
+ cursor: ResumeCursor;
95
+ receipt: ReceiptRef;
96
+ } | {
97
+ type: "sessionResumed";
98
+ context: SessionContext;
99
+ sequence: bigint;
100
+ view: ViewSnapshot;
101
+ cursor: ResumeCursor;
102
+ } | {
103
+ type: "sessionTerminal";
104
+ context: SessionContext;
105
+ sequence: bigint;
106
+ disposition: number;
107
+ finalState: StateRef;
108
+ cursor: ResumeCursor;
109
+ finalReceipt: ReceiptRef | null;
110
+ } | {
111
+ type: "error";
112
+ retryable: boolean;
113
+ tag: number;
114
+ name: string;
115
+ } | {
116
+ type: "seatAuthorization";
117
+ challenge: SeatAuthChallenge;
118
+ };
119
+ export declare const SESSION_ERROR_NAMES: readonly string[];
120
+ /** The name behind a wire tag, or the tag itself where this build predates it. */
121
+ export declare function sessionErrorName(tag: number): string;
122
+ /** What a seat can do about a session error, where there is something.
123
+ *
124
+ * Two of these are how a second client on the same key shows up: the newer
125
+ * join supersedes the older binding, and the older client's next message
126
+ * finds its session gone. Both used to read as transport flakiness. */
127
+ export declare function sessionErrorHint(tag: number): string | null;
128
+ export declare function decodeAuthorityMessage(bytes: Uint8Array): AuthorityMessage;
129
+ export declare function encodeSeatAuthSuccessFrame(context: SessionContext, actionId: Uint8Array, signature: Uint8Array): Uint8Array;
130
+ export declare function extractProtocolInput(payload: Uint8Array): Uint8Array;
131
+ export declare function takePrincipalProof(bytes: Uint8Array): {
132
+ principalTag: number;
133
+ seat?: number;
134
+ role?: Uint8Array;
135
+ generation: Uint8Array;
136
+ scheme: number;
137
+ signature: Uint8Array;
138
+ rest: Uint8Array;
139
+ };
@@ -0,0 +1,373 @@
1
+ /* HTTP envelope and authority-message decode for the Participant Session.
2
+ *
3
+ * Participant send path reuses the signing bodies in sessionWire.ts and
4
+ * appends the signature. Authority messages are decoded just far enough for
5
+ * the seat loop: views, commits, terminal, errors, and seat-auth challenges.
6
+ */
7
+ import { ByteReader, ByteWriter } from "./bytes.js";
8
+ import { encodeContext } from "./sessionWire.js";
9
+ const AUTHORITY_EVENT_ACKNOWLEDGEMENT_TAG = 0x09;
10
+ export const SESSION_JOINED_TAG = 0x02;
11
+ export const PARTICIPANT_VIEW_TAG = 0x03;
12
+ export const ACTION_ACKNOWLEDGED_TAG = 0x05;
13
+ export const ACTION_PENDING_TAG = 0x06;
14
+ export const ACTION_REJECTED_TAG = 0x07;
15
+ export const ACTION_COMMITTED_TAG = 0x08;
16
+ export const SESSION_RESUMED_TAG = 0x0b;
17
+ export const SESSION_TERMINAL_TAG = 0x0c;
18
+ export const SESSION_ERROR_TAG = 0x0d;
19
+ export const SEAT_AUTHORIZATION_CHALLENGE_TAG = 0x0f;
20
+ export const SEAT_AUTHORIZATION_RESPONSE_TAG = 0x10;
21
+ export const MAX_TRANSPORT_FRAME_BYTES = 1 << 20;
22
+ export function encodeAckFrame(context, cursor) {
23
+ const sequence = typeof cursor === "object" ? cursor.sequence : cursor;
24
+ const receipt = typeof cursor === "object" ? cursor.witnessedReceipt : null;
25
+ const writer = new ByteWriter()
26
+ .pushU16(context.wireVersion)
27
+ .pushByte(AUTHORITY_EVENT_ACKNOWLEDGEMENT_TAG);
28
+ encodeContext(writer, context);
29
+ writer.pushU64(sequence);
30
+ if (receipt) {
31
+ writer
32
+ .pushByte(1)
33
+ .pushFixed(receipt.digest, 32, "receipt digest")
34
+ .pushU64(receipt.resultingState.nonce)
35
+ .pushFixed(receipt.resultingState.commitment, 32, "receipt resulting state");
36
+ }
37
+ else {
38
+ writer.pushByte(0);
39
+ }
40
+ return writer.bytes();
41
+ }
42
+ export function encodeEnvelope(wire) {
43
+ if (wire.length > MAX_TRANSPORT_FRAME_BYTES)
44
+ throw new Error("session frame exceeds transport ceiling");
45
+ return { message: Buffer.from(wire).toString("base64") };
46
+ }
47
+ export function decodeEnvelope(envelope) {
48
+ const wire = Buffer.from(envelope.message, "base64");
49
+ if (wire.length > MAX_TRANSPORT_FRAME_BYTES)
50
+ throw new Error("session frame exceeds transport ceiling");
51
+ return new Uint8Array(wire);
52
+ }
53
+ /* The authority's session-protocol error tags, by name.
54
+ *
55
+ * `arena-session/src/wire.rs` numbers `SessionProtocolError` on the wire and
56
+ * this side surfaced the number: "session error tag 6". Two agents met that
57
+ * message in one afternoon and both read it as a broken resume path. It was
58
+ * `UnknownSession` — and in their case the cause was the two of them joining
59
+ * the same seat with the same key, each join retiring the other's session.
60
+ * A name is what lets a reader look that up; the number sent them into the
61
+ * Rust source instead. */
62
+ export const SESSION_ERROR_NAMES = [
63
+ "UnsupportedWireVersion",
64
+ "UnsupportedSessionVersion",
65
+ "InvalidMessageTag",
66
+ "MalformedEncoding",
67
+ "ManifestMismatch",
68
+ "AuthenticationFailed",
69
+ "UnknownSession",
70
+ "InvalidResumeCursor",
71
+ "PayloadLimitExceeded",
72
+ "ServiceUnavailable",
73
+ "SessionSuperseded",
74
+ "ChallengeRequired",
75
+ ];
76
+ /** The name behind a wire tag, or the tag itself where this build predates it. */
77
+ export function sessionErrorName(tag) {
78
+ return SESSION_ERROR_NAMES[tag] ?? `unknown tag ${tag}`;
79
+ }
80
+ /** What a seat can do about a session error, where there is something.
81
+ *
82
+ * Two of these are how a second client on the same key shows up: the newer
83
+ * join supersedes the older binding, and the older client's next message
84
+ * finds its session gone. Both used to read as transport flakiness. */
85
+ export function sessionErrorHint(tag) {
86
+ switch (tag) {
87
+ case 6:
88
+ return "the authority no longer holds this session; join afresh — and if this repeats, another client may be joining this seat with the same key";
89
+ case 10:
90
+ return "a newer join replaced this seat's binding; another client is running with this key";
91
+ case 7:
92
+ return "the resume cursor is outside the replay window; join afresh rather than resuming";
93
+ case 11:
94
+ return "the join needs a fresh seat-auth challenge; fetch one and retry";
95
+ default:
96
+ return null;
97
+ }
98
+ }
99
+ function readContext(reader, wireVersion) {
100
+ return {
101
+ wireVersion,
102
+ sessionVersion: reader.readU16("session version"),
103
+ sessionId: reader.readFixed(32, "session id"),
104
+ executionId: reader.readFixed(32, "execution id"),
105
+ executionManifestDigest: reader.readFixed(32, "execution manifest digest"),
106
+ protocolId: reader.readFixed(32, "protocol id"),
107
+ protocolVersion: reader.readU16("protocol version"),
108
+ participantId: reader.readFixed(32, "participant id"),
109
+ seat: reader.readU16("seat"),
110
+ };
111
+ }
112
+ function readState(reader, nonceField, commitmentField) {
113
+ return {
114
+ nonce: reader.readU64(nonceField),
115
+ commitment: reader.readFixed(32, commitmentField),
116
+ };
117
+ }
118
+ function readReceipt(reader) {
119
+ return {
120
+ digest: reader.readFixed(32, "receipt digest"),
121
+ resultingState: readState(reader, "receipt resulting state nonce", "receipt resulting state commitment"),
122
+ };
123
+ }
124
+ function readOption(reader, field, read) {
125
+ const tag = reader.readByte(field);
126
+ if (tag === 0)
127
+ return null;
128
+ if (tag === 1)
129
+ return read();
130
+ throw new Error(`invalid option tag ${tag} for ${field}`);
131
+ }
132
+ function readPayload(reader, lengthField, bytesField) {
133
+ const schema = reader.readU16("payload schema version");
134
+ const bytes = reader.readLengthPrefixed(lengthField, bytesField);
135
+ return { schema, bytes };
136
+ }
137
+ function readCursor(reader) {
138
+ const sequence = reader.readU64("cursor event sequence");
139
+ const witnessedReceipt = readOption(reader, "cursor witnessed receipt option", () => readReceipt(reader));
140
+ return { sequence, witnessedReceipt };
141
+ }
142
+ function readView(reader) {
143
+ const state = readState(reader, "view state nonce", "view state commitment");
144
+ const participantView = readPayload(reader, "participant view byte length", "participant view bytes");
145
+ const legal = readPayload(reader, "legal action schema byte length", "legal action schema bytes");
146
+ const participantDeadlineMs = reader.readU64("participant deadline milliseconds");
147
+ const latestReceipt = readOption(reader, "latest receipt option", () => readReceipt(reader));
148
+ return {
149
+ state,
150
+ participantView: participantView.bytes,
151
+ participantViewSchema: participantView.schema,
152
+ legalActions: legal.bytes,
153
+ legalActionsSchema: legal.schema,
154
+ participantDeadlineMs,
155
+ latestReceipt,
156
+ };
157
+ }
158
+ function readPolicy(reader) {
159
+ return {
160
+ maxParticipantViewBytes: reader.readU64("maximum participant view bytes"),
161
+ maxActionPayloadBytes: reader.readU64("maximum action payload bytes"),
162
+ maxLegalActionSchemaBytes: reader.readU64("maximum legal action schema bytes"),
163
+ maxArtifactReferences: reader.readU16("maximum artifact references"),
164
+ maxUnacknowledgedEvents: reader.readU64("maximum unacknowledged events"),
165
+ replayWindowEvents: reader.readU64("replay window events"),
166
+ rateWindowMs: reader.readU64("rate window milliseconds"),
167
+ maxActionsPerRateWindow: reader.readU32("maximum actions per rate window"),
168
+ actionBurst: reader.readU32("action burst"),
169
+ };
170
+ }
171
+ function skipAuthorization(reader) {
172
+ const tag = reader.readByte("authorization requirement tag");
173
+ if (tag !== 0)
174
+ throw new Error(`invalid authorization requirement tag ${tag}`);
175
+ const count = reader.readU16("authorization principal count");
176
+ for (let i = 0; i < count; i++) {
177
+ const principalTag = reader.readByte("authorization principal tag");
178
+ if (principalTag === 0)
179
+ reader.readU16("authorization seat");
180
+ else if (principalTag === 1)
181
+ reader.readFixed(32, "authorization role");
182
+ else
183
+ throw new Error(`invalid authorization principal tag ${principalTag}`);
184
+ }
185
+ }
186
+ function readActionRejection(reader) {
187
+ const tag = reader.readByte("action rejection tag");
188
+ if (tag === 0 || tag === 6)
189
+ reader.readU16("action rejection extra");
190
+ if (tag > 13)
191
+ throw new Error(`invalid action rejection tag ${tag}`);
192
+ }
193
+ function readSeatAuthChallenge(reader, wireVersion) {
194
+ const context = readContext(reader, wireVersion);
195
+ const actionId = reader.readFixed(32, "seat authorization action id");
196
+ const payloadLen = reader.readU32("seat authorization payload length");
197
+ const authorizationPayload = reader.readFixed(payloadLen, "seat authorization payload");
198
+ const proofLen = reader.readU32("seat authorization proof length");
199
+ const coordinatorProof = reader.readFixed(proofLen, "seat authorization proof");
200
+ const coordinatorPublicKey = reader.readFixed(32, "coordinator public key");
201
+ return {
202
+ context,
203
+ actionId,
204
+ authorizationPayload,
205
+ coordinatorProof,
206
+ coordinatorPublicKey,
207
+ };
208
+ }
209
+ export function decodeAuthorityMessage(bytes) {
210
+ const reader = new ByteReader(bytes);
211
+ const wireVersion = reader.readU16("wire version");
212
+ const tag = reader.readByte("message tag");
213
+ if (tag === SESSION_ERROR_TAG) {
214
+ readOption(reader, "session version option", () => reader.readU16("session version"));
215
+ const errorTag = reader.readByte("session protocol error tag");
216
+ if (errorTag === 0 || errorTag === 1)
217
+ reader.readU16("unsupported version");
218
+ if (errorTag === 2)
219
+ reader.readByte("invalid message tag");
220
+ const retry = reader.readByte("retry disposition");
221
+ reader.finish();
222
+ return {
223
+ type: "error",
224
+ retryable: retry !== 0,
225
+ tag: errorTag,
226
+ name: sessionErrorName(errorTag),
227
+ };
228
+ }
229
+ if (tag === SEAT_AUTHORIZATION_CHALLENGE_TAG) {
230
+ const challenge = readSeatAuthChallenge(reader, wireVersion);
231
+ reader.finish();
232
+ return { type: "seatAuthorization", challenge };
233
+ }
234
+ const context = readContext(reader, wireVersion);
235
+ const sequence = reader.readU64("authority event sequence");
236
+ let message;
237
+ switch (tag) {
238
+ case SESSION_JOINED_TAG: {
239
+ const policy = readPolicy(reader);
240
+ const view = readView(reader);
241
+ const cursor = readCursor(reader);
242
+ message = {
243
+ type: "sessionJoined",
244
+ context,
245
+ sequence,
246
+ policy,
247
+ view,
248
+ cursor,
249
+ };
250
+ break;
251
+ }
252
+ case PARTICIPANT_VIEW_TAG: {
253
+ const view = readView(reader);
254
+ const cursor = readCursor(reader);
255
+ message = { type: "participantView", context, sequence, view, cursor };
256
+ break;
257
+ }
258
+ case ACTION_ACKNOWLEDGED_TAG:
259
+ message = {
260
+ type: "actionAcknowledged",
261
+ context,
262
+ sequence,
263
+ actionId: reader.readFixed(32, "action id"),
264
+ };
265
+ break;
266
+ case ACTION_PENDING_TAG:
267
+ reader.readFixed(32, "action id");
268
+ skipAuthorization(reader);
269
+ message = { type: "actionPending", context, sequence };
270
+ break;
271
+ case ACTION_REJECTED_TAG: {
272
+ const actionId = reader.readFixed(32, "action id");
273
+ readActionRejection(reader);
274
+ reader.readByte("retry disposition");
275
+ const view = readView(reader);
276
+ const cursor = readCursor(reader);
277
+ message = {
278
+ type: "actionRejected",
279
+ context,
280
+ sequence,
281
+ actionId,
282
+ view,
283
+ cursor,
284
+ };
285
+ break;
286
+ }
287
+ case ACTION_COMMITTED_TAG: {
288
+ const actionId = reader.readFixed(32, "action id");
289
+ const receipt = readReceipt(reader);
290
+ const view = readView(reader);
291
+ const cursor = readCursor(reader);
292
+ message = {
293
+ type: "actionCommitted",
294
+ context,
295
+ sequence,
296
+ actionId,
297
+ view,
298
+ cursor,
299
+ receipt,
300
+ };
301
+ break;
302
+ }
303
+ case SESSION_RESUMED_TAG: {
304
+ reader.readU64("replay from sequence");
305
+ const view = readView(reader);
306
+ const cursor = readCursor(reader);
307
+ message = { type: "sessionResumed", context, sequence, view, cursor };
308
+ break;
309
+ }
310
+ case SESSION_TERMINAL_TAG: {
311
+ const disposition = reader.readByte("terminal disposition");
312
+ const finalState = readState(reader, "final state nonce", "final state commitment");
313
+ const finalReceipt = readOption(reader, "final receipt option", () => readReceipt(reader));
314
+ const cursor = readCursor(reader);
315
+ message = {
316
+ type: "sessionTerminal",
317
+ context,
318
+ sequence,
319
+ disposition,
320
+ finalState,
321
+ cursor,
322
+ finalReceipt,
323
+ };
324
+ break;
325
+ }
326
+ default:
327
+ throw new Error(`unknown authority message tag ${tag}`);
328
+ }
329
+ reader.finish();
330
+ return message;
331
+ }
332
+ export function encodeSeatAuthSuccessFrame(context, actionId, signature) {
333
+ if (signature.length !== 64)
334
+ throw new Error("seat authorization signature must be 64 bytes");
335
+ const writer = new ByteWriter()
336
+ .pushU16(context.wireVersion)
337
+ .pushByte(SEAT_AUTHORIZATION_RESPONSE_TAG);
338
+ encodeContext(writer, context);
339
+ writer.pushFixed(actionId, 32, "action id").pushByte(0).pushBytes(signature);
340
+ return writer.bytes();
341
+ }
342
+ export function extractProtocolInput(payload) {
343
+ const reader = new ByteReader(payload);
344
+ const candidateLen = Number(reader.readU64("candidate length"));
345
+ reader.readFixed(candidateLen, "candidate transition");
346
+ reader.readU16("protocol input schema");
347
+ return reader.readLengthPrefixed("protocol input length", "protocol input");
348
+ }
349
+ export function takePrincipalProof(bytes) {
350
+ const reader = new ByteReader(bytes);
351
+ const principalTag = reader.readByte("authorization principal tag");
352
+ let seat;
353
+ let role;
354
+ if (principalTag === 0)
355
+ seat = reader.readU16("authorization seat");
356
+ else if (principalTag === 1)
357
+ role = reader.readFixed(32, "authorization role");
358
+ else
359
+ throw new Error(`invalid principal tag ${principalTag}`);
360
+ const generation = reader.readFixed(32, "runtime generation");
361
+ const scheme = reader.readByte("signature scheme");
362
+ const sigLen = reader.readU16("signature length");
363
+ const signature = reader.readFixed(sigLen, "signature bytes");
364
+ return {
365
+ principalTag,
366
+ seat,
367
+ role,
368
+ generation,
369
+ scheme,
370
+ signature,
371
+ rest: bytes.slice(reader.consumed()),
372
+ };
373
+ }
@@ -0,0 +1,80 @@
1
+ import { ByteWriter } from "./bytes.js";
2
+ export interface SessionContext {
3
+ wireVersion: number;
4
+ sessionVersion: number;
5
+ /** 32 bytes */
6
+ sessionId: Uint8Array;
7
+ /** 32 bytes */
8
+ executionId: Uint8Array;
9
+ /** 32 bytes */
10
+ executionManifestDigest: Uint8Array;
11
+ /** 32 bytes */
12
+ protocolId: Uint8Array;
13
+ protocolVersion: number;
14
+ /** 32 bytes */
15
+ participantId: Uint8Array;
16
+ seat: number;
17
+ }
18
+ export declare function encodeContext(writer: ByteWriter, context: SessionContext): void;
19
+ export declare function encodeSignature(signature: Uint8Array): Uint8Array;
20
+ export declare function signedFrame(body: Uint8Array, signature: Uint8Array): Uint8Array;
21
+ export interface JoinRequest {
22
+ wireVersion: number;
23
+ /** strictly ascending, the wire rejects any other ordering */
24
+ supportedSessionVersions: number[];
25
+ executionId: Uint8Array;
26
+ executionManifestDigest: Uint8Array;
27
+ participantId: Uint8Array;
28
+ seat: number;
29
+ /** 32 bytes */
30
+ clientNonce: Uint8Array;
31
+ /** 74 bytes, as issued by the authority's challenge */
32
+ challenge: Uint8Array;
33
+ }
34
+ export declare function joinBodyBytes(request: JoinRequest): Uint8Array;
35
+ export declare function joinSigningBytes(request: JoinRequest): Uint8Array;
36
+ export declare function encodeJoinFrame(request: JoinRequest, signature: Uint8Array): Uint8Array;
37
+ export interface ArtifactReference {
38
+ kind: number;
39
+ schemaVersion: number;
40
+ /** 32 bytes */
41
+ digest: Uint8Array;
42
+ byteLength: number | bigint;
43
+ }
44
+ export interface ActionProposal {
45
+ context: SessionContext;
46
+ /** 32 bytes */
47
+ actionId: Uint8Array;
48
+ expectedStateNonce: number | bigint;
49
+ /** 32 bytes */
50
+ expectedStateCommitment: Uint8Array;
51
+ participantDeadlineMs: number | bigint;
52
+ payloadSchemaVersion: number;
53
+ payload: Uint8Array;
54
+ artifactReferences?: ArtifactReference[];
55
+ }
56
+ export declare function actionBodyBytes(proposal: ActionProposal): Uint8Array;
57
+ export declare function actionSigningBytes(proposal: ActionProposal): Uint8Array;
58
+ export declare function encodeActionFrame(proposal: ActionProposal, signature: Uint8Array): Uint8Array;
59
+ export interface ResumeWitnessedReceipt {
60
+ /** 32 bytes */
61
+ digest: Uint8Array;
62
+ resultingState: {
63
+ nonce: number | bigint;
64
+ /** 32 bytes */
65
+ commitment: Uint8Array;
66
+ };
67
+ }
68
+ export interface ResumeRequest {
69
+ context: SessionContext;
70
+ cursorSequence: number | bigint;
71
+ /** the receipt the last acknowledged cursor witnessed; omit or null for None */
72
+ witnessedReceipt?: ResumeWitnessedReceipt | null;
73
+ /** 32 bytes */
74
+ clientNonce: Uint8Array;
75
+ /** 74 bytes */
76
+ challenge: Uint8Array;
77
+ }
78
+ export declare function resumeBodyBytes(request: ResumeRequest): Uint8Array;
79
+ export declare function resumeSigningBytes(request: ResumeRequest): Uint8Array;
80
+ export declare function encodeResumeFrame(request: ResumeRequest, signature: Uint8Array): Uint8Array;