@oatscenter/trellis 0.100.0-rc.1
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/README.md +59 -0
- package/auth/authorization/client_context.d.ts +61 -0
- package/auth/authorization/client_context.js +266 -0
- package/auth/authorization/nats_registry.d.ts +41 -0
- package/auth/authorization/nats_registry.js +283 -0
- package/auth/authorization/provider_cache.d.ts +90 -0
- package/auth/authorization/provider_cache.js +783 -0
- package/auth/authorization/refresh.d.ts +46 -0
- package/auth/authorization/refresh.js +246 -0
- package/auth/authorization/types.d.ts +207 -0
- package/auth/authorization/types.js +60 -0
- package/auth/authorization_context.d.ts +11 -0
- package/auth/authorization_context.js +10 -0
- package/auth/browser/flow_types.d.ts +84 -0
- package/auth/browser/flow_types.js +70 -0
- package/auth/browser/portal.d.ts +21 -0
- package/auth/browser/portal.js +307 -0
- package/auth/browser/storage.d.ts +26 -0
- package/auth/browser/storage.js +224 -0
- package/auth/browser.d.ts +11 -0
- package/auth/browser.js +10 -0
- package/auth/browser_recovery.d.ts +13 -0
- package/auth/browser_recovery.js +38 -0
- package/auth/device_activation.d.ts +134 -0
- package/auth/device_activation.js +376 -0
- package/auth/http_error.d.ts +12 -0
- package/auth/http_error.js +32 -0
- package/auth/keys.d.ts +5 -0
- package/auth/keys.js +63 -0
- package/auth/mod.d.ts +16 -0
- package/auth/mod.js +16 -0
- package/auth/proof.d.ts +31 -0
- package/auth/proof.js +95 -0
- package/auth/protocol_wasm/trellis_protocol_wasm.d.ts +138 -0
- package/auth/protocol_wasm/trellis_protocol_wasm.js +605 -0
- package/auth/protocol_wasm/trellis_protocol_wasm_bg.wasm +0 -0
- package/auth/protocol_wasm/trellis_protocol_wasm_bytes.d.ts +1 -0
- package/auth/protocol_wasm/trellis_protocol_wasm_bytes.js +2 -0
- package/auth/protocol_wasm.d.ts +179 -0
- package/auth/protocol_wasm.js +133 -0
- package/auth/session_auth.d.ts +30 -0
- package/auth/session_auth.js +77 -0
- package/auth/session_proof.d.ts +53 -0
- package/auth/session_proof.js +43 -0
- package/auth/time.d.ts +6 -0
- package/auth/time.js +7 -0
- package/auth/trellis_id.d.ts +1 -0
- package/auth/trellis_id.js +5 -0
- package/auth/utils.d.ts +10 -0
- package/auth/utils.js +69 -0
- package/auth.d.ts +1 -0
- package/auth.js +1 -0
- package/caller.d.ts +111 -0
- package/caller.js +85 -0
- package/client.d.ts +14 -0
- package/client.js +1 -0
- package/client_connect.d.ts +143 -0
- package/client_connect.js +1097 -0
- package/codec.d.ts +13 -0
- package/codec.js +192 -0
- package/connection.d.ts +107 -0
- package/connection.js +396 -0
- package/device/activation.d.ts +42 -0
- package/device/activation.js +319 -0
- package/device.d.ts +80 -0
- package/device.js +687 -0
- package/env.d.ts +2 -0
- package/env.js +10 -0
- package/errors/AuthError.d.ts +30 -0
- package/errors/AuthError.js +34 -0
- package/errors/KVError.d.ts +30 -0
- package/errors/KVError.js +36 -0
- package/errors/OperationLifecycleError.d.ts +110 -0
- package/errors/OperationLifecycleError.js +142 -0
- package/errors/RemoteError.d.ts +61 -0
- package/errors/RemoteError.js +72 -0
- package/errors/SchemaValidationError.d.ts +48 -0
- package/errors/SchemaValidationError.js +49 -0
- package/errors/StoreError.d.ts +21 -0
- package/errors/StoreError.js +31 -0
- package/errors/TransferError.d.ts +21 -0
- package/errors/TransferError.js +31 -0
- package/errors/TransportError.d.ts +29 -0
- package/errors/TransportError.js +33 -0
- package/errors/TrellisError.d.ts +15 -0
- package/errors/TrellisError.js +15 -0
- package/errors/ValidationError.d.ts +50 -0
- package/errors/ValidationError.js +59 -0
- package/errors/index.d.ts +254 -0
- package/errors/index.js +238 -0
- package/generated.d.ts +4 -0
- package/generated.js +3 -0
- package/generated_support.d.ts +120 -0
- package/generated_support.js +359 -0
- package/globals.d.ts +9 -0
- package/globals.js +16 -0
- package/health_transport.d.ts +18 -0
- package/health_transport.js +32 -0
- package/helpers.d.ts +11 -0
- package/helpers.js +53 -0
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/internal_sdk/generated/apis/auth/mod.d.ts +805 -0
- package/internal_sdk/generated/apis/auth/mod.js +958 -0
- package/internal_sdk/generated/apis/core/mod.d.ts +79 -0
- package/internal_sdk/generated/apis/core/mod.js +93 -0
- package/internal_sdk/generated/apis/events/mod.d.ts +224 -0
- package/internal_sdk/generated/apis/events/mod.js +313 -0
- package/internal_sdk/generated/apis/health/mod.d.ts +106 -0
- package/internal_sdk/generated/apis/health/mod.js +132 -0
- package/internal_sdk/generated/apis/index.d.ts +7 -0
- package/internal_sdk/generated/apis/index.js +8 -0
- package/internal_sdk/generated/apis/jobs/mod.d.ts +176 -0
- package/internal_sdk/generated/apis/jobs/mod.js +209 -0
- package/internal_sdk/generated/apis/state/mod.d.ts +104 -0
- package/internal_sdk/generated/apis/state/mod.js +139 -0
- package/internal_sdk/generated/index.d.ts +4 -0
- package/internal_sdk/generated/index.js +5 -0
- package/internal_sdk/generated/package.json +18 -0
- package/internal_sdk/generated/participants/cli/mod.d.ts +402 -0
- package/internal_sdk/generated/participants/cli/mod.js +460 -0
- package/internal_sdk/generated/participants/cli/types.d.ts +2 -0
- package/internal_sdk/generated/participants/cli/types.js +3 -0
- package/internal_sdk/generated/participants/console/mod.d.ts +489 -0
- package/internal_sdk/generated/participants/console/mod.js +579 -0
- package/internal_sdk/generated/participants/console/types.d.ts +2 -0
- package/internal_sdk/generated/participants/console/types.js +3 -0
- package/internal_sdk/generated/participants/eventsRuntime/mod.d.ts +64 -0
- package/internal_sdk/generated/participants/eventsRuntime/mod.js +42 -0
- package/internal_sdk/generated/participants/eventsRuntime/types.d.ts +2 -0
- package/internal_sdk/generated/participants/eventsRuntime/types.js +3 -0
- package/internal_sdk/generated/participants/healthRuntime/mod.d.ts +58 -0
- package/internal_sdk/generated/participants/healthRuntime/mod.js +36 -0
- package/internal_sdk/generated/participants/healthRuntime/types.d.ts +2 -0
- package/internal_sdk/generated/participants/healthRuntime/types.js +3 -0
- package/internal_sdk/generated/participants/index.d.ts +8 -0
- package/internal_sdk/generated/participants/index.js +9 -0
- package/internal_sdk/generated/participants/jobsRuntime/mod.d.ts +64 -0
- package/internal_sdk/generated/participants/jobsRuntime/mod.js +42 -0
- package/internal_sdk/generated/participants/jobsRuntime/types.d.ts +2 -0
- package/internal_sdk/generated/participants/jobsRuntime/types.js +3 -0
- package/internal_sdk/generated/participants/platform/mod.d.ts +164 -0
- package/internal_sdk/generated/participants/platform/mod.js +149 -0
- package/internal_sdk/generated/participants/platform/types.d.ts +7 -0
- package/internal_sdk/generated/participants/platform/types.js +5 -0
- package/internal_sdk/generated/participants/portal/mod.d.ts +131 -0
- package/internal_sdk/generated/participants/portal/mod.js +109 -0
- package/internal_sdk/generated/participants/portal/types.d.ts +2 -0
- package/internal_sdk/generated/participants/portal/types.js +3 -0
- package/internal_sdk/generated/types/_internal/p0.d.ts +13511 -0
- package/internal_sdk/generated/types/_internal/p0.js +6105 -0
- package/internal_sdk/generated/types/index.d.ts +2951 -0
- package/internal_sdk/generated/types/index.js +1477 -0
- package/jobs.d.ts +309 -0
- package/jobs.js +389 -0
- package/kv.d.ts +85 -0
- package/kv.js +330 -0
- package/operations.d.ts +189 -0
- package/operations.js +847 -0
- package/package.json +73 -0
- package/pagination.d.ts +25 -0
- package/pagination.js +117 -0
- package/participant.d.ts +6 -0
- package/participant.js +6 -0
- package/participant_runtime/api.d.ts +131 -0
- package/participant_runtime/api.js +42 -0
- package/participant_runtime/json.d.ts +16 -0
- package/participant_runtime/json.js +193 -0
- package/participant_runtime/metadata.d.ts +34 -0
- package/participant_runtime/metadata.js +4 -0
- package/participant_runtime/participant.d.ts +200 -0
- package/participant_runtime/participant.js +330 -0
- package/participant_runtime/schemas.d.ts +347 -0
- package/participant_runtime/schemas.js +211 -0
- package/participant_runtime/surface_names.d.ts +16 -0
- package/participant_runtime/surface_names.js +34 -0
- package/portable.d.ts +30 -0
- package/portable.js +14 -0
- package/provider.d.ts +69 -0
- package/provider.js +68 -0
- package/runtime_transport.d.ts +25 -0
- package/runtime_transport.js +48 -0
- package/service/mod.d.ts +14 -0
- package/service/mod.js +13 -0
- package/service/outbox_inbox.d.ts +259 -0
- package/service/outbox_inbox.js +908 -0
- package/service/runtime/bootstrap.d.ts +56 -0
- package/service/runtime/bootstrap.js +226 -0
- package/service/runtime/core.d.ts +46 -0
- package/service/runtime/core.js +1747 -0
- package/service/runtime/health.d.ts +97 -0
- package/service/runtime/health.js +153 -0
- package/service/runtime/health_schemas.d.ts +23 -0
- package/service/runtime/health_schemas.js +20 -0
- package/service/runtime/internal_jobs/active-job.d.ts +40 -0
- package/service/runtime/internal_jobs/active-job.js +91 -0
- package/service/runtime/internal_jobs/bindings.d.ts +40 -0
- package/service/runtime/internal_jobs/bindings.js +1 -0
- package/service/runtime/internal_jobs/cancellation-registry.d.ts +13 -0
- package/service/runtime/internal_jobs/cancellation-registry.js +55 -0
- package/service/runtime/internal_jobs/heartbeat.d.ts +33 -0
- package/service/runtime/internal_jobs/heartbeat.js +65 -0
- package/service/runtime/internal_jobs/job-manager.d.ts +126 -0
- package/service/runtime/internal_jobs/job-manager.js +821 -0
- package/service/runtime/internal_jobs/key-coordinator.d.ts +280 -0
- package/service/runtime/internal_jobs/key-coordinator.js +747 -0
- package/service/runtime/internal_jobs/projection.d.ts +3 -0
- package/service/runtime/internal_jobs/projection.js +42 -0
- package/service/runtime/internal_jobs/runtime-worker.d.ts +126 -0
- package/service/runtime/internal_jobs/runtime-worker.js +454 -0
- package/service/runtime/internal_jobs/types.d.ts +246 -0
- package/service/runtime/internal_jobs/types.js +163 -0
- package/service/runtime/logger.d.ts +2 -0
- package/service/runtime/logger.js +7 -0
- package/service/runtime/runtime.d.ts +16 -0
- package/service/runtime/runtime.js +1 -0
- package/service/runtime/service.d.ts +372 -0
- package/service/runtime/service.js +1896 -0
- package/service/runtime/transfer/download.d.ts +27 -0
- package/service/runtime/transfer/download.js +1 -0
- package/service/runtime/transfer/protocol.d.ts +15 -0
- package/service/runtime/transfer/protocol.js +46 -0
- package/service/runtime/transfer/queue.d.ts +18 -0
- package/service/runtime/transfer/queue.js +136 -0
- package/service/runtime/transfer/upload.d.ts +40 -0
- package/service/runtime/transfer/upload.js +27 -0
- package/service/runtime/transfer.d.ts +62 -0
- package/service/runtime/transfer.js +763 -0
- package/session.d.ts +862 -0
- package/session.js +3407 -0
- package/store.d.ts +71 -0
- package/store.js +412 -0
- package/store_entry.d.ts +20 -0
- package/store_entry.js +75 -0
- package/tasks.d.ts +10 -0
- package/tasks.js +28 -0
- package/telemetry/carrier.d.ts +8 -0
- package/telemetry/carrier.js +20 -0
- package/telemetry/core.d.ts +7 -0
- package/telemetry/core.js +14 -0
- package/telemetry/env.d.ts +2 -0
- package/telemetry/env.js +10 -0
- package/telemetry/init.d.ts +2 -0
- package/telemetry/init.js +7 -0
- package/telemetry/metrics.d.ts +81 -0
- package/telemetry/metrics.js +267 -0
- package/telemetry/mod.d.ts +13 -0
- package/telemetry/mod.js +8 -0
- package/telemetry/nats.d.ts +6 -0
- package/telemetry/nats.js +6 -0
- package/telemetry/result.d.ts +1 -0
- package/telemetry/result.js +18 -0
- package/telemetry/runtime.d.ts +1 -0
- package/telemetry/runtime.js +141 -0
- package/telemetry/trace.d.ts +4 -0
- package/telemetry/trace.js +26 -0
- package/telemetry/trellis.d.ts +1 -0
- package/telemetry/trellis.js +1 -0
- package/telemetry.d.ts +1 -0
- package/telemetry.js +1 -0
- package/transfer.d.ts +112 -0
- package/transfer.js +525 -0
- package/transfer_protocol.d.ts +1 -0
- package/transfer_protocol.js +13 -0
package/auth/mod.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protocol-owned Trellis session keys and proof helpers.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
export { AuthorizationContextBundleSchema, AuthorizationContextCache, AuthorizationContextRefreshError, AuthorizationProviderCache, refreshAuthorizationContext, refreshAuthorizationContextWithMetadata, startAuthorizationContextRefresh, } from "./authorization_context.js";
|
|
7
|
+
export { classifyBrowserAuthError, isRecoverableBrowserAuthError, } from "./browser_recovery.js";
|
|
8
|
+
export { buildDeviceActivationPayload, deriveDeviceConfirmationCode, deriveDeviceIdentity, waitForDeviceActivation, } from "./device_activation.js";
|
|
9
|
+
export { fetchPortalFlowState, portalFlowIdFromUrl, portalProviderLoginUrl, portalRedirectLocation, submitPortalApproval, } from "./browser/portal.js";
|
|
10
|
+
// Context-bound proof helpers for local signing and signature verification.
|
|
11
|
+
export { buildEventProofInput, buildProofInput, createEventProof, createProof, verifyEventProof, verifyProof, } from "./proof.js";
|
|
12
|
+
export { parseSessionProof, SESSION_PROOF_FORMAT_V1, sessionProofRequestDigest, sessionProofSigningDigest, signSessionProof, verifySessionProof, } from "./session_proof.js";
|
|
13
|
+
export { createAuth, } from "./session_auth.js";
|
|
14
|
+
export { correctedIatSeconds, estimateMidpointClockOffsetMs } from "./time.js";
|
|
15
|
+
export { trellisIdFromOriginId } from "./trellis_id.js";
|
|
16
|
+
export { base64urlDecode, base64urlEncode, canonicalizeJsonValue, sha256, toArrayBuffer, utf8, } from "./utils.js";
|
package/auth/proof.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type ProofParams = {
|
|
2
|
+
contextDigest: string;
|
|
3
|
+
subject: string;
|
|
4
|
+
reply: string;
|
|
5
|
+
payloadHash: Uint8Array;
|
|
6
|
+
iat: number;
|
|
7
|
+
requestId: string;
|
|
8
|
+
};
|
|
9
|
+
export type EventProofParams = {
|
|
10
|
+
contextDigest: string;
|
|
11
|
+
descriptorIdentity: string;
|
|
12
|
+
subject: string;
|
|
13
|
+
payloadHash: Uint8Array;
|
|
14
|
+
eventId: string;
|
|
15
|
+
eventTime: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Builds the canonical v1 context-bound request proof input bytes.
|
|
19
|
+
*
|
|
20
|
+
* The exact NATS reply inbox must be created before signing and is bound into
|
|
21
|
+
* the proof input, matching the runtime request verifier.
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildProofInput(contextDigest: string, subject: string, reply: string, payloadHash: Uint8Array, iat: number, requestId: string): Uint8Array;
|
|
24
|
+
/**
|
|
25
|
+
* Builds the canonical v1 context-bound event proof input bytes.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildEventProofInput(contextDigest: string, descriptorIdentity: string, subject: string, payloadHash: Uint8Array, eventId: string, eventTime: string): Uint8Array;
|
|
28
|
+
export declare function createProof(privateKey: CryptoKey, params: ProofParams): Promise<string>;
|
|
29
|
+
export declare function createEventProof(privateKey: CryptoKey, params: EventProofParams): Promise<string>;
|
|
30
|
+
export declare function verifyProof(publicSessionKey: string, params: ProofParams, proofBase64url: string): Promise<boolean>;
|
|
31
|
+
export declare function verifyEventProof(publicSessionKey: string, params: EventProofParams, proofBase64url: string): Promise<boolean>;
|
package/auth/proof.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { base64urlDecode, base64urlEncode, sha256, toArrayBuffer, utf8, } from "./utils.js";
|
|
2
|
+
import { importEd25519PublicKeyFromBase64url } from "./keys.js";
|
|
3
|
+
import { AsyncResult } from "@oatscenter/result";
|
|
4
|
+
const REQUEST_PROOF_DOMAIN = utf8("trellis.authorization-request-proof.v1");
|
|
5
|
+
const EVENT_PROOF_DOMAIN = utf8("trellis.authorization-event-proof.v1");
|
|
6
|
+
function appendLengthPrefixed(buf, view, offset, value) {
|
|
7
|
+
view.setUint32(offset, value.length);
|
|
8
|
+
const valueOffset = offset + 4;
|
|
9
|
+
buf.set(value, valueOffset);
|
|
10
|
+
return valueOffset + value.length;
|
|
11
|
+
}
|
|
12
|
+
function buildLengthPrefixed(components) {
|
|
13
|
+
const total = components.reduce((sum, value) => sum + 4 + value.length, 0);
|
|
14
|
+
const buf = new Uint8Array(total);
|
|
15
|
+
const view = new DataView(buf.buffer);
|
|
16
|
+
let offset = 0;
|
|
17
|
+
for (const component of components) {
|
|
18
|
+
offset = appendLengthPrefixed(buf, view, offset, component);
|
|
19
|
+
}
|
|
20
|
+
return buf;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Builds the canonical v1 context-bound request proof input bytes.
|
|
24
|
+
*
|
|
25
|
+
* The exact NATS reply inbox must be created before signing and is bound into
|
|
26
|
+
* the proof input, matching the runtime request verifier.
|
|
27
|
+
*/
|
|
28
|
+
export function buildProofInput(contextDigest, subject, reply, payloadHash, iat, requestId) {
|
|
29
|
+
const contextDigestBytes = base64urlDecode(contextDigest);
|
|
30
|
+
if (contextDigestBytes.length !== 32) {
|
|
31
|
+
throw new Error("authorization context digest must encode 32 bytes");
|
|
32
|
+
}
|
|
33
|
+
if (reply.length === 0) {
|
|
34
|
+
throw new Error("request reply subject must not be empty");
|
|
35
|
+
}
|
|
36
|
+
return buildLengthPrefixed([
|
|
37
|
+
REQUEST_PROOF_DOMAIN,
|
|
38
|
+
contextDigestBytes,
|
|
39
|
+
utf8(subject),
|
|
40
|
+
utf8(reply),
|
|
41
|
+
payloadHash,
|
|
42
|
+
utf8(String(iat)),
|
|
43
|
+
utf8(requestId),
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Builds the canonical v1 context-bound event proof input bytes.
|
|
48
|
+
*/
|
|
49
|
+
export function buildEventProofInput(contextDigest, descriptorIdentity, subject, payloadHash, eventId, eventTime) {
|
|
50
|
+
const contextDigestBytes = base64urlDecode(contextDigest);
|
|
51
|
+
if (contextDigestBytes.length !== 32) {
|
|
52
|
+
throw new Error("authorization context digest must encode 32 bytes");
|
|
53
|
+
}
|
|
54
|
+
return buildLengthPrefixed([
|
|
55
|
+
EVENT_PROOF_DOMAIN,
|
|
56
|
+
contextDigestBytes,
|
|
57
|
+
utf8(descriptorIdentity),
|
|
58
|
+
utf8(subject),
|
|
59
|
+
payloadHash,
|
|
60
|
+
utf8(eventId),
|
|
61
|
+
utf8(eventTime),
|
|
62
|
+
]);
|
|
63
|
+
}
|
|
64
|
+
export async function createProof(privateKey, params) {
|
|
65
|
+
const input = buildProofInput(params.contextDigest, params.subject, params.reply, params.payloadHash, params.iat, params.requestId);
|
|
66
|
+
const digest = await sha256(input);
|
|
67
|
+
const sig = await crypto.subtle.sign({ name: "Ed25519" }, privateKey, toArrayBuffer(digest));
|
|
68
|
+
return base64urlEncode(new Uint8Array(sig));
|
|
69
|
+
}
|
|
70
|
+
export async function createEventProof(privateKey, params) {
|
|
71
|
+
const input = buildEventProofInput(params.contextDigest, params.descriptorIdentity, params.subject, params.payloadHash, params.eventId, params.eventTime);
|
|
72
|
+
const digest = await sha256(input);
|
|
73
|
+
const sig = await crypto.subtle.sign({ name: "Ed25519" }, privateKey, toArrayBuffer(digest));
|
|
74
|
+
return base64urlEncode(new Uint8Array(sig));
|
|
75
|
+
}
|
|
76
|
+
export async function verifyProof(publicSessionKey, params, proofBase64url) {
|
|
77
|
+
const result = await AsyncResult.try(async () => {
|
|
78
|
+
const input = buildProofInput(params.contextDigest, params.subject, params.reply, params.payloadHash, params.iat, params.requestId);
|
|
79
|
+
const digest = await sha256(input);
|
|
80
|
+
const signature = base64urlDecode(proofBase64url);
|
|
81
|
+
const pub = await importEd25519PublicKeyFromBase64url(publicSessionKey);
|
|
82
|
+
return crypto.subtle.verify({ name: "Ed25519" }, pub, toArrayBuffer(signature), toArrayBuffer(digest));
|
|
83
|
+
});
|
|
84
|
+
return result.unwrapOr(false);
|
|
85
|
+
}
|
|
86
|
+
export async function verifyEventProof(publicSessionKey, params, proofBase64url) {
|
|
87
|
+
const result = await AsyncResult.try(async () => {
|
|
88
|
+
const input = buildEventProofInput(params.contextDigest, params.descriptorIdentity, params.subject, params.payloadHash, params.eventId, params.eventTime);
|
|
89
|
+
const digest = await sha256(input);
|
|
90
|
+
const signature = base64urlDecode(proofBase64url);
|
|
91
|
+
const pub = await importEd25519PublicKeyFromBase64url(publicSessionKey);
|
|
92
|
+
return crypto.subtle.verify({ name: "Ed25519" }, pub, toArrayBuffer(signature), toArrayBuffer(digest));
|
|
93
|
+
});
|
|
94
|
+
return result.unwrapOr(false);
|
|
95
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Opaque Rust-owned authorization context retained for repeated proof verification.
|
|
6
|
+
*/
|
|
7
|
+
export class VerifiedAuthorizationContextHandle {
|
|
8
|
+
private constructor();
|
|
9
|
+
free(): void;
|
|
10
|
+
[Symbol.dispose](): void;
|
|
11
|
+
/**
|
|
12
|
+
* Require the retained context to be eligible at the supplied current time.
|
|
13
|
+
*/
|
|
14
|
+
assert_current(policy_json: string): void;
|
|
15
|
+
/**
|
|
16
|
+
* Return the verified context projection used by the TypeScript cache.
|
|
17
|
+
*/
|
|
18
|
+
projection(): string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Verify an online-issued context once and retain it inside WASM.
|
|
23
|
+
*/
|
|
24
|
+
export function create_authorization_context_handle(issuer_json: string, context_json: string, policy_json: string, historical: boolean): VerifiedAuthorizationContextHandle;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Decode and query-bind a shared versioned pagination cursor.
|
|
28
|
+
*/
|
|
29
|
+
export function decode_pagination_cursor(encoded: string, query_digest: string): string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Encode a JSON value as a shared versioned pagination cursor.
|
|
33
|
+
*/
|
|
34
|
+
export function encode_pagination_cursor(query_digest: string, after_json: string): string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Derive an API-qualified event base subject.
|
|
38
|
+
*/
|
|
39
|
+
export function event_subject(api_id: string, action: string): string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Compute the shared query binding for an opaque pagination cursor.
|
|
43
|
+
*/
|
|
44
|
+
export function pagination_query_digest(endpoint: string, query_json: string): string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Parse and normalize one strict JSON-encoded session-proof envelope.
|
|
48
|
+
*/
|
|
49
|
+
export function parse_session_proof(proof_json: string): string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Return the canonical request digest for a JSON-encoded proof-bearing request.
|
|
53
|
+
*/
|
|
54
|
+
export function session_proof_request_digest(request_json: string): string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Return the canonical signing digest for a JSON-encoded purpose-specific input.
|
|
58
|
+
*/
|
|
59
|
+
export function session_proof_signing_digest(input_json: string): string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Verify a live context with its authenticated online issuer entry.
|
|
63
|
+
*/
|
|
64
|
+
export function verify_authorization_context(issuer_json: string, context_json: string, policy_json: string): string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Verify one context-bound authorization event proof from a JSON argument.
|
|
68
|
+
*
|
|
69
|
+
* The result is always a JSON object. Successful results have `ok: true` and
|
|
70
|
+
* contain verified publisher/context metadata; rejected inputs have `ok: false`
|
|
71
|
+
* and a stable authorization error code and path. Event context chains are
|
|
72
|
+
* checked at their signed historical boundary before the strict event-time
|
|
73
|
+
* window is evaluated.
|
|
74
|
+
*/
|
|
75
|
+
export function verify_authorization_event(context: VerifiedAuthorizationContextHandle, event_json: string, payload: Uint8Array): string;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Verify one context-bound authorization request proof from a JSON argument.
|
|
79
|
+
*
|
|
80
|
+
* The result is always a JSON object. Successful results have `ok: true` and
|
|
81
|
+
* contain the verified context digest; rejected inputs have `ok: false`
|
|
82
|
+
* and a stable authorization error code and path.
|
|
83
|
+
*/
|
|
84
|
+
export function verify_authorization_request(context: VerifiedAuthorizationContextHandle, request_json: string, payload: Uint8Array): string;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Verify a JSON-encoded session proof.
|
|
88
|
+
*/
|
|
89
|
+
export function verify_session_proof(input_json: string, proof_json: string, signer_public_key: string, now_ms: number, maximum_age_ms: number, maximum_future_skew_ms: number): void;
|
|
90
|
+
|
|
91
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
92
|
+
|
|
93
|
+
export interface InitOutput {
|
|
94
|
+
readonly memory: WebAssembly.Memory;
|
|
95
|
+
readonly __wbg_verifiedauthorizationcontexthandle_free: (a: number, b: number) => void;
|
|
96
|
+
readonly create_authorization_context_handle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number];
|
|
97
|
+
readonly decode_pagination_cursor: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
98
|
+
readonly encode_pagination_cursor: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
99
|
+
readonly event_subject: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
100
|
+
readonly pagination_query_digest: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
101
|
+
readonly parse_session_proof: (a: number, b: number) => [number, number, number, number];
|
|
102
|
+
readonly session_proof_request_digest: (a: number, b: number) => [number, number, number, number];
|
|
103
|
+
readonly session_proof_signing_digest: (a: number, b: number) => [number, number, number, number];
|
|
104
|
+
readonly verifiedauthorizationcontexthandle_assert_current: (a: number, b: number, c: number) => [number, number];
|
|
105
|
+
readonly verifiedauthorizationcontexthandle_projection: (a: number) => [number, number, number, number];
|
|
106
|
+
readonly verify_authorization_context: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
107
|
+
readonly verify_authorization_event: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
108
|
+
readonly verify_authorization_request: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
109
|
+
readonly verify_session_proof: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
|
|
110
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
111
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
112
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
113
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
114
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
115
|
+
readonly __wbindgen_start: () => void;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
122
|
+
* a precompiled `WebAssembly.Module`.
|
|
123
|
+
*
|
|
124
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
125
|
+
*
|
|
126
|
+
* @returns {InitOutput}
|
|
127
|
+
*/
|
|
128
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
132
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
133
|
+
*
|
|
134
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
135
|
+
*
|
|
136
|
+
* @returns {Promise<InitOutput>}
|
|
137
|
+
*/
|
|
138
|
+
export default function __wbg_init (module_or_path: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|