@invisible-labs/sdk 0.6.0-devnet.5 → 0.8.0-devnet
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/.invisible-sdk-build-target.json +3 -3
- package/dist/{chunk-4X5OCCQW.js → chunk-IG6JJFR2.js} +3 -3
- package/dist/chunk-IG6JJFR2.js.map +1 -0
- package/dist/{chunk-JNNVPZEU.js → chunk-K67FTCQU.js} +3 -3
- package/dist/chunk-K67FTCQU.js.map +1 -0
- package/dist/{chunk-3TGQ4CZ3.js → chunk-MPNVF727.js} +11 -11
- package/dist/chunk-MPNVF727.js.map +1 -0
- package/dist/{chunk-3MDHAS4D.js → chunk-MZKJU3UA.js} +3 -3
- package/dist/{chunk-3MDHAS4D.js.map → chunk-MZKJU3UA.js.map} +1 -1
- package/dist/{coordinator-PEWHNZ7I.js → coordinator-E2TS6NR2.js} +3 -3
- package/dist/{coordinator-PEWHNZ7I.js.map → coordinator-E2TS6NR2.js.map} +1 -1
- package/dist/dkgWorker.js +1 -1
- package/dist/events.js +1 -1
- package/dist/frostRuntime-6FTPKUCP.js +4 -0
- package/dist/{frostRuntime-JESDHN6O.js.map → frostRuntime-6FTPKUCP.js.map} +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/lp.js +3 -3
- package/dist/user.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-3TGQ4CZ3.js.map +0 -1
- package/dist/chunk-4X5OCCQW.js.map +0 -1
- package/dist/chunk-JNNVPZEU.js.map +0 -1
- package/dist/frostRuntime-JESDHN6O.js +0 -4
|
@@ -32,7 +32,7 @@ var CoordinatorMessageType = {
|
|
|
32
32
|
};
|
|
33
33
|
var protocolPromise = null;
|
|
34
34
|
function loadProtocol() {
|
|
35
|
-
protocolPromise ??= import('./coordinator-
|
|
35
|
+
protocolPromise ??= import('./coordinator-E2TS6NR2.js');
|
|
36
36
|
return protocolPromise;
|
|
37
37
|
}
|
|
38
38
|
var runtimes = /* @__PURE__ */ new WeakMap();
|
|
@@ -325,5 +325,5 @@ function rejectAll(runtime, error) {
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
export { CoordinatorMessageType, EnvelopeKind, closeProtocolRuntime, onEnvelope, requestEnvelope };
|
|
328
|
-
//# sourceMappingURL=chunk-
|
|
329
|
-
//# sourceMappingURL=chunk-
|
|
328
|
+
//# sourceMappingURL=chunk-MZKJU3UA.js.map
|
|
329
|
+
//# sourceMappingURL=chunk-MZKJU3UA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/coordinator/protocolClient.ts"],"names":["pending"],"mappings":";;;;AAWA,IAAM,0BAAA,GAA6B,UAAA;AACnC,IAAM,sBAAA,GAAyB,CAAA;AAExB,IAAM,YAAA,GAAe;AAAA,EAC1B,OAAA,EAAS,SAAA;AAAA,EACT,QAAA,EAAU,UAAA;AAAA,EACV,IAAA,EAAM,MAAA;AAAA,EACN,KAAA,EAAO;AACT;AAIO,IAAM,sBAAA,GAAyB;AAAA,EACpC,eAAA,EAAiB,iBAAA;AAAA,EACjB,qBAAA,EAAuB,uBAAA;AAAA,EACvB,OAAA,EAAS,SAAA;AAAA,EACT,SAAA,EAAW,WAAA;AAAA,EACX,SAAA,EAAW,WAAA;AAAA,EACX,WAAA,EAAa,aAAA;AAAA,EACb,aAAA,EAAe,eAAA;AAAA,EACf,WAAA,EAAa,aAAA;AAAA,EACb,gBAAA,EAAkB,kBAAA;AAAA,EAClB,IAAA,EAAM,MAAA;AAAA,EACN,YAAA,EAAc,cAAA;AAAA,EACd,MAAA,EAAQ,QAAA;AAAA,EACR,cAAA,EAAgB,gBAAA;AAAA,EAChB,eAAA,EAAiB,iBAAA;AAAA,EACjB,gBAAA,EAAkB,kBAAA;AAAA,EAClB,gBAAA,EAAkB,kBAAA;AAAA,EAClB,SAAA,EAAW,WAAA;AAAA,EACX,KAAA,EAAO;AACT;AA4BA,IAAI,eAAA,GAAkD,IAAA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A,IACL,KAAK,iBAAA;AAAA,IACL,KAAK,cAAA;AAAA,IACL,KAAK,qBAAA;AAAA,IACL,KAAK,uBAAA;AACH,MAAA,OAAO,IAAA;AAAA,IACT;AACE,MAAA,OAAO,cAAA;AAAA;AAEb;AAcA,SAAS,SAAA,CAAU,SAA0B,KAAA,EAAoB;AAC/D,EAAA,KAAA,MAAW,CAAC,KAAA,EAAO,OAAO,KAAK,OAAA,CAAQ,OAAA,CAAQ,SAAQ,EAAG;AACxD,IAAA,OAAA,CAAQ,OAAA,CAAQ,OAAO,KAAK,CAAA;AAC5B,IAAA,qBAAA,CAAsB,OAAO,CAAA;AAC7B,IAAA,OAAA,CAAQ,OAAO,KAAK,CAAA;AAAA,EACtB;AACA,EAAA,KAAA,MAAW,CAAC,IAAA,EAAM,OAAO,KAAK,OAAA,CAAQ,WAAA,CAAY,SAAQ,EAAG;AAC3D,IAAA,OAAA,CAAQ,WAAA,CAAY,OAAO,IAAI,CAAA;AAC/B,IAAA,KAAA,MAAW,UAAU,OAAA,EAAS;AAC5B,MAAA,IAAI,MAAA,CAAO,KAAA,EAAO,YAAA,CAAa,MAAA,CAAO,KAAK,CAAA;AAC3C,MAAA,MAAA,CAAO,OAAO,KAAK,CAAA;AAAA,IACrB;AAAA,EACF;AACF","file":"chunk-3MDHAS4D.js","sourcesContent":["import {\n CommandError,\n TransportError,\n type CommandErrorCode,\n type CoordinatorWireErrorCode,\n} from \"../core/errors.js\";\nimport type { Session } from \"../core/session.js\";\nimport { getSessionState, type SessionState } from \"../session/state.js\";\nimport type { Unsubscribe } from \"../transport/types.js\";\n\nconst COORDINATOR_ENVELOPE_VERSION = 2;\nconst MAX_COORDINATOR_REQUEST_ID = 0xffff_ffff;\nconst OUT_OF_BAND_REQUEST_ID = 0;\n\nexport const EnvelopeKind = {\n REQUEST: \"request\",\n RESPONSE: \"response\",\n PUSH: \"push\",\n ERROR: \"error\",\n} as const;\n\nexport type EnvelopeKind = (typeof EnvelopeKind)[keyof typeof EnvelopeKind];\n\nexport const CoordinatorMessageType = {\n ContractRequest: \"ContractRequest\",\n LpCreateAuthorization: \"LpCreateAuthorization\",\n DkgInit: \"DkgInit\",\n DkgRound1: \"DkgRound1\",\n DkgRound2: \"DkgRound2\",\n DkgComplete: \"DkgComplete\",\n DelegateShare: \"DelegateShare\",\n DelegateAck: \"DelegateAck\",\n DepositConfirmed: \"DepositConfirmed\",\n Sync: \"Sync\",\n SyncRequired: \"SyncRequired\",\n Refill: \"Refill\",\n PayoutExecuted: \"PayoutExecuted\",\n WithdrawRequest: \"WithdrawRequest\",\n WithdrawAccepted: \"WithdrawAccepted\",\n WithdrawExecuted: \"WithdrawExecuted\",\n LpCommand: \"LpCommand\",\n Error: \"Error\",\n} as const;\n\nexport type CoordinatorMessageType =\n (typeof CoordinatorMessageType)[keyof typeof CoordinatorMessageType];\n\nexport type Envelope = {\n readonly version: typeof COORDINATOR_ENVELOPE_VERSION;\n readonly kind: EnvelopeKind;\n readonly type: CoordinatorMessageType;\n readonly swap_id: string | null;\n readonly req_id: number;\n readonly timestamp_ms: number;\n readonly payload: unknown;\n};\n\ntype ProtocolModule = {\n readonly ENVELOPE_VERSION: typeof COORDINATOR_ENVELOPE_VERSION;\n readonly EnvelopeKind: typeof EnvelopeKind;\n readonly CoordinatorMessageType: typeof CoordinatorMessageType;\n readonly encodeValidated: (envelope: Envelope) => Uint8Array;\n readonly decode: (raw: Uint8Array) => { ok: true; value: Envelope } | { ok: false; error: Error };\n readonly asErrorPayload: (envelope: Envelope) => {\n readonly code: string;\n readonly failed_req_id?: number;\n readonly message: string;\n };\n};\n\nlet protocolPromise: Promise<ProtocolModule> | null = null;\n\nfunction loadProtocol(): Promise<ProtocolModule> {\n protocolPromise ??= import(\"protocol/coordinator\") as Promise<ProtocolModule>;\n return protocolPromise;\n}\n\nexport type ProtocolLogDirection = \"in\" | \"out\" | \"info\";\nexport type ProtocolLogHandler = (message: string, direction: ProtocolLogDirection) => void;\nexport type ProtocolEnvelopeHandler = (envelope: Envelope) => void;\n\nexport interface RequestEnvelopeOptions {\n readonly swapId?: string | null;\n readonly timeoutMs?: number;\n readonly signal?: AbortSignal;\n readonly onLog?: ProtocolLogHandler;\n /** Reject this request when the coordinator reports a swap-scoped error without a request id. */\n readonly rejectMatchingOutOfBandErrors?: boolean;\n /** Contract allocation responses must carry the server-assigned swap_id. */\n readonly requireNonNullResponseSwapId?: boolean;\n}\n\nexport interface AwaitPushOptions {\n /** Exact business routing key. Omit only for legacy wildcard waiters. */\n readonly swapId?: string | null;\n readonly timeoutMs?: number | null;\n}\n\ntype PendingRequest = {\n readonly expectedSwapId: string | null;\n readonly resolve: (envelope: Envelope) => void;\n readonly reject: (error: Error) => void;\n readonly timer: ReturnType<typeof setTimeout> | null;\n readonly signal?: AbortSignal;\n readonly abortHandler?: () => void;\n readonly swapId: string | null;\n readonly rejectMatchingOutOfBandErrors: boolean;\n readonly requireNonNullResponseSwapId: boolean;\n};\n\ntype PushWaiter = {\n readonly swapId?: string | null;\n readonly resolve: (envelope: Envelope) => void;\n readonly reject: (error: Error) => void;\n readonly timer: ReturnType<typeof setTimeout> | null;\n};\n\ntype ProtocolRuntime = {\n reqCounter: number;\n readonly pending: Map<number, PendingRequest>;\n readonly pushWaiters: Map<CoordinatorMessageType, PushWaiter[]>;\n readonly envelopeHandlers: Set<ProtocolEnvelopeHandler>;\n unsubscribeChannel: Unsubscribe | null;\n unsubscribeTransport: Unsubscribe | null;\n};\n\nconst runtimes = new WeakMap<SessionState, ProtocolRuntime>();\n\nexport async function requestEnvelope(\n session: Session,\n type: CoordinatorMessageType,\n payload: unknown,\n options: RequestEnvelopeOptions = {},\n): Promise<Envelope> {\n throwIfRequestAborted(options.signal);\n const protocol = await loadProtocol();\n throwIfRequestAborted(options.signal);\n const state = getSessionState(session);\n const runtime = ensureProtocolRuntime(state);\n const channel = state.channel;\n if (!state.attested || channel === null) {\n throw new TransportError(\"CONNECTION_LOST\", \"coordinator request requires an attested channel\");\n }\n\n if (runtime.reqCounter >= MAX_COORDINATOR_REQUEST_ID) {\n throw new CommandError(\"REJECTED_STATE\", \"coordinator request id space exhausted\");\n }\n const reqId = runtime.reqCounter + 1;\n runtime.reqCounter = reqId;\n const envelope: Envelope = {\n version: protocol.ENVELOPE_VERSION,\n kind: protocol.EnvelopeKind.REQUEST,\n type,\n swap_id: options.swapId ?? null,\n req_id: reqId,\n timestamp_ms: Date.now(),\n payload,\n };\n const frame = protocol.encodeValidated(envelope);\n\n return new Promise((resolve, reject) => {\n const abortHandler =\n options.signal === undefined\n ? undefined\n : () => rejectPending(runtime, reqId, createRequestAbortError());\n const timer =\n options.timeoutMs === undefined\n ? null\n : setTimeout(() => {\n rejectPending(\n runtime,\n reqId,\n new CommandError(\n \"REJECTED_STALE_JOB\",\n `coordinator request timed out for ${type} after ${options.timeoutMs}ms`,\n ),\n );\n }, options.timeoutMs);\n\n runtime.pending.set(reqId, {\n expectedSwapId: options.swapId ?? null,\n resolve,\n reject,\n timer,\n signal: options.signal,\n abortHandler,\n swapId: envelope.swap_id,\n rejectMatchingOutOfBandErrors: options.rejectMatchingOutOfBandErrors === true,\n requireNonNullResponseSwapId: options.requireNonNullResponseSwapId === true,\n });\n if (abortHandler !== undefined) {\n options.signal?.addEventListener(\"abort\", abortHandler, { once: true });\n if (options.signal?.aborted === true) {\n abortHandler();\n return;\n }\n }\n options.onLog?.(`-> ${type} req_id=${reqId}`, \"out\");\n try {\n channel.send(frame);\n } catch (error) {\n rejectPending(runtime, reqId, error instanceof Error ? error : new Error(String(error)));\n }\n });\n}\n\nexport function awaitPush(\n session: Session,\n type: CoordinatorMessageType,\n options: AwaitPushOptions = {},\n): Promise<Envelope> {\n const state = getSessionState(session);\n const runtime = ensureProtocolRuntime(state);\n const timeoutMs = options.timeoutMs === undefined ? 30_000 : options.timeoutMs;\n\n return new Promise((resolve, reject) => {\n const timer =\n timeoutMs === null\n ? null\n : setTimeout(() => {\n removePushWaiter(runtime, type, waiter);\n reject(new CommandError(\"REJECTED_STALE_JOB\", `timed out waiting for ${type} push`));\n }, timeoutMs);\n const waiter: PushWaiter = { swapId: options.swapId, resolve, reject, timer };\n const waiters = runtime.pushWaiters.get(type) ?? [];\n waiters.push(waiter);\n runtime.pushWaiters.set(type, waiters);\n });\n}\n\nexport function onEnvelope(session: Session, handler: ProtocolEnvelopeHandler): Unsubscribe {\n const runtime = ensureProtocolRuntime(getSessionState(session));\n runtime.envelopeHandlers.add(handler);\n return () => runtime.envelopeHandlers.delete(handler);\n}\n\nexport function closeProtocolRuntime(session: Session): void {\n const state = getSessionState(session);\n const runtime = runtimes.get(state);\n if (!runtime) return;\n const error = new TransportError(\"CONNECTION_LOST\", \"coordinator protocol runtime closed\");\n rejectAll(runtime, error);\n runtime.unsubscribeChannel?.();\n runtime.unsubscribeTransport?.();\n runtimes.delete(state);\n}\n\nfunction ensureProtocolRuntime(state: SessionState): ProtocolRuntime {\n const existing = runtimes.get(state);\n if (existing) return existing;\n\n const runtime: ProtocolRuntime = {\n reqCounter: 0,\n pending: new Map(),\n pushWaiters: new Map(),\n envelopeHandlers: new Set(),\n unsubscribeChannel: null,\n unsubscribeTransport: null,\n };\n\n if (state.channel === null) {\n throw new TransportError(\"CONNECTION_LOST\", \"coordinator protocol requires a live channel\");\n }\n runtime.unsubscribeChannel = state.channel.onMessage((frame) => handleFrame(runtime, frame));\n runtime.unsubscribeTransport = state.transport.onStateChange((transportState) => {\n if (transportState === \"closing\" || transportState === \"closed\") {\n rejectAll(runtime, new TransportError(\"CONNECTION_LOST\", \"coordinator transport closed\"));\n }\n });\n\n runtimes.set(state, runtime);\n return runtime;\n}\n\nfunction handleFrame(runtime: ProtocolRuntime, frame: Uint8Array): void {\n void handleFrameAsync(runtime, frame);\n}\n\nasync function handleFrameAsync(runtime: ProtocolRuntime, frame: Uint8Array): Promise<void> {\n const protocol = await loadProtocol();\n const decoded = protocol.decode(frame);\n if (!decoded.ok) {\n rejectAll(runtime, decoded.error);\n return;\n }\n\n const envelope = decoded.value;\n if (envelope.kind === protocol.EnvelopeKind.RESPONSE) {\n const pending = runtime.pending.get(envelope.req_id);\n if (pending && !pendingRequestMatchesSwapId(pending, envelope.swap_id)) {\n rejectPending(\n runtime,\n envelope.req_id,\n requestSwapIdMismatchError(envelope.req_id, pending.expectedSwapId, envelope.swap_id),\n );\n return;\n }\n }\n\n const errorPayload =\n envelope.kind === protocol.EnvelopeKind.ERROR ? protocol.asErrorPayload(envelope) : null;\n if (errorPayload?.failed_req_id !== undefined) {\n const pending = runtime.pending.get(errorPayload.failed_req_id);\n if (pending && !pendingRequestMatchesSwapId(pending, envelope.swap_id, false)) {\n rejectPending(\n runtime,\n errorPayload.failed_req_id,\n requestSwapIdMismatchError(\n errorPayload.failed_req_id,\n pending.expectedSwapId,\n envelope.swap_id,\n ),\n );\n return;\n }\n }\n\n for (const handler of runtime.envelopeHandlers) handler(envelope);\n\n if (envelope.kind === protocol.EnvelopeKind.ERROR) {\n const payload = errorPayload!;\n const error = commandErrorFromCoordinatorError(payload);\n if (payload.failed_req_id === undefined || payload.failed_req_id === OUT_OF_BAND_REQUEST_ID) {\n if (envelope.swap_id !== null) {\n rejectMatchingOutOfBandErrors(runtime, envelope.swap_id, error);\n }\n return;\n }\n const pending = runtime.pending.get(payload.failed_req_id);\n if (!pending) return;\n if (!pendingRequestMatchesSwapId(pending, envelope.swap_id, false)) {\n rejectPending(\n runtime,\n payload.failed_req_id,\n requestSwapIdMismatchError(payload.failed_req_id, pending.expectedSwapId, envelope.swap_id),\n );\n return;\n }\n rejectPending(runtime, payload.failed_req_id, error);\n return;\n }\n\n if (envelope.kind === protocol.EnvelopeKind.PUSH) {\n resolvePushWaiter(runtime, envelope);\n return;\n }\n\n if (envelope.kind !== protocol.EnvelopeKind.RESPONSE) return;\n const pending = runtime.pending.get(envelope.req_id);\n if (!pending) return;\n if (!pendingRequestMatchesSwapId(pending, envelope.swap_id)) {\n rejectPending(\n runtime,\n envelope.req_id,\n requestSwapIdMismatchError(envelope.req_id, pending.expectedSwapId, envelope.swap_id),\n );\n return;\n }\n runtime.pending.delete(envelope.req_id);\n cleanupPendingRequest(pending);\n pending.resolve(envelope);\n}\n\nfunction pendingRequestMatchesSwapId(\n pending: PendingRequest,\n responseSwapId: string | null,\n enforceNonNullResponseSwapId = true,\n): boolean {\n if (\n enforceNonNullResponseSwapId &&\n pending.requireNonNullResponseSwapId &&\n responseSwapId === null\n ) {\n return false;\n }\n return pending.expectedSwapId === null || pending.expectedSwapId === responseSwapId;\n}\n\nfunction requestSwapIdMismatchError(\n reqId: number,\n expectedSwapId: string | null,\n receivedSwapId: string | null,\n): CommandError {\n return new CommandError(\n \"REJECTED_STATE\",\n `coordinator response swap_id mismatch for req_id=${reqId}: expected ${expectedSwapId ?? \"null\"}, received ${receivedSwapId ?? \"null\"}`,\n { failedReqId: reqId },\n );\n}\n\nfunction resolvePushWaiter(runtime: ProtocolRuntime, envelope: Envelope): void {\n const waiters = runtime.pushWaiters.get(envelope.type);\n const waiterIndex = waiters?.findIndex(\n (candidate) => candidate.swapId === undefined || candidate.swapId === envelope.swap_id,\n );\n const waiter =\n waiters && waiterIndex !== undefined && waiterIndex >= 0\n ? waiters.splice(waiterIndex, 1)[0]\n : undefined;\n if (!waiter || !waiters) return;\n if (waiters.length === 0) {\n runtime.pushWaiters.delete(envelope.type);\n }\n if (waiter.timer) clearTimeout(waiter.timer);\n waiter.resolve(envelope);\n}\n\nfunction rejectPending(runtime: ProtocolRuntime, reqId: number, error: Error): void {\n const pending = runtime.pending.get(reqId);\n if (!pending) return;\n runtime.pending.delete(reqId);\n cleanupPendingRequest(pending);\n pending.reject(error);\n}\n\nfunction cleanupPendingRequest(pending: PendingRequest): void {\n if (pending.timer) clearTimeout(pending.timer);\n if (pending.signal !== undefined && pending.abortHandler !== undefined) {\n pending.signal.removeEventListener(\"abort\", pending.abortHandler);\n }\n}\n\nfunction throwIfRequestAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted === true) throw createRequestAbortError();\n}\n\nfunction createRequestAbortError(): DOMException {\n return new DOMException(\"coordinator request aborted\", \"AbortError\");\n}\n\nfunction rejectMatchingOutOfBandErrors(\n runtime: ProtocolRuntime,\n swapId: string,\n error: Error,\n): void {\n for (const [reqId, pending] of runtime.pending) {\n if (!pending.rejectMatchingOutOfBandErrors || pending.swapId !== swapId) continue;\n rejectPending(runtime, reqId, error);\n }\n}\n\nfunction commandErrorFromCoordinatorError(payload: {\n readonly code: string;\n readonly failed_req_id?: number;\n readonly message: string;\n}): CommandError {\n const coordinatorCode = toCoordinatorWireErrorCode(payload.code);\n return new CommandError(commandCodeFromCoordinatorCode(coordinatorCode), payload.message, {\n coordinatorCode,\n ...(payload.failed_req_id !== undefined ? { failedReqId: payload.failed_req_id } : {}),\n });\n}\n\nfunction commandCodeFromCoordinatorCode(code: CoordinatorWireErrorCode): CommandErrorCode {\n switch (code) {\n case \"ERR_UNEXPECTED_TYPE\":\n case \"ERR_UNKNOWN_SWAP\":\n case \"ERR_SWAP_NOT_REFUNDABLE\":\n return \"REJECTED_STATE\";\n case \"ERR_INTERNAL\":\n case \"ERR_SETTLEMENT_FAILED\":\n return \"REJECTED_STALE_JOB\";\n case \"ERR_INVALID_PAYLOAD\":\n case \"ERR_POLICY_VIOLATION\":\n case \"ERR_INVALID_RECOVERY_CODE\":\n case \"ERR_DKG_FAILURE\":\n case \"ERR_INVALID_DEPOSIT\":\n return \"REJECTED_GUARD\";\n }\n}\n\nfunction toCoordinatorWireErrorCode(code: string): CoordinatorWireErrorCode {\n switch (code) {\n case \"ERR_INVALID_PAYLOAD\":\n case \"ERR_UNEXPECTED_TYPE\":\n case \"ERR_UNKNOWN_SWAP\":\n case \"ERR_POLICY_VIOLATION\":\n case \"ERR_INVALID_RECOVERY_CODE\":\n case \"ERR_SWAP_NOT_REFUNDABLE\":\n case \"ERR_DKG_FAILURE\":\n case \"ERR_INTERNAL\":\n case \"ERR_INVALID_DEPOSIT\":\n case \"ERR_SETTLEMENT_FAILED\":\n return code;\n default:\n return \"ERR_INTERNAL\";\n }\n}\n\nfunction removePushWaiter(\n runtime: ProtocolRuntime,\n type: CoordinatorMessageType,\n waiter: PushWaiter,\n): void {\n const waiters = runtime.pushWaiters.get(type);\n if (!waiters) return;\n const index = waiters.indexOf(waiter);\n if (index >= 0) waiters.splice(index, 1);\n if (waiters.length === 0) runtime.pushWaiters.delete(type);\n}\n\nfunction rejectAll(runtime: ProtocolRuntime, error: Error): void {\n for (const [reqId, pending] of runtime.pending.entries()) {\n runtime.pending.delete(reqId);\n cleanupPendingRequest(pending);\n pending.reject(error);\n }\n for (const [type, waiters] of runtime.pushWaiters.entries()) {\n runtime.pushWaiters.delete(type);\n for (const waiter of waiters) {\n if (waiter.timer) clearTimeout(waiter.timer);\n waiter.reject(error);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/coordinator/protocolClient.ts"],"names":["pending"],"mappings":";;;;AAWA,IAAM,0BAAA,GAA6B,UAAA;AACnC,IAAM,sBAAA,GAAyB,CAAA;AAExB,IAAM,YAAA,GAAe;AAAA,EAC1B,OAAA,EAAS,SAAA;AAAA,EACT,QAAA,EAAU,UAAA;AAAA,EACV,IAAA,EAAM,MAAA;AAAA,EACN,KAAA,EAAO;AACT;AAIO,IAAM,sBAAA,GAAyB;AAAA,EACpC,eAAA,EAAiB,iBAAA;AAAA,EACjB,qBAAA,EAAuB,uBAAA;AAAA,EACvB,OAAA,EAAS,SAAA;AAAA,EACT,SAAA,EAAW,WAAA;AAAA,EACX,SAAA,EAAW,WAAA;AAAA,EACX,WAAA,EAAa,aAAA;AAAA,EACb,aAAA,EAAe,eAAA;AAAA,EACf,WAAA,EAAa,aAAA;AAAA,EACb,gBAAA,EAAkB,kBAAA;AAAA,EAClB,IAAA,EAAM,MAAA;AAAA,EACN,YAAA,EAAc,cAAA;AAAA,EACd,MAAA,EAAQ,QAAA;AAAA,EACR,cAAA,EAAgB,gBAAA;AAAA,EAChB,eAAA,EAAiB,iBAAA;AAAA,EACjB,gBAAA,EAA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K,qBAAA;AAAA,IACL,KAAK,qBAAA;AAAA,IACL,KAAK,kBAAA;AAAA,IACL,KAAK,sBAAA;AAAA,IACL,KAAK,2BAAA;AAAA,IACL,KAAK,yBAAA;AAAA,IACL,KAAK,iBAAA;AAAA,IACL,KAAK,cAAA;AAAA,IACL,KAAK,qBAAA;AAAA,IACL,KAAK,uBAAA;AACH,MAAA,OAAO,IAAA;AAAA,IACT;AACE,MAAA,OAAO,cAAA;AAAA;AAEb;AAcA,SAAS,SAAA,CAAU,SAA0B,KAAA,EAAoB;AAC/D,EAAA,KAAA,MAAW,CAAC,KAAA,EAAO,OAAO,KAAK,OAAA,CAAQ,OAAA,CAAQ,SAAQ,EAAG;AACxD,IAAA,OAAA,CAAQ,OAAA,CAAQ,OAAO,KAAK,CAAA;AAC5B,IAAA,qBAAA,CAAsB,OAAO,CAAA;AAC7B,IAAA,OAAA,CAAQ,OAAO,KAAK,CAAA;AAAA,EACtB;AACA,EAAA,KAAA,MAAW,CAAC,IAAA,EAAM,OAAO,KAAK,OAAA,CAAQ,WAAA,CAAY,SAAQ,EAAG;AAC3D,IAAA,OAAA,CAAQ,WAAA,CAAY,OAAO,IAAI,CAAA;AAC/B,IAAA,KAAA,MAAW,UAAU,OAAA,EAAS;AAC5B,MAAA,IAAI,MAAA,CAAO,KAAA,EAAO,YAAA,CAAa,MAAA,CAAO,KAAK,CAAA;AAC3C,MAAA,MAAA,CAAO,OAAO,KAAK,CAAA;AAAA,IACrB;AAAA,EACF;AACF","file":"chunk-MZKJU3UA.js","sourcesContent":["import {\n CommandError,\n TransportError,\n type CommandErrorCode,\n type CoordinatorWireErrorCode,\n} from \"../core/errors.js\";\nimport type { Session } from \"../core/session.js\";\nimport { getSessionState, type SessionState } from \"../session/state.js\";\nimport type { Unsubscribe } from \"../transport/types.js\";\n\nconst COORDINATOR_ENVELOPE_VERSION = 2;\nconst MAX_COORDINATOR_REQUEST_ID = 0xffff_ffff;\nconst OUT_OF_BAND_REQUEST_ID = 0;\n\nexport const EnvelopeKind = {\n REQUEST: \"request\",\n RESPONSE: \"response\",\n PUSH: \"push\",\n ERROR: \"error\",\n} as const;\n\nexport type EnvelopeKind = (typeof EnvelopeKind)[keyof typeof EnvelopeKind];\n\nexport const CoordinatorMessageType = {\n ContractRequest: \"ContractRequest\",\n LpCreateAuthorization: \"LpCreateAuthorization\",\n DkgInit: \"DkgInit\",\n DkgRound1: \"DkgRound1\",\n DkgRound2: \"DkgRound2\",\n DkgComplete: \"DkgComplete\",\n DelegateShare: \"DelegateShare\",\n DelegateAck: \"DelegateAck\",\n DepositConfirmed: \"DepositConfirmed\",\n Sync: \"Sync\",\n SyncRequired: \"SyncRequired\",\n Refill: \"Refill\",\n PayoutExecuted: \"PayoutExecuted\",\n WithdrawRequest: \"WithdrawRequest\",\n WithdrawAccepted: \"WithdrawAccepted\",\n WithdrawExecuted: \"WithdrawExecuted\",\n LpCommand: \"LpCommand\",\n Error: \"Error\",\n} as const;\n\nexport type CoordinatorMessageType =\n (typeof CoordinatorMessageType)[keyof typeof CoordinatorMessageType];\n\nexport type Envelope = {\n readonly version: typeof COORDINATOR_ENVELOPE_VERSION;\n readonly kind: EnvelopeKind;\n readonly type: CoordinatorMessageType;\n readonly swap_id: string | null;\n readonly req_id: number;\n readonly timestamp_ms: number;\n readonly payload: unknown;\n};\n\ntype ProtocolModule = {\n readonly ENVELOPE_VERSION: typeof COORDINATOR_ENVELOPE_VERSION;\n readonly EnvelopeKind: typeof EnvelopeKind;\n readonly CoordinatorMessageType: typeof CoordinatorMessageType;\n readonly encodeValidated: (envelope: Envelope) => Uint8Array;\n readonly decode: (raw: Uint8Array) => { ok: true; value: Envelope } | { ok: false; error: Error };\n readonly asErrorPayload: (envelope: Envelope) => {\n readonly code: string;\n readonly failed_req_id?: number;\n readonly message: string;\n };\n};\n\nlet protocolPromise: Promise<ProtocolModule> | null = null;\n\nfunction loadProtocol(): Promise<ProtocolModule> {\n protocolPromise ??= import(\"protocol/coordinator\") as Promise<ProtocolModule>;\n return protocolPromise;\n}\n\nexport type ProtocolLogDirection = \"in\" | \"out\" | \"info\";\nexport type ProtocolLogHandler = (message: string, direction: ProtocolLogDirection) => void;\nexport type ProtocolEnvelopeHandler = (envelope: Envelope) => void;\n\nexport interface RequestEnvelopeOptions {\n readonly swapId?: string | null;\n readonly timeoutMs?: number;\n readonly signal?: AbortSignal;\n readonly onLog?: ProtocolLogHandler;\n /** Reject this request when the coordinator reports a swap-scoped error without a request id. */\n readonly rejectMatchingOutOfBandErrors?: boolean;\n /** Contract allocation responses must carry the server-assigned swap_id. */\n readonly requireNonNullResponseSwapId?: boolean;\n}\n\nexport interface AwaitPushOptions {\n /** Exact business routing key. Omit only for legacy wildcard waiters. */\n readonly swapId?: string | null;\n readonly timeoutMs?: number | null;\n}\n\ntype PendingRequest = {\n readonly expectedSwapId: string | null;\n readonly resolve: (envelope: Envelope) => void;\n readonly reject: (error: Error) => void;\n readonly timer: ReturnType<typeof setTimeout> | null;\n readonly signal?: AbortSignal;\n readonly abortHandler?: () => void;\n readonly swapId: string | null;\n readonly rejectMatchingOutOfBandErrors: boolean;\n readonly requireNonNullResponseSwapId: boolean;\n};\n\ntype PushWaiter = {\n readonly swapId?: string | null;\n readonly resolve: (envelope: Envelope) => void;\n readonly reject: (error: Error) => void;\n readonly timer: ReturnType<typeof setTimeout> | null;\n};\n\ntype ProtocolRuntime = {\n reqCounter: number;\n readonly pending: Map<number, PendingRequest>;\n readonly pushWaiters: Map<CoordinatorMessageType, PushWaiter[]>;\n readonly envelopeHandlers: Set<ProtocolEnvelopeHandler>;\n unsubscribeChannel: Unsubscribe | null;\n unsubscribeTransport: Unsubscribe | null;\n};\n\nconst runtimes = new WeakMap<SessionState, ProtocolRuntime>();\n\nexport async function requestEnvelope(\n session: Session,\n type: CoordinatorMessageType,\n payload: unknown,\n options: RequestEnvelopeOptions = {},\n): Promise<Envelope> {\n throwIfRequestAborted(options.signal);\n const protocol = await loadProtocol();\n throwIfRequestAborted(options.signal);\n const state = getSessionState(session);\n const runtime = ensureProtocolRuntime(state);\n const channel = state.channel;\n if (!state.attested || channel === null) {\n throw new TransportError(\"CONNECTION_LOST\", \"coordinator request requires an attested channel\");\n }\n\n if (runtime.reqCounter >= MAX_COORDINATOR_REQUEST_ID) {\n throw new CommandError(\"REJECTED_STATE\", \"coordinator request id space exhausted\");\n }\n const reqId = runtime.reqCounter + 1;\n runtime.reqCounter = reqId;\n const envelope: Envelope = {\n version: protocol.ENVELOPE_VERSION,\n kind: protocol.EnvelopeKind.REQUEST,\n type,\n swap_id: options.swapId ?? null,\n req_id: reqId,\n timestamp_ms: Date.now(),\n payload,\n };\n const frame = protocol.encodeValidated(envelope);\n\n return new Promise((resolve, reject) => {\n const abortHandler =\n options.signal === undefined\n ? undefined\n : () => rejectPending(runtime, reqId, createRequestAbortError());\n const timer =\n options.timeoutMs === undefined\n ? null\n : setTimeout(() => {\n rejectPending(\n runtime,\n reqId,\n new CommandError(\n \"REJECTED_STALE_JOB\",\n `coordinator request timed out for ${type} after ${options.timeoutMs}ms`,\n ),\n );\n }, options.timeoutMs);\n\n runtime.pending.set(reqId, {\n expectedSwapId: options.swapId ?? null,\n resolve,\n reject,\n timer,\n signal: options.signal,\n abortHandler,\n swapId: envelope.swap_id,\n rejectMatchingOutOfBandErrors: options.rejectMatchingOutOfBandErrors === true,\n requireNonNullResponseSwapId: options.requireNonNullResponseSwapId === true,\n });\n if (abortHandler !== undefined) {\n options.signal?.addEventListener(\"abort\", abortHandler, { once: true });\n if (options.signal?.aborted === true) {\n abortHandler();\n return;\n }\n }\n options.onLog?.(`-> ${type} req_id=${reqId}`, \"out\");\n try {\n channel.send(frame);\n } catch (error) {\n rejectPending(runtime, reqId, error instanceof Error ? error : new Error(String(error)));\n }\n });\n}\n\nexport function awaitPush(\n session: Session,\n type: CoordinatorMessageType,\n options: AwaitPushOptions = {},\n): Promise<Envelope> {\n const state = getSessionState(session);\n const runtime = ensureProtocolRuntime(state);\n const timeoutMs = options.timeoutMs === undefined ? 30_000 : options.timeoutMs;\n\n return new Promise((resolve, reject) => {\n const timer =\n timeoutMs === null\n ? null\n : setTimeout(() => {\n removePushWaiter(runtime, type, waiter);\n reject(new CommandError(\"REJECTED_STALE_JOB\", `timed out waiting for ${type} push`));\n }, timeoutMs);\n const waiter: PushWaiter = { swapId: options.swapId, resolve, reject, timer };\n const waiters = runtime.pushWaiters.get(type) ?? [];\n waiters.push(waiter);\n runtime.pushWaiters.set(type, waiters);\n });\n}\n\nexport function onEnvelope(session: Session, handler: ProtocolEnvelopeHandler): Unsubscribe {\n const runtime = ensureProtocolRuntime(getSessionState(session));\n runtime.envelopeHandlers.add(handler);\n return () => runtime.envelopeHandlers.delete(handler);\n}\n\nexport function closeProtocolRuntime(session: Session): void {\n const state = getSessionState(session);\n const runtime = runtimes.get(state);\n if (!runtime) return;\n const error = new TransportError(\"CONNECTION_LOST\", \"coordinator protocol runtime closed\");\n rejectAll(runtime, error);\n runtime.unsubscribeChannel?.();\n runtime.unsubscribeTransport?.();\n runtimes.delete(state);\n}\n\nfunction ensureProtocolRuntime(state: SessionState): ProtocolRuntime {\n const existing = runtimes.get(state);\n if (existing) return existing;\n\n const runtime: ProtocolRuntime = {\n reqCounter: 0,\n pending: new Map(),\n pushWaiters: new Map(),\n envelopeHandlers: new Set(),\n unsubscribeChannel: null,\n unsubscribeTransport: null,\n };\n\n if (state.channel === null) {\n throw new TransportError(\"CONNECTION_LOST\", \"coordinator protocol requires a live channel\");\n }\n runtime.unsubscribeChannel = state.channel.onMessage((frame) => handleFrame(runtime, frame));\n runtime.unsubscribeTransport = state.transport.onStateChange((transportState) => {\n if (transportState === \"closing\" || transportState === \"closed\") {\n rejectAll(runtime, new TransportError(\"CONNECTION_LOST\", \"coordinator transport closed\"));\n }\n });\n\n runtimes.set(state, runtime);\n return runtime;\n}\n\nfunction handleFrame(runtime: ProtocolRuntime, frame: Uint8Array): void {\n void handleFrameAsync(runtime, frame);\n}\n\nasync function handleFrameAsync(runtime: ProtocolRuntime, frame: Uint8Array): Promise<void> {\n const protocol = await loadProtocol();\n const decoded = protocol.decode(frame);\n if (!decoded.ok) {\n rejectAll(runtime, decoded.error);\n return;\n }\n\n const envelope = decoded.value;\n if (envelope.kind === protocol.EnvelopeKind.RESPONSE) {\n const pending = runtime.pending.get(envelope.req_id);\n if (pending && !pendingRequestMatchesSwapId(pending, envelope.swap_id)) {\n rejectPending(\n runtime,\n envelope.req_id,\n requestSwapIdMismatchError(envelope.req_id, pending.expectedSwapId, envelope.swap_id),\n );\n return;\n }\n }\n\n const errorPayload =\n envelope.kind === protocol.EnvelopeKind.ERROR ? protocol.asErrorPayload(envelope) : null;\n if (errorPayload?.failed_req_id !== undefined) {\n const pending = runtime.pending.get(errorPayload.failed_req_id);\n if (pending && !pendingRequestMatchesSwapId(pending, envelope.swap_id, false)) {\n rejectPending(\n runtime,\n errorPayload.failed_req_id,\n requestSwapIdMismatchError(\n errorPayload.failed_req_id,\n pending.expectedSwapId,\n envelope.swap_id,\n ),\n );\n return;\n }\n }\n\n for (const handler of runtime.envelopeHandlers) handler(envelope);\n\n if (envelope.kind === protocol.EnvelopeKind.ERROR) {\n const payload = errorPayload!;\n const error = commandErrorFromCoordinatorError(payload);\n if (payload.failed_req_id === undefined || payload.failed_req_id === OUT_OF_BAND_REQUEST_ID) {\n if (envelope.swap_id !== null) {\n rejectMatchingOutOfBandErrors(runtime, envelope.swap_id, error);\n }\n return;\n }\n const pending = runtime.pending.get(payload.failed_req_id);\n if (!pending) return;\n if (!pendingRequestMatchesSwapId(pending, envelope.swap_id, false)) {\n rejectPending(\n runtime,\n payload.failed_req_id,\n requestSwapIdMismatchError(payload.failed_req_id, pending.expectedSwapId, envelope.swap_id),\n );\n return;\n }\n rejectPending(runtime, payload.failed_req_id, error);\n return;\n }\n\n if (envelope.kind === protocol.EnvelopeKind.PUSH) {\n resolvePushWaiter(runtime, envelope);\n return;\n }\n\n if (envelope.kind !== protocol.EnvelopeKind.RESPONSE) return;\n const pending = runtime.pending.get(envelope.req_id);\n if (!pending) return;\n if (!pendingRequestMatchesSwapId(pending, envelope.swap_id)) {\n rejectPending(\n runtime,\n envelope.req_id,\n requestSwapIdMismatchError(envelope.req_id, pending.expectedSwapId, envelope.swap_id),\n );\n return;\n }\n runtime.pending.delete(envelope.req_id);\n cleanupPendingRequest(pending);\n pending.resolve(envelope);\n}\n\nfunction pendingRequestMatchesSwapId(\n pending: PendingRequest,\n responseSwapId: string | null,\n enforceNonNullResponseSwapId = true,\n): boolean {\n if (\n enforceNonNullResponseSwapId &&\n pending.requireNonNullResponseSwapId &&\n responseSwapId === null\n ) {\n return false;\n }\n return pending.expectedSwapId === null || pending.expectedSwapId === responseSwapId;\n}\n\nfunction requestSwapIdMismatchError(\n reqId: number,\n expectedSwapId: string | null,\n receivedSwapId: string | null,\n): CommandError {\n return new CommandError(\n \"REJECTED_STATE\",\n `coordinator response swap_id mismatch for req_id=${reqId}: expected ${expectedSwapId ?? \"null\"}, received ${receivedSwapId ?? \"null\"}`,\n { failedReqId: reqId },\n );\n}\n\nfunction resolvePushWaiter(runtime: ProtocolRuntime, envelope: Envelope): void {\n const waiters = runtime.pushWaiters.get(envelope.type);\n const waiterIndex = waiters?.findIndex(\n (candidate) => candidate.swapId === undefined || candidate.swapId === envelope.swap_id,\n );\n const waiter =\n waiters && waiterIndex !== undefined && waiterIndex >= 0\n ? waiters.splice(waiterIndex, 1)[0]\n : undefined;\n if (!waiter || !waiters) return;\n if (waiters.length === 0) {\n runtime.pushWaiters.delete(envelope.type);\n }\n if (waiter.timer) clearTimeout(waiter.timer);\n waiter.resolve(envelope);\n}\n\nfunction rejectPending(runtime: ProtocolRuntime, reqId: number, error: Error): void {\n const pending = runtime.pending.get(reqId);\n if (!pending) return;\n runtime.pending.delete(reqId);\n cleanupPendingRequest(pending);\n pending.reject(error);\n}\n\nfunction cleanupPendingRequest(pending: PendingRequest): void {\n if (pending.timer) clearTimeout(pending.timer);\n if (pending.signal !== undefined && pending.abortHandler !== undefined) {\n pending.signal.removeEventListener(\"abort\", pending.abortHandler);\n }\n}\n\nfunction throwIfRequestAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted === true) throw createRequestAbortError();\n}\n\nfunction createRequestAbortError(): DOMException {\n return new DOMException(\"coordinator request aborted\", \"AbortError\");\n}\n\nfunction rejectMatchingOutOfBandErrors(\n runtime: ProtocolRuntime,\n swapId: string,\n error: Error,\n): void {\n for (const [reqId, pending] of runtime.pending) {\n if (!pending.rejectMatchingOutOfBandErrors || pending.swapId !== swapId) continue;\n rejectPending(runtime, reqId, error);\n }\n}\n\nfunction commandErrorFromCoordinatorError(payload: {\n readonly code: string;\n readonly failed_req_id?: number;\n readonly message: string;\n}): CommandError {\n const coordinatorCode = toCoordinatorWireErrorCode(payload.code);\n return new CommandError(commandCodeFromCoordinatorCode(coordinatorCode), payload.message, {\n coordinatorCode,\n ...(payload.failed_req_id !== undefined ? { failedReqId: payload.failed_req_id } : {}),\n });\n}\n\nfunction commandCodeFromCoordinatorCode(code: CoordinatorWireErrorCode): CommandErrorCode {\n switch (code) {\n case \"ERR_UNEXPECTED_TYPE\":\n case \"ERR_UNKNOWN_SWAP\":\n case \"ERR_SWAP_NOT_REFUNDABLE\":\n return \"REJECTED_STATE\";\n case \"ERR_INTERNAL\":\n case \"ERR_SETTLEMENT_FAILED\":\n return \"REJECTED_STALE_JOB\";\n case \"ERR_INVALID_PAYLOAD\":\n case \"ERR_POLICY_VIOLATION\":\n case \"ERR_INVALID_RECOVERY_CODE\":\n case \"ERR_DKG_FAILURE\":\n case \"ERR_INVALID_DEPOSIT\":\n return \"REJECTED_GUARD\";\n }\n}\n\nfunction toCoordinatorWireErrorCode(code: string): CoordinatorWireErrorCode {\n switch (code) {\n case \"ERR_INVALID_PAYLOAD\":\n case \"ERR_UNEXPECTED_TYPE\":\n case \"ERR_UNKNOWN_SWAP\":\n case \"ERR_POLICY_VIOLATION\":\n case \"ERR_INVALID_RECOVERY_CODE\":\n case \"ERR_SWAP_NOT_REFUNDABLE\":\n case \"ERR_DKG_FAILURE\":\n case \"ERR_INTERNAL\":\n case \"ERR_INVALID_DEPOSIT\":\n case \"ERR_SETTLEMENT_FAILED\":\n return code;\n default:\n return \"ERR_INTERNAL\";\n }\n}\n\nfunction removePushWaiter(\n runtime: ProtocolRuntime,\n type: CoordinatorMessageType,\n waiter: PushWaiter,\n): void {\n const waiters = runtime.pushWaiters.get(type);\n if (!waiters) return;\n const index = waiters.indexOf(waiter);\n if (index >= 0) waiters.splice(index, 1);\n if (waiters.length === 0) runtime.pushWaiters.delete(type);\n}\n\nfunction rejectAll(runtime: ProtocolRuntime, error: Error): void {\n for (const [reqId, pending] of runtime.pending.entries()) {\n runtime.pending.delete(reqId);\n cleanupPendingRequest(pending);\n pending.reject(error);\n }\n for (const [type, waiters] of runtime.pushWaiters.entries()) {\n runtime.pushWaiters.delete(type);\n for (const waiter of waiters) {\n if (waiter.timer) clearTimeout(waiter.timer);\n waiter.reject(error);\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { COORDINATOR_BINARY_FIELD_NAMES, COORDINATOR_ENVELOPE_SCHEMA, COORDINATOR_SCHEMA_PAYLOAD_CATEGORIES, CoordinatorError, CoordinatorMessageType, DEFAULT_PAYOUT_WINDOW_ID, DIRECTION_BY_TYPE, ENVELOPE_VERSION, EnvelopeKind, ErrorCode, INITIAL_STATE, MAX_FRAME_SIZE, MessageDirection, PAYOUT_WINDOW_OPTIONS, TERMINAL_STATES, TRANSITIONS, VALID_SWAP_STATES, asDelegateAckPayload, asDelegateSharePayload, asDelegateShareResponsePayload, asDepositConfirmedPayload, asDkgCompletePayload, asDkgInitPayload, asDkgInitResponsePayload, asDkgRound1Payload, asDkgRound1ResponsePayload, asDkgRound2Payload, asDkgRound2ResponsePayload, asErrorPayload, asLpCommandResponsePayload, asPayoutExecutedPayload, asSwapRequestPayload, asSwapRequestResponsePayload, asSyncRequiredPayload, asSyncUserRequestPayload, asSyncUserResponsePayload, asWithdrawAcceptedPayload, asWithdrawExecutedPayload, asWithdrawRequestPayload, decode, encode, encodeLpCommandForSigning, encodeValidated, isAllowedInState, isAllowedKindForType, isPayoutWindowId, isValidEnvelopeKind, isValidErrorCode, isValidMessageType, isValidSwapState, lpSignedCommandEnvelope, nextState, payloadCategory, payoutWindowLabelForId, payoutWindowOptionById, safeEncode, scheduledPayoutWindowOptions, scheduledPayoutWindowSeconds } from './chunk-
|
|
1
|
+
export { COORDINATOR_BINARY_FIELD_NAMES, COORDINATOR_ENVELOPE_SCHEMA, COORDINATOR_SCHEMA_PAYLOAD_CATEGORIES, CoordinatorError, CoordinatorMessageType, DEFAULT_PAYOUT_WINDOW_ID, DIRECTION_BY_TYPE, ENVELOPE_VERSION, EnvelopeKind, ErrorCode, INITIAL_STATE, MAX_FRAME_SIZE, MessageDirection, PAYOUT_WINDOW_OPTIONS, TERMINAL_STATES, TRANSITIONS, VALID_SWAP_STATES, asDelegateAckPayload, asDelegateSharePayload, asDelegateShareResponsePayload, asDepositConfirmedPayload, asDkgCompletePayload, asDkgInitPayload, asDkgInitResponsePayload, asDkgRound1Payload, asDkgRound1ResponsePayload, asDkgRound2Payload, asDkgRound2ResponsePayload, asErrorPayload, asLpCommandResponsePayload, asPayoutExecutedPayload, asSwapRequestPayload, asSwapRequestResponsePayload, asSyncRequiredPayload, asSyncUserRequestPayload, asSyncUserResponsePayload, asWithdrawAcceptedPayload, asWithdrawExecutedPayload, asWithdrawRequestPayload, decode, encode, encodeLpCommandForSigning, encodeValidated, isAllowedInState, isAllowedKindForType, isPayoutWindowId, isValidEnvelopeKind, isValidErrorCode, isValidMessageType, isValidSwapState, lpSignedCommandEnvelope, nextState, payloadCategory, payoutWindowLabelForId, payoutWindowOptionById, safeEncode, scheduledPayoutWindowOptions, scheduledPayoutWindowSeconds } from './chunk-MPNVF727.js';
|
|
2
2
|
import './chunk-VR6T6OJS.js';
|
|
3
|
-
//# sourceMappingURL=coordinator-
|
|
4
|
-
//# sourceMappingURL=coordinator-
|
|
3
|
+
//# sourceMappingURL=coordinator-E2TS6NR2.js.map
|
|
4
|
+
//# sourceMappingURL=coordinator-E2TS6NR2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"coordinator-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"coordinator-E2TS6NR2.js"}
|
package/dist/dkgWorker.js
CHANGED
package/dist/events.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { onEnvelope, EnvelopeKind, CoordinatorMessageType } from './chunk-
|
|
1
|
+
import { onEnvelope, EnvelopeKind, CoordinatorMessageType } from './chunk-MZKJU3UA.js';
|
|
2
2
|
import './chunk-HJFMDMPY.js';
|
|
3
3
|
import { NotImplementedError } from './chunk-QRN46R3F.js';
|
|
4
4
|
import './chunk-VR6T6OJS.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"frostRuntime-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"frostRuntime-6FTPKUCP.js"}
|
package/dist/index.js
CHANGED
|
@@ -56,7 +56,7 @@ var AZURE_PROD_MAA_TRUST = {
|
|
|
56
56
|
issuer: "https://sharedweu.weu.attest.azure.net",
|
|
57
57
|
jwksUrl: "https://sharedweu.weu.attest.azure.net/certs",
|
|
58
58
|
policyHash: "9NY0VnTQ-IiBriBplVUpFbczcDaEBUwsiFYAzHu_gco"};
|
|
59
|
-
var configuredRuntimeProfile = "prod-
|
|
59
|
+
var configuredRuntimeProfile = "prod-hardened" ;
|
|
60
60
|
var APPROVED_PRODUCTION_RUNTIME_PROFILE = configuredRuntimeProfile ;
|
|
61
61
|
|
|
62
62
|
// src/presets/production.ts
|
|
@@ -105,10 +105,10 @@ function createAzureProductionEndpoint({
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// src/presets/productionBinaryHash.ts
|
|
108
|
-
var APPROVED_PRODUCTION_COORDINATOR_BINARY_HASH = "
|
|
108
|
+
var APPROVED_PRODUCTION_COORDINATOR_BINARY_HASH = "2eb6efac5b38562b0759043155556034ea105db40094f0e424762f05ae441da8".toLowerCase() ;
|
|
109
109
|
|
|
110
110
|
// src/presets/productionMrtd.ts
|
|
111
|
-
var APPROVED_PRODUCTION_COORDINATOR_MRTD = "
|
|
111
|
+
var APPROVED_PRODUCTION_COORDINATOR_MRTD = "6f3e84c54ac6377614d4c139473db575a83b5db41bd845eecb4eedaf2788ea881309a410c4ceae9641406411f3f639b8".toLowerCase() ;
|
|
112
112
|
|
|
113
113
|
// src/session/publicReleasePolicy.ts
|
|
114
114
|
function publicProductionReleasePolicy() {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/version.ts","../src/core/session.ts","../src/transport/inMemoryTransport.ts","../src/presets/azure-prod-maa.generated.ts","../src/presets/productionRuntimeProfile.ts","../src/presets/production.ts","../src/presets/productionBinaryHash.ts","../src/presets/productionMrtd.ts","../src/session/publicReleasePolicy.ts","../src/session/publicSession.ts","../src/attestation/public.ts","../src/coordinator/public.ts"],"names":[],"mappings":";;;;;;;;;;AAIO,IAAM,UAAA,GAAa;;;AC2BnB,SAAS,WAAW,OAAA,EAA2B;AACpD,EAAA,OAAO,OAAA,CAAQ,QAAA;AACjB;;;ACEO,SAAS,iBAAA,CAAkB,OAAA,GAAoC,EAAC,EAA4B;AACjG,EAAA,MAAM,EAAA,GAAK,sBAAsB,MAAM,CAAA;AACvC,EAAA,MAAM,gBAAA,uBAAuB,GAAA,EAAiC;AAE9D,EAAA,OAAO;AAAA,IACL,KAAA,EAAO,MAAM,EAAA,CAAG,GAAA,EAAI;AAAA,IACpB,aAAA,EAAe,CAAC,QAAA,KAAa,EAAA,CAAG,SAAS,QAAQ,CAAA;AAAA,IACjD,UAAU,QAAA,EAAuB;AAC/B,MAAA,gBAAA,CAAiB,IAAI,QAAQ,CAAA;AAC7B,MA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;AAAO,KACrE,CAAE,CAAA;AAAA,EACJ,CAAA;AAAA,EAEA,cAAc,QAAA,EAA8D;AAC1E,IAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,IAAI,mBAAA,CAAoB,2BAA2B,CAAC,CAAA;AAAA,EAC5E,CAAA;AAAA,EAEA,QAAQ,QAAA,EAAgD;AACtD,IAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,IAAI,mBAAA,CAAoB,qBAAqB,CAAC,CAAA;AAAA,EACtE,CAAA;AAAA,EAEA,cAAc,QAAA,EAAkC;AAC9C,IAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,IAAI,mBAAA,CAAoB,2BAA2B,CAAC,CAAA;AAAA,EAC5E;AACF","file":"index.js","sourcesContent":["/**\n * The API surface version this build implements. Bumped only on a breaking\n * surface change. See docs/sdk-specification.md section 12.\n */\nexport const apiVersion = \"v0\" as const;\n\n/** Literal type of {@link apiVersion}. */\nexport type ApiVersion = typeof apiVersion;\n","/**\n * The opaque session handle.\n *\n * A `Session` is the single stateful object the functional surface threads\n * through every call: `fn(session, args)`. It owns the transport, the\n * attestation state, and (later) the leader-epoch bookkeeping. Consumers treat\n * it as opaque - they read `session.attested` and pass it back to SDK\n * functions, but never reach inside. The internal state map and constructor\n * live alongside `createSession` (added in a later ticket); this module only\n * fixes the public shape so the rest of the surface can type against it.\n */\n\ndeclare const sessionBrand: unique symbol;\n\n/**\n * Opaque, attested session handle. Obtain one from `createSession`; pass it as\n * the first argument to every actor command. The only field consumers read is\n * {@link Session.attested}.\n */\nexport interface Session {\n /**\n * Whether the current Noise session has passed full TDX attestation. Sensitive\n * commands refuse to run until this is `true`. Re-handshake or failover resets\n * it to `false` until a fresh attestation completes.\n */\n readonly attested: boolean;\n /** @internal Opacity brand; not constructable by consumers. */\n readonly [sessionBrand]: true;\n}\n\n/** Convenience predicate mirroring {@link Session.attested}. */\nexport function isAttested(session: Session): boolean {\n return session.attested;\n}\n","/**\n * In-memory transport.\n *\n * A zero-network channel used by unit tests. It transitions straight to `open`\n * on connect. `send` delivers the raw frame bytes to an optional peer sink: the\n * WebSocket message boundary is the frame boundary, so there is no extra length\n * prefix (matching the production transport). Noise lives above this pure byte\n * channel, never inside it.\n *\n * With no peer wired in, `send` is a silent no-op (legacy stub behaviour for\n * tests that never exchange frames). A paired loopback coordinator supplies a\n * `peer` sink so a real Noise XX handshake can run in-process (see the\n * `testLoopback` fixture).\n */\n\nimport { TransportError } from \"../core/errors.js\";\nimport { createStateController } from \"./stateController.js\";\nimport type { Transport, Unsubscribe } from \"./types.js\";\n\n/** Options for {@link inMemoryTransport}. Test-only paired-loopback wiring. */\nexport interface InMemoryTransportOptions {\n /**\n * Sink for frames written via `send()`. A paired in-process coordinator sets\n * this so the client's raw bytes reach the responder. When omitted, `send`\n * is a no-op so legacy stub-only tests keep working.\n */\n readonly peer?: (frame: Uint8Array) => void;\n}\n\n/** In-memory transport with a hook to feed inbound frames into `onMessage`. */\nexport interface InMemoryTransportHandle extends Transport {\n /** Deliver a frame to this transport's `onMessage` listeners (peer -> client). */\n readonly deliver: (frame: Uint8Array) => void;\n}\n\nexport function inMemoryTransport(options: InMemoryTransportOptions = {}): InMemoryTransportHandle {\n const sc = createStateController(\"idle\");\n const messageListeners = new Set<(frame: Uint8Array) => void>();\n\n return {\n state: () => sc.get(),\n onStateChange: (listener) => sc.onChange(listener),\n onMessage(listener): Unsubscribe {\n messageListeners.add(listener);\n return () => messageListeners.delete(listener);\n },\n deliver(frame: Uint8Array): void {\n for (const listener of messageListeners) listener(frame);\n },\n async connect(signal) {\n if (signal?.aborted) {\n throw new TransportError(\"CONNECTION_LOST\", \"connect aborted before it started\");\n }\n if (sc.get() === \"open\") return;\n sc.set(\"connecting\");\n sc.set(\"open\");\n },\n send(frame: Uint8Array): void {\n if (sc.get() !== \"open\") {\n throw new TransportError(\"CONNECTION_LOST\", \"cannot send on a non-open transport\");\n }\n options.peer?.(frame);\n },\n close() {\n if (sc.get() === \"closed\") return;\n sc.set(\"closing\");\n sc.set(\"closed\");\n },\n };\n}\n","// Generated by npm run release:trust-policy:generate-sdk. Do not edit.\nexport const AZURE_PROD_MAA_TRUST = {\n issuer: \"https://sharedweu.weu.attest.azure.net\",\n jwksUrl: \"https://sharedweu.weu.attest.azure.net/certs\",\n policyHash: \"9NY0VnTQ-IiBriBplVUpFbczcDaEBUwsiFYAzHu_gco\",\n trustSetVersion: \"azure-prod-maa-v1\",\n} as const;\n","/** Build-time projection of the approved production runtime profile. */\n\nexport const DEFAULT_AZURE_PROD_RUNTIME_PROFILE = \"prod-devnet-simplified\" as const;\nexport const PROD_HARDENED_RUNTIME_PROFILE = \"prod-hardened\" as const;\nexport const PROD_DEVNET_SIMPLIFIED_RUNTIME_PROFILE = \"prod-devnet-simplified\" as const;\nexport const PROD_DEVNET_SIMPLIFIED_LOCKED_RUNTIME_PROFILE =\n \"prod-devnet-simplified-locked\" as const;\n\ndeclare const __INVISIBLE_SDK_PRODUCTION_RUNTIME_PROFILE__: string | undefined;\n\nconst configuredRuntimeProfile =\n typeof __INVISIBLE_SDK_PRODUCTION_RUNTIME_PROFILE__ === \"string\"\n ? __INVISIBLE_SDK_PRODUCTION_RUNTIME_PROFILE__\n : \"\";\n\nexport const APPROVED_PRODUCTION_RUNTIME_PROFILE =\n configuredRuntimeProfile === PROD_HARDENED_RUNTIME_PROFILE ||\n configuredRuntimeProfile === PROD_DEVNET_SIMPLIFIED_RUNTIME_PROFILE ||\n configuredRuntimeProfile === PROD_DEVNET_SIMPLIFIED_LOCKED_RUNTIME_PROFILE\n ? configuredRuntimeProfile\n : DEFAULT_AZURE_PROD_RUNTIME_PROFILE;\n","import { INTEL_SGX_ROOT_CA_FINGERPRINT_SHA256 } from \"../attestation/verifier.js\";\nimport type { CoordinatorEndpoint, CoordinatorReleasePin } from \"../schemas/types.generated.js\";\nimport { AZURE_PROD_MAA_TRUST } from \"./azure-prod-maa.generated.js\";\nimport { APPROVED_PRODUCTION_RUNTIME_PROFILE } from \"./productionRuntimeProfile.js\";\n\nexport const LOCAL_DEV_RELEASE_PIN_MRTD = \"local-dev-no-mrtd\";\n\nexport const PLACEHOLDER_RELEASE_PIN = {\n mrtd: \"\",\n intelRootFingerprint: \"\",\n} as const satisfies CoordinatorReleasePin;\n\nexport const AZURE_PROD_COORDINATOR_MRTD =\n \"a2e61f1316e9e367e9c1f7a0adc98c48eb13875c399c85d286cee5ea2b05e57f2df9f61d903b0ae7ac5607d843dfffc1\";\nexport const AZURE_PROD_RUNTIME_PROFILE = APPROVED_PRODUCTION_RUNTIME_PROFILE;\n\nconst BINARY_HASH_HEX = /^[0-9a-f]{64}$/i;\nconst MRTD_HEX = /^[0-9a-f]{96}$/i;\n\nconst AZURE_PROD_RELEASE_PIN = {\n mrtd: AZURE_PROD_COORDINATOR_MRTD,\n runtimeProfile: AZURE_PROD_RUNTIME_PROFILE,\n intelRootFingerprint: INTEL_SGX_ROOT_CA_FINGERPRINT_SHA256,\n azureMaa: {\n issuer: AZURE_PROD_MAA_TRUST.issuer,\n jwksUrl: AZURE_PROD_MAA_TRUST.jwksUrl,\n policyHash: AZURE_PROD_MAA_TRUST.policyHash,\n },\n} as const;\n\nexport function assertApprovedBinaryHash(value: string): string {\n const binaryHash = typeof value === \"string\" ? value.toLowerCase() : \"\";\n if (!BINARY_HASH_HEX.test(binaryHash)) {\n throw new Error(\"an approved 64-character binary SHA-256 hash is required\");\n }\n return binaryHash;\n}\n\nexport function assertApprovedMrtd(value: string): string {\n const mrtd = typeof value === \"string\" ? value.toLowerCase() : \"\";\n if (!MRTD_HEX.test(mrtd)) {\n throw new Error(\"an approved 96-character production MRTD is required\");\n }\n return mrtd;\n}\n\n/** Build the active Azure production policy for a concrete coordinator URL. */\nexport function createAzureProductionEndpoint({\n wsUrl,\n expectedHostname,\n approvedBinaryHash,\n approvedMrtd = AZURE_PROD_COORDINATOR_MRTD,\n}: {\n readonly wsUrl: string;\n readonly expectedHostname: string;\n readonly approvedBinaryHash: string;\n readonly approvedMrtd?: string;\n}): CoordinatorEndpoint {\n const binaryHash = assertApprovedBinaryHash(approvedBinaryHash);\n const mrtd = assertApprovedMrtd(approvedMrtd);\n return {\n wsUrl,\n expectedHostname,\n releasePin: { ...AZURE_PROD_RELEASE_PIN, mrtd, binaryHash },\n requiredMode: \"prod\",\n };\n}\n\n/** Build the explicit private dev/test policy. */\nexport function createDevelopmentEndpoint({\n wsUrl,\n expectedHostname,\n allowMissingDcapCollateral,\n}: {\n readonly wsUrl: string;\n readonly expectedHostname: string;\n readonly allowMissingDcapCollateral?: boolean;\n}): CoordinatorEndpoint {\n return {\n wsUrl,\n expectedHostname,\n releasePin: {\n ...PLACEHOLDER_RELEASE_PIN,\n ...(allowMissingDcapCollateral === true ? { allowMissingDcapCollateral: true } : {}),\n },\n requiredMode: \"dev\",\n };\n}\n","/** Build-time projection of the approved coordinator binary hash. */\n\ndeclare const __INVISIBLE_SDK_PRODUCTION_BINARY_HASH__: string | undefined;\n\nexport const APPROVED_PRODUCTION_COORDINATOR_BINARY_HASH =\n typeof __INVISIBLE_SDK_PRODUCTION_BINARY_HASH__ === \"string\"\n ? __INVISIBLE_SDK_PRODUCTION_BINARY_HASH__.toLowerCase()\n : \"\";\n","/** Build-time projection of the approved production coordinator MRTD. */\n\ndeclare const __INVISIBLE_SDK_PRODUCTION_MRTD__: string | undefined;\n\nexport const APPROVED_PRODUCTION_COORDINATOR_MRTD =\n typeof __INVISIBLE_SDK_PRODUCTION_MRTD__ === \"string\"\n ? __INVISIBLE_SDK_PRODUCTION_MRTD__.toLowerCase()\n : \"\";\n","import { APPROVED_PRODUCTION_COORDINATOR_BINARY_HASH } from \"../presets/productionBinaryHash.js\";\nimport { APPROVED_PRODUCTION_COORDINATOR_MRTD } from \"../presets/productionMrtd.js\";\nimport { APPROVED_PRODUCTION_RUNTIME_PROFILE } from \"../presets/productionRuntimeProfile.js\";\nimport type { CoordinatorRuntimeProfile } from \"../attestation/verifier.js\";\n\nexport interface PublicProductionReleasePolicy {\n readonly expectedMrtd: string;\n readonly expectedBinaryHash: string;\n readonly expectedRuntimeProfile: CoordinatorRuntimeProfile;\n}\n\n/** The build-bound production tuple used by the public session constructor. */\nexport function publicProductionReleasePolicy(): PublicProductionReleasePolicy {\n return {\n expectedMrtd: APPROVED_PRODUCTION_COORDINATOR_MRTD,\n expectedBinaryHash: APPROVED_PRODUCTION_COORDINATOR_BINARY_HASH,\n expectedRuntimeProfile: APPROVED_PRODUCTION_RUNTIME_PROFILE,\n };\n}\n","import type { Session } from \"../core/session.js\";\nimport { createAzureProductionEndpoint } from \"../presets/production.js\";\nimport { isLoopbackUrl } from \"./secureChannel.js\";\nimport { publicProductionReleasePolicy } from \"./publicReleasePolicy.js\";\nimport {\n closeSession,\n createSessionInternal,\n type CreateSessionOptions as InternalCreateSessionOptions,\n} from \"./createSession.js\";\n\nconst PUBLIC_SESSION_OPTION_KEYS = new Set([\n \"coordinatorUrl\",\n \"storage\",\n \"wallet\",\n \"clientPersistence\",\n]);\nconst PUBLIC_COORDINATOR_URL_PROTOCOL = \"wss:\";\nconst PUBLIC_COORDINATOR_URL_ERROR =\n \"public SDK createSession requires a non-loopback wss:// coordinatorUrl\";\n\nexport interface PublicCreateSessionOptions {\n readonly coordinatorUrl: string;\n readonly storage?: unknown;\n readonly wallet?: unknown;\n /** Opt into SDK-owned normal-user transfer persistence. */\n readonly clientPersistence?: boolean;\n}\n\n/**\n * Open a production-only public SDK session.\n *\n * The caller supplies only the route and public adapters. The Azure\n * production release policy is embedded by the selected SDK build.\n */\nexport async function createSession(options: PublicCreateSessionOptions): Promise<Session> {\n assertPublicOptions(options);\n const parsedUrl = parsePublicCoordinatorUrl(options.coordinatorUrl);\n const releasePolicy = publicProductionReleasePolicy();\n const endpoint = createAzureProductionEndpoint({\n wsUrl: options.coordinatorUrl,\n expectedHostname: parsedUrl.hostname,\n approvedBinaryHash: releasePolicy.expectedBinaryHash,\n approvedMrtd: releasePolicy.expectedMrtd,\n });\n\n const internalOptions: InternalCreateSessionOptions = {\n coordinator: { endpoints: [endpoint] },\n ...(options.storage === undefined ? {} : { storage: options.storage }),\n ...(options.wallet === undefined ? {} : { wallet: options.wallet }),\n ...(options.clientPersistence === undefined\n ? {}\n : { clientPersistence: options.clientPersistence }),\n };\n return createSessionInternal(internalOptions);\n}\n\nexport { closeSession };\n\nfunction assertPublicOptions(options: unknown): asserts options is PublicCreateSessionOptions {\n if (typeof options !== \"object\" || options === null || Array.isArray(options)) {\n throw new TypeError(\"public SDK createSession options must be an object\");\n }\n for (const key of Object.keys(options)) {\n if (!PUBLIC_SESSION_OPTION_KEYS.has(key)) {\n throw new Error(`public SDK createSession does not accept option ${key}`);\n }\n }\n const coordinatorUrl = (options as { coordinatorUrl?: unknown }).coordinatorUrl;\n if (typeof coordinatorUrl !== \"string\") {\n throw new TypeError(\"public SDK createSession requires coordinatorUrl\");\n }\n const clientPersistence = (options as { clientPersistence?: unknown }).clientPersistence;\n if (clientPersistence !== undefined && typeof clientPersistence !== \"boolean\") {\n throw new TypeError(\"public SDK createSession clientPersistence must be a boolean\");\n }\n}\n\nfunction parsePublicCoordinatorUrl(value: string): URL {\n let parsed: URL;\n try {\n parsed = new URL(value);\n } catch (cause) {\n const error = new Error(PUBLIC_COORDINATOR_URL_ERROR);\n (error as { cause?: unknown }).cause = cause;\n throw error;\n }\n if (parsed.protocol !== PUBLIC_COORDINATOR_URL_PROTOCOL || isLoopbackUrl(value)) {\n throw new Error(PUBLIC_COORDINATOR_URL_ERROR);\n }\n return parsed;\n}\n","import type { Session } from \"../core/session.js\";\nimport type { AttestationResult } from \"../transport/handshake.js\";\nimport type { Unsubscribe } from \"../transport/types.js\";\nimport { reattestSerialized } from \"./reattest.js\";\nimport { failSessionClosed, getSessionState } from \"../session/state.js\";\nimport {\n publicProductionReleasePolicy,\n type PublicProductionReleasePolicy,\n} from \"../session/publicReleasePolicy.js\";\n\nexport type { AttestationResult } from \"../transport/handshake.js\";\n\nexport interface PublicAttestationPolicy {\n readonly expectedMrtd: string;\n readonly expectedBinaryHash?: string;\n readonly expectedRuntimeProfile?:\n | \"prod-hardened\"\n | \"prod-devnet-simplified\"\n | \"prod-devnet-simplified-locked\"\n | \"azure-tdx-v0-agentless\";\n readonly expectedRuntimeMeasurements?: {\n readonly rtmr0: string;\n readonly rtmr1: string;\n readonly rtmr2: string;\n readonly rtmr3: string;\n };\n readonly intelRootFingerprint?: string;\n readonly azureMaa?: {\n readonly expectedIssuer: string;\n readonly expectedJwksUrl: string;\n readonly expectedPolicyHash: string;\n };\n}\n\n/** Public attestation read controls. Policy construction remains internal. */\nexport const attestation = {\n productionPolicy(): PublicProductionReleasePolicy {\n return publicProductionReleasePolicy();\n },\n\n async assertValid(session: Session): Promise<AttestationResult> {\n const state = getSessionState(session);\n const endpoint = state.pool.endpoints[0]!;\n try {\n const result = await reattestSerialized(state, endpoint, state.pool.noiseTransportTimeoutMs);\n state.attestation = result;\n state.attested = true;\n return result;\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err));\n failSessionClosed(state, error);\n throw error;\n }\n },\n\n current(session: Session): AttestationResult | null {\n return getSessionState(session).attestation;\n },\n\n policy(session: Session): PublicAttestationPolicy {\n const pin = getSessionState(session).pool.endpoints[0]!.releasePin;\n return {\n expectedMrtd: pin.mrtd,\n ...(pin.binaryHash === undefined ? {} : { expectedBinaryHash: pin.binaryHash }),\n ...(pin.runtimeProfile === undefined ? {} : { expectedRuntimeProfile: pin.runtimeProfile }),\n ...(pin.runtimeMeasurements === undefined\n ? {}\n : { expectedRuntimeMeasurements: pin.runtimeMeasurements }),\n ...(pin.intelRootFingerprint === undefined\n ? {}\n : { intelRootFingerprint: pin.intelRootFingerprint }),\n ...(pin.azureMaa === undefined\n ? {}\n : {\n azureMaa: {\n expectedIssuer: pin.azureMaa.issuer,\n expectedJwksUrl: pin.azureMaa.jwksUrl,\n expectedPolicyHash: pin.azureMaa.policyHash,\n },\n }),\n };\n },\n\n onPolicyViolation(session: Session, handler: (error: Error) => void): Unsubscribe {\n const handlers = getSessionState(session).policyViolationHandlers;\n handlers.add(handler);\n return () => handlers.delete(handler);\n },\n};\n","import { NotImplementedError } from \"../core/errors.js\";\nimport type { Session } from \"../core/session.js\";\nimport { getSessionState } from \"../session/state.js\";\n\nexport interface PublicCoordinatorEndpoint {\n readonly coordinatorUrl: string;\n readonly roleHint?: \"leader\" | \"watcher\";\n readonly weight?: number;\n}\n\nexport interface CoordinatorVersion {\n readonly mode: \"prod\" | \"dev\";\n readonly protocolVersion: string;\n readonly schemaVersion: string;\n readonly hostname: string;\n readonly leaderEpoch: number;\n}\n\nexport const coordinator = {\n endpoints(session: Session): readonly PublicCoordinatorEndpoint[] {\n return getSessionState(session).pool.endpoints.map((endpoint) => ({\n coordinatorUrl: endpoint.wsUrl,\n ...(endpoint.roleHint === undefined ? {} : { roleHint: endpoint.roleHint }),\n ...(endpoint.weight === undefined ? {} : { weight: endpoint.weight }),\n }));\n },\n\n currentLeader(_session: Session): Promise<PublicCoordinatorEndpoint | null> {\n return Promise.reject(new NotImplementedError(\"coordinator.currentLeader\"));\n },\n\n version(_session: Session): Promise<CoordinatorVersion> {\n return Promise.reject(new NotImplementedError(\"coordinator.version\"));\n },\n\n forceFailover(_session: Session): Promise<void> {\n return Promise.reject(new NotImplementedError(\"coordinator.forceFailover\"));\n },\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/version.ts","../src/core/session.ts","../src/transport/inMemoryTransport.ts","../src/presets/azure-prod-maa.generated.ts","../src/presets/productionRuntimeProfile.ts","../src/presets/production.ts","../src/presets/productionBinaryHash.ts","../src/presets/productionMrtd.ts","../src/session/publicReleasePolicy.ts","../src/session/publicSession.ts","../src/attestation/public.ts","../src/coordinator/public.ts"],"names":[],"mappings":";;;;;;;;;;AAIO,IAAM,UAAA,GAAa;;;AC2BnB,SAAS,WAAW,OAAA,EAA2B;AACpD,EAAA,OAAO,OAAA,CAAQ,QAAA;AACjB;;;ACEO,SAAS,iBAAA,CAAkB,OAAA,GAAoC,EAAC,EAA4B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AAChE,IAAA,OAAO,gBAAgB,OAAO,CAAA,CAAE,KAAK,SAAA,CAAU,GAAA,CAAI,CAAC,QAAA,MAAc;AAAA,MAChE,gBAAgB,QAAA,CAAS,KAAA;AAAA,MACzB,GAAI,SAAS,QAAA,KAAa,MAAA,GAAY,EAAC,GAAI,EAAE,QAAA,EAAU,QAAA,CAAS,QAAA,EAAS;AAAA,MACzE,GAAI,SAAS,MAAA,KAAW,MAAA,GAAY,EAAC,GAAI,EAAE,MAAA,EAAQ,QAAA,CAAS,MAAA;AAAO,KACrE,CAAE,CAAA;AAAA,EACJ,CAAA;AAAA,EAEA,cAAc,QAAA,EAA8D;AAC1E,IAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,IAAI,mBAAA,CAAoB,2BAA2B,CAAC,CAAA;AAAA,EAC5E,CAAA;AAAA,EAEA,QAAQ,QAAA,EAAgD;AACtD,IAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,IAAI,mBAAA,CAAoB,qBAAqB,CAAC,CAAA;AAAA,EACtE,CAAA;AAAA,EAEA,cAAc,QAAA,EAAkC;AAC9C,IAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,IAAI,mBAAA,CAAoB,2BAA2B,CAAC,CAAA;AAAA,EAC5E;AACF","file":"index.js","sourcesContent":["/**\n * The API surface version this build implements. Bumped only on a breaking\n * surface change. See docs/sdk-specification.md section 12.\n */\nexport const apiVersion = \"v0\" as const;\n\n/** Literal type of {@link apiVersion}. */\nexport type ApiVersion = typeof apiVersion;\n","/**\n * The opaque session handle.\n *\n * A `Session` is the single stateful object the functional surface threads\n * through every call: `fn(session, args)`. It owns the transport, the\n * attestation state, and (later) the leader-epoch bookkeeping. Consumers treat\n * it as opaque - they read `session.attested` and pass it back to SDK\n * functions, but never reach inside. The internal state map and constructor\n * live alongside `createSession` (added in a later ticket); this module only\n * fixes the public shape so the rest of the surface can type against it.\n */\n\ndeclare const sessionBrand: unique symbol;\n\n/**\n * Opaque, attested session handle. Obtain one from `createSession`; pass it as\n * the first argument to every actor command. The only field consumers read is\n * {@link Session.attested}.\n */\nexport interface Session {\n /**\n * Whether the current Noise session has passed full TDX attestation. Sensitive\n * commands refuse to run until this is `true`. Re-handshake or failover resets\n * it to `false` until a fresh attestation completes.\n */\n readonly attested: boolean;\n /** @internal Opacity brand; not constructable by consumers. */\n readonly [sessionBrand]: true;\n}\n\n/** Convenience predicate mirroring {@link Session.attested}. */\nexport function isAttested(session: Session): boolean {\n return session.attested;\n}\n","/**\n * In-memory transport.\n *\n * A zero-network channel used by unit tests. It transitions straight to `open`\n * on connect. `send` delivers the raw frame bytes to an optional peer sink: the\n * WebSocket message boundary is the frame boundary, so there is no extra length\n * prefix (matching the production transport). Noise lives above this pure byte\n * channel, never inside it.\n *\n * With no peer wired in, `send` is a silent no-op (legacy stub behaviour for\n * tests that never exchange frames). A paired loopback coordinator supplies a\n * `peer` sink so a real Noise XX handshake can run in-process (see the\n * `testLoopback` fixture).\n */\n\nimport { TransportError } from \"../core/errors.js\";\nimport { createStateController } from \"./stateController.js\";\nimport type { Transport, Unsubscribe } from \"./types.js\";\n\n/** Options for {@link inMemoryTransport}. Test-only paired-loopback wiring. */\nexport interface InMemoryTransportOptions {\n /**\n * Sink for frames written via `send()`. A paired in-process coordinator sets\n * this so the client's raw bytes reach the responder. When omitted, `send`\n * is a no-op so legacy stub-only tests keep working.\n */\n readonly peer?: (frame: Uint8Array) => void;\n}\n\n/** In-memory transport with a hook to feed inbound frames into `onMessage`. */\nexport interface InMemoryTransportHandle extends Transport {\n /** Deliver a frame to this transport's `onMessage` listeners (peer -> client). */\n readonly deliver: (frame: Uint8Array) => void;\n}\n\nexport function inMemoryTransport(options: InMemoryTransportOptions = {}): InMemoryTransportHandle {\n const sc = createStateController(\"idle\");\n const messageListeners = new Set<(frame: Uint8Array) => void>();\n\n return {\n state: () => sc.get(),\n onStateChange: (listener) => sc.onChange(listener),\n onMessage(listener): Unsubscribe {\n messageListeners.add(listener);\n return () => messageListeners.delete(listener);\n },\n deliver(frame: Uint8Array): void {\n for (const listener of messageListeners) listener(frame);\n },\n async connect(signal) {\n if (signal?.aborted) {\n throw new TransportError(\"CONNECTION_LOST\", \"connect aborted before it started\");\n }\n if (sc.get() === \"open\") return;\n sc.set(\"connecting\");\n sc.set(\"open\");\n },\n send(frame: Uint8Array): void {\n if (sc.get() !== \"open\") {\n throw new TransportError(\"CONNECTION_LOST\", \"cannot send on a non-open transport\");\n }\n options.peer?.(frame);\n },\n close() {\n if (sc.get() === \"closed\") return;\n sc.set(\"closing\");\n sc.set(\"closed\");\n },\n };\n}\n","// Generated by npm run release:trust-policy:generate-sdk. Do not edit.\nexport const AZURE_PROD_MAA_TRUST = {\n issuer: \"https://sharedweu.weu.attest.azure.net\",\n jwksUrl: \"https://sharedweu.weu.attest.azure.net/certs\",\n policyHash: \"9NY0VnTQ-IiBriBplVUpFbczcDaEBUwsiFYAzHu_gco\",\n trustSetVersion: \"azure-prod-maa-v1\",\n} as const;\n","/** Build-time projection of the approved production runtime profile. */\n\nexport const DEFAULT_AZURE_PROD_RUNTIME_PROFILE = \"prod-devnet-simplified\" as const;\nexport const PROD_HARDENED_RUNTIME_PROFILE = \"prod-hardened\" as const;\nexport const PROD_DEVNET_SIMPLIFIED_RUNTIME_PROFILE = \"prod-devnet-simplified\" as const;\nexport const PROD_DEVNET_SIMPLIFIED_LOCKED_RUNTIME_PROFILE =\n \"prod-devnet-simplified-locked\" as const;\n\ndeclare const __INVISIBLE_SDK_PRODUCTION_RUNTIME_PROFILE__: string | undefined;\n\nconst configuredRuntimeProfile =\n typeof __INVISIBLE_SDK_PRODUCTION_RUNTIME_PROFILE__ === \"string\"\n ? __INVISIBLE_SDK_PRODUCTION_RUNTIME_PROFILE__\n : \"\";\n\nexport const APPROVED_PRODUCTION_RUNTIME_PROFILE =\n configuredRuntimeProfile === PROD_HARDENED_RUNTIME_PROFILE ||\n configuredRuntimeProfile === PROD_DEVNET_SIMPLIFIED_RUNTIME_PROFILE ||\n configuredRuntimeProfile === PROD_DEVNET_SIMPLIFIED_LOCKED_RUNTIME_PROFILE\n ? configuredRuntimeProfile\n : DEFAULT_AZURE_PROD_RUNTIME_PROFILE;\n","import { INTEL_SGX_ROOT_CA_FINGERPRINT_SHA256 } from \"../attestation/verifier.js\";\nimport type {\n AzureMaaPin,\n CoordinatorEndpoint,\n CoordinatorReleasePin,\n} from \"../schemas/types.generated.js\";\nimport { AZURE_PROD_MAA_TRUST } from \"./azure-prod-maa.generated.js\";\nimport { APPROVED_PRODUCTION_RUNTIME_PROFILE } from \"./productionRuntimeProfile.js\";\n\nexport const LOCAL_DEV_RELEASE_PIN_MRTD = \"local-dev-no-mrtd\";\n\nexport const PLACEHOLDER_RELEASE_PIN = {\n mrtd: \"\",\n intelRootFingerprint: \"\",\n} as const satisfies CoordinatorReleasePin;\n\nexport const AZURE_PROD_COORDINATOR_MRTD =\n \"a2e61f1316e9e367e9c1f7a0adc98c48eb13875c399c85d286cee5ea2b05e57f2df9f61d903b0ae7ac5607d843dfffc1\";\nexport const AZURE_PROD_RUNTIME_PROFILE = APPROVED_PRODUCTION_RUNTIME_PROFILE;\n\nconst BINARY_HASH_HEX = /^[0-9a-f]{64}$/i;\nconst MRTD_HEX = /^[0-9a-f]{96}$/i;\n\nconst AZURE_PROD_RELEASE_PIN = {\n mrtd: AZURE_PROD_COORDINATOR_MRTD,\n runtimeProfile: AZURE_PROD_RUNTIME_PROFILE,\n intelRootFingerprint: INTEL_SGX_ROOT_CA_FINGERPRINT_SHA256,\n azureMaa: {\n issuer: AZURE_PROD_MAA_TRUST.issuer,\n jwksUrl: AZURE_PROD_MAA_TRUST.jwksUrl,\n policyHash: AZURE_PROD_MAA_TRUST.policyHash,\n },\n} as const;\n\nexport function assertApprovedBinaryHash(value: string): string {\n const binaryHash = typeof value === \"string\" ? value.toLowerCase() : \"\";\n if (!BINARY_HASH_HEX.test(binaryHash)) {\n throw new Error(\"an approved 64-character binary SHA-256 hash is required\");\n }\n return binaryHash;\n}\n\nexport function assertApprovedMrtd(value: string): string {\n const mrtd = typeof value === \"string\" ? value.toLowerCase() : \"\";\n if (!MRTD_HEX.test(mrtd)) {\n throw new Error(\"an approved 96-character production MRTD is required\");\n }\n return mrtd;\n}\n\n/** Build the active Azure production policy for a concrete coordinator URL. */\nexport function createAzureProductionEndpoint({\n wsUrl,\n expectedHostname,\n approvedBinaryHash,\n approvedMrtd = AZURE_PROD_COORDINATOR_MRTD,\n}: {\n readonly wsUrl: string;\n readonly expectedHostname: string;\n readonly approvedBinaryHash: string;\n readonly approvedMrtd?: string;\n}): CoordinatorEndpoint {\n const binaryHash = assertApprovedBinaryHash(approvedBinaryHash);\n const mrtd = assertApprovedMrtd(approvedMrtd);\n return {\n wsUrl,\n expectedHostname,\n releasePin: { ...AZURE_PROD_RELEASE_PIN, mrtd, binaryHash },\n requiredMode: \"prod\",\n };\n}\n\n/** Build the explicit private dev/test policy. */\nexport function createDevelopmentEndpoint({\n wsUrl,\n expectedHostname,\n allowMissingDcapCollateral,\n includeAzureMaaTrust,\n}: {\n readonly wsUrl: string;\n readonly expectedHostname: string;\n readonly allowMissingDcapCollateral?: boolean;\n readonly includeAzureMaaTrust?: boolean;\n}): CoordinatorEndpoint {\n return {\n wsUrl,\n expectedHostname,\n releasePin: {\n ...PLACEHOLDER_RELEASE_PIN,\n ...(includeAzureMaaTrust === true\n ? {\n azureMaa: {\n issuer: AZURE_PROD_MAA_TRUST.issuer,\n jwksUrl: AZURE_PROD_MAA_TRUST.jwksUrl,\n policyHash: AZURE_PROD_MAA_TRUST.policyHash,\n } satisfies AzureMaaPin,\n }\n : {}),\n ...(allowMissingDcapCollateral === true ? { allowMissingDcapCollateral: true } : {}),\n },\n requiredMode: \"dev\",\n };\n}\n","/** Build-time projection of the approved coordinator binary hash. */\n\ndeclare const __INVISIBLE_SDK_PRODUCTION_BINARY_HASH__: string | undefined;\n\nexport const APPROVED_PRODUCTION_COORDINATOR_BINARY_HASH =\n typeof __INVISIBLE_SDK_PRODUCTION_BINARY_HASH__ === \"string\"\n ? __INVISIBLE_SDK_PRODUCTION_BINARY_HASH__.toLowerCase()\n : \"\";\n","/** Build-time projection of the approved production coordinator MRTD. */\n\ndeclare const __INVISIBLE_SDK_PRODUCTION_MRTD__: string | undefined;\n\nexport const APPROVED_PRODUCTION_COORDINATOR_MRTD =\n typeof __INVISIBLE_SDK_PRODUCTION_MRTD__ === \"string\"\n ? __INVISIBLE_SDK_PRODUCTION_MRTD__.toLowerCase()\n : \"\";\n","import { APPROVED_PRODUCTION_COORDINATOR_BINARY_HASH } from \"../presets/productionBinaryHash.js\";\nimport { APPROVED_PRODUCTION_COORDINATOR_MRTD } from \"../presets/productionMrtd.js\";\nimport { APPROVED_PRODUCTION_RUNTIME_PROFILE } from \"../presets/productionRuntimeProfile.js\";\nimport type { CoordinatorRuntimeProfile } from \"../attestation/verifier.js\";\n\nexport interface PublicProductionReleasePolicy {\n readonly expectedMrtd: string;\n readonly expectedBinaryHash: string;\n readonly expectedRuntimeProfile: CoordinatorRuntimeProfile;\n}\n\n/** The build-bound production tuple used by the public session constructor. */\nexport function publicProductionReleasePolicy(): PublicProductionReleasePolicy {\n return {\n expectedMrtd: APPROVED_PRODUCTION_COORDINATOR_MRTD,\n expectedBinaryHash: APPROVED_PRODUCTION_COORDINATOR_BINARY_HASH,\n expectedRuntimeProfile: APPROVED_PRODUCTION_RUNTIME_PROFILE,\n };\n}\n","import type { Session } from \"../core/session.js\";\nimport { createAzureProductionEndpoint } from \"../presets/production.js\";\nimport { isLoopbackUrl } from \"./secureChannel.js\";\nimport { publicProductionReleasePolicy } from \"./publicReleasePolicy.js\";\nimport {\n closeSession,\n createSessionInternal,\n type CreateSessionOptions as InternalCreateSessionOptions,\n} from \"./createSession.js\";\n\nconst PUBLIC_SESSION_OPTION_KEYS = new Set([\n \"coordinatorUrl\",\n \"storage\",\n \"wallet\",\n \"clientPersistence\",\n]);\nconst PUBLIC_COORDINATOR_URL_PROTOCOL = \"wss:\";\nconst PUBLIC_COORDINATOR_URL_ERROR =\n \"public SDK createSession requires a non-loopback wss:// coordinatorUrl\";\n\nexport interface PublicCreateSessionOptions {\n readonly coordinatorUrl: string;\n readonly storage?: unknown;\n readonly wallet?: unknown;\n /** Opt into SDK-owned normal-user transfer persistence. */\n readonly clientPersistence?: boolean;\n}\n\n/**\n * Open a production-only public SDK session.\n *\n * The caller supplies only the route and public adapters. The Azure\n * production release policy is embedded by the selected SDK build.\n */\nexport async function createSession(options: PublicCreateSessionOptions): Promise<Session> {\n assertPublicOptions(options);\n const parsedUrl = parsePublicCoordinatorUrl(options.coordinatorUrl);\n const releasePolicy = publicProductionReleasePolicy();\n const endpoint = createAzureProductionEndpoint({\n wsUrl: options.coordinatorUrl,\n expectedHostname: parsedUrl.hostname,\n approvedBinaryHash: releasePolicy.expectedBinaryHash,\n approvedMrtd: releasePolicy.expectedMrtd,\n });\n\n const internalOptions: InternalCreateSessionOptions = {\n coordinator: { endpoints: [endpoint] },\n ...(options.storage === undefined ? {} : { storage: options.storage }),\n ...(options.wallet === undefined ? {} : { wallet: options.wallet }),\n ...(options.clientPersistence === undefined\n ? {}\n : { clientPersistence: options.clientPersistence }),\n };\n return createSessionInternal(internalOptions);\n}\n\nexport { closeSession };\n\nfunction assertPublicOptions(options: unknown): asserts options is PublicCreateSessionOptions {\n if (typeof options !== \"object\" || options === null || Array.isArray(options)) {\n throw new TypeError(\"public SDK createSession options must be an object\");\n }\n for (const key of Object.keys(options)) {\n if (!PUBLIC_SESSION_OPTION_KEYS.has(key)) {\n throw new Error(`public SDK createSession does not accept option ${key}`);\n }\n }\n const coordinatorUrl = (options as { coordinatorUrl?: unknown }).coordinatorUrl;\n if (typeof coordinatorUrl !== \"string\") {\n throw new TypeError(\"public SDK createSession requires coordinatorUrl\");\n }\n const clientPersistence = (options as { clientPersistence?: unknown }).clientPersistence;\n if (clientPersistence !== undefined && typeof clientPersistence !== \"boolean\") {\n throw new TypeError(\"public SDK createSession clientPersistence must be a boolean\");\n }\n}\n\nfunction parsePublicCoordinatorUrl(value: string): URL {\n let parsed: URL;\n try {\n parsed = new URL(value);\n } catch (cause) {\n const error = new Error(PUBLIC_COORDINATOR_URL_ERROR);\n (error as { cause?: unknown }).cause = cause;\n throw error;\n }\n if (parsed.protocol !== PUBLIC_COORDINATOR_URL_PROTOCOL || isLoopbackUrl(value)) {\n throw new Error(PUBLIC_COORDINATOR_URL_ERROR);\n }\n return parsed;\n}\n","import type { Session } from \"../core/session.js\";\nimport type { AttestationResult } from \"../transport/handshake.js\";\nimport type { Unsubscribe } from \"../transport/types.js\";\nimport { reattestSerialized } from \"./reattest.js\";\nimport { failSessionClosed, getSessionState } from \"../session/state.js\";\nimport {\n publicProductionReleasePolicy,\n type PublicProductionReleasePolicy,\n} from \"../session/publicReleasePolicy.js\";\n\nexport type { AttestationResult } from \"../transport/handshake.js\";\n\nexport interface PublicAttestationPolicy {\n readonly expectedMrtd: string;\n readonly expectedBinaryHash?: string;\n readonly expectedRuntimeProfile?:\n | \"prod-hardened\"\n | \"prod-devnet-simplified\"\n | \"prod-devnet-simplified-locked\"\n | \"azure-tdx-v0-agentless\";\n readonly expectedRuntimeMeasurements?: {\n readonly rtmr0: string;\n readonly rtmr1: string;\n readonly rtmr2: string;\n readonly rtmr3: string;\n };\n readonly intelRootFingerprint?: string;\n readonly azureMaa?: {\n readonly expectedIssuer: string;\n readonly expectedJwksUrl: string;\n readonly expectedPolicyHash: string;\n };\n}\n\n/** Public attestation read controls. Policy construction remains internal. */\nexport const attestation = {\n productionPolicy(): PublicProductionReleasePolicy {\n return publicProductionReleasePolicy();\n },\n\n async assertValid(session: Session): Promise<AttestationResult> {\n const state = getSessionState(session);\n const endpoint = state.pool.endpoints[0]!;\n try {\n const result = await reattestSerialized(state, endpoint, state.pool.noiseTransportTimeoutMs);\n state.attestation = result;\n state.attested = true;\n return result;\n } catch (err) {\n const error = err instanceof Error ? err : new Error(String(err));\n failSessionClosed(state, error);\n throw error;\n }\n },\n\n current(session: Session): AttestationResult | null {\n return getSessionState(session).attestation;\n },\n\n policy(session: Session): PublicAttestationPolicy {\n const pin = getSessionState(session).pool.endpoints[0]!.releasePin;\n return {\n expectedMrtd: pin.mrtd,\n ...(pin.binaryHash === undefined ? {} : { expectedBinaryHash: pin.binaryHash }),\n ...(pin.runtimeProfile === undefined ? {} : { expectedRuntimeProfile: pin.runtimeProfile }),\n ...(pin.runtimeMeasurements === undefined\n ? {}\n : { expectedRuntimeMeasurements: pin.runtimeMeasurements }),\n ...(pin.intelRootFingerprint === undefined\n ? {}\n : { intelRootFingerprint: pin.intelRootFingerprint }),\n ...(pin.azureMaa === undefined\n ? {}\n : {\n azureMaa: {\n expectedIssuer: pin.azureMaa.issuer,\n expectedJwksUrl: pin.azureMaa.jwksUrl,\n expectedPolicyHash: pin.azureMaa.policyHash,\n },\n }),\n };\n },\n\n onPolicyViolation(session: Session, handler: (error: Error) => void): Unsubscribe {\n const handlers = getSessionState(session).policyViolationHandlers;\n handlers.add(handler);\n return () => handlers.delete(handler);\n },\n};\n","import { NotImplementedError } from \"../core/errors.js\";\nimport type { Session } from \"../core/session.js\";\nimport { getSessionState } from \"../session/state.js\";\n\nexport interface PublicCoordinatorEndpoint {\n readonly coordinatorUrl: string;\n readonly roleHint?: \"leader\" | \"watcher\";\n readonly weight?: number;\n}\n\nexport interface CoordinatorVersion {\n readonly mode: \"prod\" | \"dev\";\n readonly protocolVersion: string;\n readonly schemaVersion: string;\n readonly hostname: string;\n readonly leaderEpoch: number;\n}\n\nexport const coordinator = {\n endpoints(session: Session): readonly PublicCoordinatorEndpoint[] {\n return getSessionState(session).pool.endpoints.map((endpoint) => ({\n coordinatorUrl: endpoint.wsUrl,\n ...(endpoint.roleHint === undefined ? {} : { roleHint: endpoint.roleHint }),\n ...(endpoint.weight === undefined ? {} : { weight: endpoint.weight }),\n }));\n },\n\n currentLeader(_session: Session): Promise<PublicCoordinatorEndpoint | null> {\n return Promise.reject(new NotImplementedError(\"coordinator.currentLeader\"));\n },\n\n version(_session: Session): Promise<CoordinatorVersion> {\n return Promise.reject(new NotImplementedError(\"coordinator.version\"));\n },\n\n forceFailover(_session: Session): Promise<void> {\n return Promise.reject(new NotImplementedError(\"coordinator.forceFailover\"));\n },\n};\n"]}
|
package/dist/lp.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isValidLpPositionId, LP_DEFAULT_REFILL_BATCH_SIZE, LP_DEFAULT_TARGET_SHARDS, LP_MAX_TARGET_SHARDS, LP_MAX_REFILL_BATCH_SIZE } from './chunk-
|
|
1
|
+
import { isValidLpPositionId, LP_DEFAULT_REFILL_BATCH_SIZE, LP_DEFAULT_TARGET_SHARDS, LP_MAX_TARGET_SHARDS, LP_MAX_REFILL_BATCH_SIZE } from './chunk-IG6JJFR2.js';
|
|
2
2
|
import { publicKey, assertAttested, lamports } from './chunk-EBWTAXNT.js';
|
|
3
|
-
import { requestEnvelope, CoordinatorMessageType } from './chunk-
|
|
3
|
+
import { requestEnvelope, CoordinatorMessageType } from './chunk-MZKJU3UA.js';
|
|
4
4
|
import { getSessionState } from './chunk-HJFMDMPY.js';
|
|
5
5
|
import { CommandError, WalletError, TransportError, PolicyValidationError, RoutingError, LpLifecycleError } from './chunk-QRN46R3F.js';
|
|
6
6
|
import './chunk-VR6T6OJS.js';
|
|
@@ -955,7 +955,7 @@ function randomBytes(length) {
|
|
|
955
955
|
return bytes;
|
|
956
956
|
}
|
|
957
957
|
function loadProtocol() {
|
|
958
|
-
protocolPromise ??= import('./coordinator-
|
|
958
|
+
protocolPromise ??= import('./coordinator-E2TS6NR2.js');
|
|
959
959
|
return protocolPromise;
|
|
960
960
|
}
|
|
961
961
|
|
package/dist/user.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { scheduledPayoutWindowSeconds } from './chunk-
|
|
1
|
+
import { scheduledPayoutWindowSeconds } from './chunk-MPNVF727.js';
|
|
2
2
|
import { validatePayoutPolicyShape, formatAjvErrors, persistTransferStatus, createSession, disabledClientPersistence, readPersistedTransferForResume, persistTransferReady, createExponentialBackoff, persistTransferTerminal, persistTransferRecoveryCode, persistTransferAllocation, persistTransferDkgMetadata } from './chunk-Y7AK6RBV.js';
|
|
3
3
|
export { getPersistedTransfer, listPersistedTransfers, purgePersistedTransfers, removePersistedTransfer } from './chunk-Y7AK6RBV.js';
|
|
4
|
-
import { PRODUCT_MAX_ENTRY_LAMPORTS, PRODUCT_MIN_ENTRY_LAMPORTS } from './chunk-
|
|
4
|
+
import { PRODUCT_MAX_ENTRY_LAMPORTS, PRODUCT_MIN_ENTRY_LAMPORTS } from './chunk-IG6JJFR2.js';
|
|
5
5
|
import { assertAttested, publicKey, solanaAddressFromPublicKeyBytes } from './chunk-EBWTAXNT.js';
|
|
6
|
-
import { requestEnvelope, CoordinatorMessageType, onEnvelope, closeProtocolRuntime, EnvelopeKind } from './chunk-
|
|
6
|
+
import { requestEnvelope, CoordinatorMessageType, onEnvelope, closeProtocolRuntime, EnvelopeKind } from './chunk-MZKJU3UA.js';
|
|
7
7
|
import { getSessionState } from './chunk-HJFMDMPY.js';
|
|
8
8
|
import './chunk-DCTYBUY3.js';
|
|
9
9
|
import { PolicyValidationError, CommandError, StorageError, TransportError, normalizeError, InvalidDepositAmountError, AttestationError, RoutingError } from './chunk-QRN46R3F.js';
|
|
@@ -172,11 +172,11 @@ function recoveryCodeFromUserInput(input) {
|
|
|
172
172
|
var protocolPromise = null;
|
|
173
173
|
var frostRuntimePromise = null;
|
|
174
174
|
function loadProtocol() {
|
|
175
|
-
protocolPromise ??= import('./coordinator-
|
|
175
|
+
protocolPromise ??= import('./coordinator-E2TS6NR2.js');
|
|
176
176
|
return protocolPromise;
|
|
177
177
|
}
|
|
178
178
|
function loadFrostRuntime() {
|
|
179
|
-
frostRuntimePromise ??= import('./frostRuntime-
|
|
179
|
+
frostRuntimePromise ??= import('./frostRuntime-6FTPKUCP.js');
|
|
180
180
|
return frostRuntimePromise;
|
|
181
181
|
}
|
|
182
182
|
function loadFrost() {
|
package/package.json
CHANGED