@oatscenter/trellis 0.100.0-rc.1 → 0.100.0-rc.3

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.
Files changed (260) hide show
  1. package/auth/admission.d.ts +14 -0
  2. package/auth/admission.js +87 -0
  3. package/auth/authority.d.ts +166 -0
  4. package/auth/authority.js +1249 -0
  5. package/auth/authorization/transport_state.d.ts +94 -0
  6. package/auth/authorization/transport_state.js +162 -0
  7. package/auth/browser/oauth.d.ts +114 -0
  8. package/auth/browser/oauth.js +487 -0
  9. package/auth/browser/storage.d.ts +68 -23
  10. package/auth/browser/storage.js +335 -204
  11. package/auth/browser.d.ts +4 -4
  12. package/auth/browser.js +4 -4
  13. package/auth/browser_recovery.d.ts +1 -1
  14. package/auth/browser_recovery.js +18 -5
  15. package/auth/connection.d.ts +53 -0
  16. package/auth/connection.js +641 -0
  17. package/auth/crypto.d.ts +55 -0
  18. package/auth/crypto.js +167 -0
  19. package/auth/device_activation.d.ts +1 -41
  20. package/auth/device_activation.js +30 -94
  21. package/auth/http_error.d.ts +14 -1
  22. package/auth/http_error.js +33 -6
  23. package/auth/issuer_metadata.d.ts +15 -0
  24. package/auth/issuer_metadata.js +79 -0
  25. package/auth/issuer_trust.d.ts +3 -0
  26. package/auth/issuer_trust.js +75 -0
  27. package/auth/keys.d.ts +6 -4
  28. package/auth/keys.js +8 -54
  29. package/auth/mod.d.ts +4 -4
  30. package/auth/mod.js +5 -4
  31. package/auth/proof.d.ts +12 -30
  32. package/auth/proof.js +17 -94
  33. package/auth/protocol_wasm/trellis_protocol_wasm.d.ts +304 -28
  34. package/auth/protocol_wasm/trellis_protocol_wasm.js +1288 -143
  35. package/auth/protocol_wasm/trellis_protocol_wasm_bg.wasm +0 -0
  36. package/auth/protocol_wasm/trellis_protocol_wasm_bytes.d.ts +1 -1
  37. package/auth/protocol_wasm/trellis_protocol_wasm_bytes.js +1 -1
  38. package/auth/protocol_wasm.d.ts +778 -135
  39. package/auth/protocol_wasm.js +315 -66
  40. package/auth/session_auth.d.ts +11 -7
  41. package/auth/session_auth.js +18 -28
  42. package/auth/session_proof.d.ts +6 -26
  43. package/auth/session_proof.js +7 -11
  44. package/auth/utils.js +8 -4
  45. package/caller.d.ts +75 -20
  46. package/caller.js +42 -11
  47. package/client.d.ts +3 -6
  48. package/client_connect.d.ts +44 -128
  49. package/client_connect.js +188 -1078
  50. package/codec.js +3 -1
  51. package/connection.d.ts +47 -0
  52. package/connection.js +137 -12
  53. package/data_plane/credit.d.ts +22 -0
  54. package/data_plane/credit.js +33 -0
  55. package/data_plane/flow.d.ts +41 -0
  56. package/data_plane/flow.js +121 -0
  57. package/device/activation.d.ts +2 -0
  58. package/device/activation.js +32 -6
  59. package/device.d.ts +43 -6
  60. package/device.js +160 -422
  61. package/errors/KVError.js +1 -1
  62. package/errors/RemoteError.js +1 -2
  63. package/errors/SchemaValidationError.js +1 -3
  64. package/errors/StoreError.js +1 -1
  65. package/errors/TransferError.js +1 -1
  66. package/generated.d.ts +1 -1
  67. package/generated_support.d.ts +46 -7
  68. package/generated_support.js +106 -48
  69. package/health_transport.d.ts +10 -15
  70. package/health_transport.js +55 -30
  71. package/internal_sdk/generated/apis/auth/mod.d.ts +740 -356
  72. package/internal_sdk/generated/apis/auth/mod.js +682 -234
  73. package/internal_sdk/generated/apis/core/mod.d.ts +9 -5
  74. package/internal_sdk/generated/apis/core/mod.js +9 -5
  75. package/internal_sdk/generated/apis/events/mod.d.ts +30 -18
  76. package/internal_sdk/generated/apis/events/mod.js +20 -8
  77. package/internal_sdk/generated/apis/health/mod.d.ts +24 -10
  78. package/internal_sdk/generated/apis/health/mod.js +21 -8
  79. package/internal_sdk/generated/apis/jobs/mod.d.ts +34 -10
  80. package/internal_sdk/generated/apis/jobs/mod.js +30 -8
  81. package/internal_sdk/generated/apis/state/mod.d.ts +38 -24
  82. package/internal_sdk/generated/apis/state/mod.js +43 -18
  83. package/internal_sdk/generated/apps/cli/mod.d.ts +530 -0
  84. package/internal_sdk/generated/apps/cli/mod.js +789 -0
  85. package/internal_sdk/generated/apps/console/mod.d.ts +670 -0
  86. package/internal_sdk/generated/apps/console/mod.js +1013 -0
  87. package/internal_sdk/generated/apps/index.d.ts +3 -0
  88. package/internal_sdk/generated/apps/index.js +4 -0
  89. package/internal_sdk/generated/index.d.ts +1 -0
  90. package/internal_sdk/generated/index.js +1 -0
  91. package/internal_sdk/generated/package.json +2 -2
  92. package/internal_sdk/generated/participants/eventsRuntime/mod.d.ts +121 -9
  93. package/internal_sdk/generated/participants/eventsRuntime/mod.js +118 -9
  94. package/internal_sdk/generated/participants/healthRuntime/mod.d.ts +11 -4
  95. package/internal_sdk/generated/participants/healthRuntime/mod.js +10 -6
  96. package/internal_sdk/generated/participants/index.d.ts +0 -3
  97. package/internal_sdk/generated/participants/index.js +0 -3
  98. package/internal_sdk/generated/participants/jobsRuntime/mod.d.ts +122 -9
  99. package/internal_sdk/generated/participants/jobsRuntime/mod.js +119 -9
  100. package/internal_sdk/generated/participants/platform/mod.d.ts +72 -59
  101. package/internal_sdk/generated/participants/platform/mod.js +80 -74
  102. package/internal_sdk/generated/participants/platform/types.d.ts +8 -6
  103. package/internal_sdk/generated/participants/platform/types.js +4 -3
  104. package/internal_sdk/generated/types/_internal/p0.d.ts +1651 -6092
  105. package/internal_sdk/generated/types/_internal/p0.js +981 -2537
  106. package/internal_sdk/generated/types/index.d.ts +442 -1682
  107. package/internal_sdk/generated/types/index.js +221 -841
  108. package/jobs.d.ts +17 -0
  109. package/jobs.js +73 -24
  110. package/kv.d.ts +41 -17
  111. package/kv.js +341 -102
  112. package/live/authority.d.ts +61 -0
  113. package/live/authority.js +176 -0
  114. package/live/client_open.d.ts +66 -0
  115. package/live/client_open.js +938 -0
  116. package/live/deadlines.d.ts +88 -0
  117. package/live/deadlines.js +316 -0
  118. package/live/manager.d.ts +87 -0
  119. package/live/manager.js +323 -0
  120. package/live/operation_source.d.ts +37 -0
  121. package/live/operation_source.js +50 -0
  122. package/live/protocol.d.ts +1 -0
  123. package/live/protocol.js +1 -0
  124. package/live/provider.d.ts +127 -0
  125. package/live/provider.js +1121 -0
  126. package/live/subscription.d.ts +118 -0
  127. package/live/subscription.js +449 -0
  128. package/live/telemetry.d.ts +57 -0
  129. package/live/telemetry.js +141 -0
  130. package/live/types.d.ts +30 -0
  131. package/live/types.js +53 -0
  132. package/native/connection.d.ts +37 -0
  133. package/native/connection.js +204 -0
  134. package/native/custody.d.ts +71 -0
  135. package/native/custody.js +165 -0
  136. package/native/discovery.d.ts +15 -0
  137. package/native/discovery.js +137 -0
  138. package/native/oauth.d.ts +92 -0
  139. package/native/oauth.js +454 -0
  140. package/native.d.ts +7 -0
  141. package/native.js +5 -0
  142. package/operations.d.ts +75 -13
  143. package/operations.js +372 -127
  144. package/own_authority.d.ts +41 -0
  145. package/own_authority.js +152 -0
  146. package/package.json +29 -20
  147. package/pagination.js +21 -14
  148. package/participant_runtime/api.d.ts +7 -9
  149. package/participant_runtime/api.js +6 -10
  150. package/participant_runtime/json.js +15 -77
  151. package/participant_runtime/participant.d.ts +67 -26
  152. package/participant_runtime/participant.js +42 -99
  153. package/participant_runtime/schemas.d.ts +2 -0
  154. package/participant_runtime/schemas.js +4 -11
  155. package/participant_runtime/surface_names.js +9 -4
  156. package/portable.d.ts +8 -4
  157. package/portable.js +4 -2
  158. package/provider.d.ts +48 -28
  159. package/provider.js +31 -10
  160. package/runtime_transport.d.ts +8 -1
  161. package/runtime_transport.js +10 -3
  162. package/service/mod.d.ts +1 -1
  163. package/service/outbox_inbox.d.ts +2 -1
  164. package/service/outbox_inbox.js +23 -24
  165. package/service/runtime/bootstrap.d.ts +1 -54
  166. package/service/runtime/bootstrap.js +2 -221
  167. package/service/runtime/core.d.ts +62 -7
  168. package/service/runtime/core.js +2402 -621
  169. package/service/runtime/health.js +0 -4
  170. package/service/runtime/internal_jobs/active-job.d.ts +11 -0
  171. package/service/runtime/internal_jobs/active-job.js +28 -3
  172. package/service/runtime/internal_jobs/history.d.ts +6 -0
  173. package/service/runtime/internal_jobs/history.js +30 -0
  174. package/service/runtime/internal_jobs/job-manager.d.ts +12 -3
  175. package/service/runtime/internal_jobs/job-manager.js +321 -147
  176. package/service/runtime/internal_jobs/key-coordinator.d.ts +5 -0
  177. package/service/runtime/internal_jobs/key-coordinator.js +228 -109
  178. package/service/runtime/internal_jobs/managed-worker.d.ts +18 -0
  179. package/service/runtime/internal_jobs/managed-worker.js +282 -0
  180. package/service/runtime/internal_jobs/runtime-worker.d.ts +63 -24
  181. package/service/runtime/internal_jobs/runtime-worker.js +457 -176
  182. package/service/runtime/operation_record.d.ts +54 -0
  183. package/service/runtime/operation_record.js +124 -0
  184. package/service/runtime/runtime.d.ts +3 -3
  185. package/service/runtime/service.d.ts +185 -39
  186. package/service/runtime/service.js +637 -446
  187. package/service/runtime/transfer/protocol.d.ts +1 -12
  188. package/service/runtime/transfer/protocol.js +2 -37
  189. package/service/runtime/transfer/queue.d.ts +17 -4
  190. package/service/runtime/transfer/queue.js +74 -39
  191. package/service/runtime/transfer.d.ts +37 -7
  192. package/service/runtime/transfer.js +885 -676
  193. package/session.d.ts +302 -118
  194. package/session.js +2296 -1228
  195. package/store.d.ts +28 -10
  196. package/store.js +341 -43
  197. package/store_entry.d.ts +7 -6
  198. package/store_entry.js +10 -25
  199. package/store_reader.d.ts +4 -0
  200. package/store_reader.js +326 -0
  201. package/telemetry/browser.d.ts +49 -0
  202. package/telemetry/browser.js +235 -0
  203. package/telemetry/carrier.d.ts +30 -0
  204. package/telemetry/carrier.js +93 -6
  205. package/telemetry/core.d.ts +7 -0
  206. package/telemetry/core.js +10 -2
  207. package/telemetry/init.d.ts +2 -2
  208. package/telemetry/init.js +9 -3
  209. package/telemetry/lifecycle.d.ts +42 -0
  210. package/telemetry/lifecycle.js +139 -0
  211. package/telemetry/metrics.d.ts +50 -0
  212. package/telemetry/metrics.js +252 -6
  213. package/telemetry/mod.d.ts +7 -2
  214. package/telemetry/mod.js +4 -2
  215. package/telemetry/runtime.d.ts +42 -1
  216. package/telemetry/runtime.js +349 -85
  217. package/telemetry/trace.d.ts +8 -2
  218. package/telemetry/trace.js +14 -10
  219. package/telemetry/trellis.d.ts +1 -1
  220. package/telemetry/trellis.js +1 -1
  221. package/transfer/session.d.ts +57 -0
  222. package/transfer/session.js +468 -0
  223. package/transfer.d.ts +70 -91
  224. package/transfer.js +579 -448
  225. package/transport/generations.d.ts +422 -0
  226. package/transport/generations.js +2323 -0
  227. package/auth/authorization/client_context.d.ts +0 -61
  228. package/auth/authorization/client_context.js +0 -266
  229. package/auth/authorization/nats_registry.d.ts +0 -41
  230. package/auth/authorization/nats_registry.js +0 -283
  231. package/auth/authorization/provider_cache.d.ts +0 -90
  232. package/auth/authorization/provider_cache.js +0 -783
  233. package/auth/authorization/refresh.d.ts +0 -46
  234. package/auth/authorization/refresh.js +0 -246
  235. package/auth/authorization/types.d.ts +0 -207
  236. package/auth/authorization/types.js +0 -60
  237. package/auth/authorization_context.d.ts +0 -11
  238. package/auth/authorization_context.js +0 -10
  239. package/auth/browser/flow_types.d.ts +0 -84
  240. package/auth/browser/flow_types.js +0 -70
  241. package/auth/browser/portal.d.ts +0 -21
  242. package/auth/browser/portal.js +0 -307
  243. package/internal_sdk/generated/participants/cli/mod.d.ts +0 -402
  244. package/internal_sdk/generated/participants/cli/mod.js +0 -460
  245. package/internal_sdk/generated/participants/cli/types.d.ts +0 -2
  246. package/internal_sdk/generated/participants/cli/types.js +0 -3
  247. package/internal_sdk/generated/participants/console/mod.d.ts +0 -489
  248. package/internal_sdk/generated/participants/console/mod.js +0 -579
  249. package/internal_sdk/generated/participants/console/types.d.ts +0 -2
  250. package/internal_sdk/generated/participants/console/types.js +0 -3
  251. package/internal_sdk/generated/participants/portal/mod.d.ts +0 -131
  252. package/internal_sdk/generated/participants/portal/mod.js +0 -109
  253. package/internal_sdk/generated/participants/portal/types.d.ts +0 -2
  254. package/internal_sdk/generated/participants/portal/types.js +0 -3
  255. package/service/runtime/transfer/download.d.ts +0 -27
  256. package/service/runtime/transfer/download.js +0 -1
  257. package/service/runtime/transfer/upload.d.ts +0 -40
  258. package/service/runtime/transfer/upload.js +0 -27
  259. package/transfer_protocol.d.ts +0 -1
  260. package/transfer_protocol.js +0 -13
@@ -0,0 +1,14 @@
1
+ import type { NatsConnection } from "@nats-io/nats-core";
2
+ import type { SessionAuthorityOwner } from "./authority.ts";
3
+ import { type AdmissionContext } from "./protocol_wasm.ts";
4
+ import type { TrellisAuth } from "./session_auth.ts";
5
+ /** Obtain exact own-context bytes through the native signed-admission protocol. No application I/O is enabled here. */
6
+ export declare function requestOwnAdmission(options: {
7
+ nc: NatsConnection;
8
+ owner: SessionAuthorityOwner;
9
+ auth: TrellisAuth;
10
+ runtimeId: string;
11
+ attachmentId: string;
12
+ timeoutMs: number;
13
+ signal?: AbortSignal;
14
+ }): Promise<AdmissionContext>;
@@ -0,0 +1,87 @@
1
+ import { QueuedIteratorImpl } from "@nats-io/nats-core/internal";
2
+ import { ulid } from "ulid";
3
+ import {} from "./protocol_wasm.js";
4
+ import { base64urlDecode, base64urlEncode, sha256, utf8 } from "./utils.js";
5
+ /** Obtain exact own-context bytes through the native signed-admission protocol. No application I/O is enabled here. */
6
+ export async function requestOwnAdmission(options) {
7
+ const { nc, owner, auth, runtimeId, signal } = options;
8
+ const deadline = Date.now() + options.timeoutMs;
9
+ const keyDigest = base64urlEncode(await sha256(base64urlDecode(auth.sessionKey)));
10
+ const subject = `trellis.auth.admission.${keyDigest}.get`;
11
+ const reply = `_INBOX.trellis.${keyDigest}.${ulid()}`;
12
+ const request = {
13
+ trellisInstanceId: owner.instanceId,
14
+ runtimeId,
15
+ sessionPublicKey: auth.sessionKey,
16
+ attachmentId: options.attachmentId,
17
+ requestNonce: base64urlEncode(crypto.getRandomValues(new Uint8Array(16))),
18
+ issuedAt: auth.currentIat(),
19
+ };
20
+ const signedRequest = await auth.signAdmissionGet(request, subject, reply);
21
+ if (signal?.aborted)
22
+ throw signal.reason;
23
+ if (Date.now() >= deadline)
24
+ throw new Error("AdmissionTimeout");
25
+ const pending = Promise.withResolvers();
26
+ let settled = false;
27
+ let verifying = 0;
28
+ const sub = nc.subscribe(reply, {
29
+ callback: (error, message) => {
30
+ if (settled)
31
+ return;
32
+ if (error) {
33
+ pending.reject(error);
34
+ return;
35
+ }
36
+ if (verifying >= 8 || message.data.length > 2 * 1024 * 1024)
37
+ return;
38
+ verifying++;
39
+ void owner
40
+ .verifyAdmissionContext(message.data, request, subject, reply)
41
+ .then((response) => {
42
+ if (settled || signal?.aborted || Date.now() >= deadline)
43
+ return;
44
+ settled = true;
45
+ pending.resolve(response);
46
+ })
47
+ .catch(() => {
48
+ /* Forged candidates never consume the legitimate pending lookup. */
49
+ })
50
+ .finally(() => {
51
+ verifying--;
52
+ });
53
+ },
54
+ });
55
+ const statuses = nc.status();
56
+ if (!(statuses instanceof QueuedIteratorImpl)) {
57
+ sub.unsubscribe();
58
+ throw new Error("AdmissionStatusUnavailable");
59
+ }
60
+ const statusTask = (async () => {
61
+ for await (const status of statuses) {
62
+ if (status.type === "disconnect" || status.type === "close") {
63
+ pending.reject(new Error("AdmissionDisconnected"));
64
+ break;
65
+ }
66
+ }
67
+ })().catch((error) => pending.reject(error));
68
+ const abort = () => pending.reject(signal?.reason ?? new DOMException("Aborted", "AbortError"));
69
+ const timer = setTimeout(() => pending.reject(new Error("AdmissionTimeout")), Math.max(0, deadline - Date.now()));
70
+ signal?.addEventListener("abort", abort, { once: true });
71
+ try {
72
+ if (signal?.aborted)
73
+ throw signal.reason;
74
+ nc.publish(subject, utf8(signedRequest), {
75
+ reply,
76
+ });
77
+ return await pending.promise;
78
+ }
79
+ finally {
80
+ settled = true;
81
+ clearTimeout(timer);
82
+ signal?.removeEventListener("abort", abort);
83
+ sub.unsubscribe();
84
+ statuses.stop();
85
+ await statusTask;
86
+ }
87
+ }
@@ -0,0 +1,166 @@
1
+ import { type NatsConnection } from "@nats-io/nats-core";
2
+ import { type AdmissionGet, type AdmissionContext, type AuthorityIssuerKey, type AuthenticatedCaller, type CatalogActionIdentity, type OriginalEventPublication, type SessionAuthority, type SessionAuthorityHandle, type SessionAuthorityVerificationPolicy, type SessionEvent, type SessionRequest, type SessionResponse, type IssuerMetadataQuery, type IssuerMetadataResponse } from "./protocol_wasm.ts";
3
+ import { type JsonValue } from "./utils.ts";
4
+ declare const authorityLeaseToken: unique symbol;
5
+ type RecordObject = {
6
+ [key: string]: JsonValue;
7
+ };
8
+ type CachedAuthority = {
9
+ /** Private admission candidates cannot serve application frames before commit. */
10
+ unpublished?: boolean;
11
+ handle: SessionAuthorityHandle;
12
+ authority: SessionAuthority;
13
+ digest: string;
14
+ references: number;
15
+ retired: boolean;
16
+ byteLength: number;
17
+ };
18
+ /** Signed bootstrap registry locations. These are runtime internals, never app authoring input. */
19
+ export type AuthorityRegistryBinding = {
20
+ materialBucket: string;
21
+ revocationBucket: string;
22
+ issuer: AuthorityIssuerKey;
23
+ rotationSequence: string;
24
+ };
25
+ /** Exact sent request retained until a verified reply or the ordinary timeout. */
26
+ export type PendingSessionRequest = {
27
+ request: SessionRequest;
28
+ proofDigest: string;
29
+ action: CatalogActionIdentity;
30
+ expectedDeploymentId: string | null;
31
+ };
32
+ /** Short-lived typed identity lease; cannot be constructed from unverified JSON. */
33
+ export declare class VerifiedAuthority {
34
+ #private;
35
+ private constructor();
36
+ /** Only the common owner can lend authenticated state. */
37
+ static acquire(token: typeof authorityLeaseToken, owner: SessionAuthorityOwner, entry: CachedAuthority): VerifiedAuthority;
38
+ /** Authenticated fields; no authority is inferred merely from identity. */
39
+ get authority(): Readonly<SessionAuthority>;
40
+ /** Content address of the exact immutable signed context. */
41
+ get digest(): string;
42
+ /** Whether checked transport publication has released this private candidate. @internal */
43
+ get published(): boolean;
44
+ /** Internal verifier access requires the module-private lease token. */
45
+ entry(token: typeof authorityLeaseToken): CachedAuthority;
46
+ /** Verified logical caller identity usable by all SDK adapters. */
47
+ get caller(): AuthenticatedCaller;
48
+ /** Time and observed retirement are checked again immediately before authorized work. */
49
+ assertCurrent(): void;
50
+ /** Authorize a dispatcher action through its actual signed whole-capability membership. */
51
+ authorize(apiId: string, action: CatalogActionIdentity): Promise<void>;
52
+ /** Check one action against the verified authority and its exact accepted catalog. */
53
+ allows(apiId: string, action: CatalogActionIdentity): Promise<boolean>;
54
+ /** Return authenticated catalog evidence bound to this exact live authority. @internal */
55
+ authenticatedCatalog(apiId: string): Promise<Readonly<RecordObject> | undefined>;
56
+ /** Check the Auth-certified implementation, not consumer capability authority. */
57
+ authorizeProvider(apiId: string, generation: string, action: CatalogActionIdentity): Promise<void>;
58
+ /** Release local material only; accepted domain work is not rolled back. */
59
+ release(): void;
60
+ }
61
+ /** Selected installation and current active issuer authenticated by the common authority owner's rotation chain. */
62
+ export type RuntimeAuthorizationTrust = Readonly<{
63
+ instanceId: string;
64
+ account: string;
65
+ issuer: Readonly<AuthorityIssuerKey>;
66
+ rotationSequence: string;
67
+ }>;
68
+ /** One authority owner per runtime: pinned trust, bounded peer material, one revocation mirror. */
69
+ export declare class SessionAuthorityOwner {
70
+ #private;
71
+ readonly instanceId: string;
72
+ readonly account: string;
73
+ /** Supply issuer pins from trusted provisioning or selected HTTPS discovery, not peer material. */
74
+ constructor(options: {
75
+ instanceId: string;
76
+ account: string;
77
+ issuers: readonly AuthorityIssuerKey[];
78
+ rotationSequence?: string;
79
+ now?: () => number;
80
+ });
81
+ /** Snapshot current authenticated issuer trust and its durable rotation floor; does not discover or advance trust. */
82
+ get trustSnapshot(): RuntimeAuthorizationTrust;
83
+ /** Obtain successor trust only from this owner's verified chain rooted at the exact retained credential pin. */
84
+ trustForCredential(anchor: RuntimeAuthorizationTrust): RuntimeAuthorizationTrust;
85
+ /** Attach read-only public material and one snapshot-and-update mirror for all logical sessions. */
86
+ attach(nats: NatsConnection, binding: AuthorityRegistryBinding, options?: {
87
+ signal?: AbortSignal;
88
+ timeoutMs?: number;
89
+ inboxPrefix?: string;
90
+ }): Promise<void>;
91
+ /** Verify an issuer-signed lookup reply against the actual pending ephemeral request. */
92
+ verifyAdmissionContext(bytes: Uint8Array, request: AdmissionGet, subject: string, reply: string): Promise<AdmissionContext>;
93
+ /** Clock and bounds shared by all request/event/provider verification. */
94
+ policy(): SessionAuthorityVerificationPolicy;
95
+ /** Install non-evictable own authority only after complete signature, scope, key and lifecycle checks. */
96
+ get ownDigest(): string | undefined;
97
+ /** Whether a verified sticky retirement affects the installed own logical session, even while its live lease is unavailable. */
98
+ get ownRevoked(): boolean;
99
+ /** Loss of current revocation coverage requiring private snapshot recovery. */
100
+ get coverageLost(): boolean;
101
+ /** Verified retirement observed by the runtime's single mirror. */
102
+ isRevoked(sessionId: string): boolean;
103
+ /** Observe promotion and sticky lifecycle changes, without a per-context subscription. */
104
+ subscribeChanges(callback: () => void): () => void;
105
+ /** Install non-evictable own authority only after complete signature, scope, key and lifecycle checks. */
106
+ installOwn(bytes: Uint8Array, expected: {
107
+ runtimeId: string;
108
+ sessionPublicKey: string;
109
+ binding?: SessionAuthority["binding"];
110
+ }): Promise<VerifiedAuthority>;
111
+ /** Verify a private candidate; commit only at checked transport publication. */
112
+ prepareOwn(bytes: Uint8Array, expected: {
113
+ runtimeId: string;
114
+ sessionPublicKey: string;
115
+ binding?: SessionAuthority["binding"];
116
+ }): Promise<{
117
+ readonly digest: string;
118
+ readonly authority: Readonly<SessionAuthority>;
119
+ assertPreparedCurrent(): void;
120
+ retain(): VerifiedAuthority;
121
+ commit(): void;
122
+ dispose(): void;
123
+ }>;
124
+ /** Borrow the current own authority, which peer-cache pressure can never evict. */
125
+ own(): VerifiedAuthority;
126
+ /** Suspend application intake when the logical transport has no current generation. */
127
+ setTransportAvailable(available: boolean): void;
128
+ /** Resolve immutable peer material once per digest, bounded independently from active local identity. */
129
+ peer(digest: string): Promise<VerifiedAuthority>;
130
+ /** Authenticate and authorize an exact incoming request without exposing a raw decoded caller. */
131
+ verifyRequest(request: SessionRequest, payload: Uint8Array, proof: string, action: CatalogActionIdentity, role?: "consumer" | "provider"): Promise<{
132
+ caller: VerifiedAuthority;
133
+ requestProofDigest: string;
134
+ }>;
135
+ /** Verify actual provider result bytes against the still-pending opening, not response-supplied correlation. */
136
+ verifyResponse(response: SessionResponse, payload: Uint8Array, proof: string, receivedSubject: string, pending: PendingSessionRequest): Promise<Extract<AuthenticatedCaller["binding"], {
137
+ kind: "service" | "device";
138
+ }>>;
139
+ /** Verify an event live, or at the original trusted JetStream publication rather than replay time. */
140
+ verifyEvent(event: SessionEvent, payload: Uint8Array, proof: string, action: CatalogActionIdentity, originalPublication?: OriginalEventPublication | null): Promise<AuthenticatedCaller>;
141
+ /** Apply a verified sticky logical retirement; false mirror records are discarded before any mutation. */
142
+ observeRevocation(bytes: Uint8Array, expectedSession?: string, originCurrent?: () => boolean): Promise<void>;
143
+ /** Recheck observed revocation and expiry after every cold asynchronous boundary. */
144
+ assertCurrent(entry: CachedAuthority): void;
145
+ /** Shared authorization used by RPC, events and long-lived adapters. */
146
+ authorize(entry: CachedAuthority, apiId: string, action: CatalogActionIdentity, historical?: boolean, publication?: {
147
+ at: number;
148
+ publishedAt?: number;
149
+ }): Promise<void>;
150
+ /** Check an advisory action without treating verification failure as ordinary denial. */
151
+ allows(entry: CachedAuthority, apiId: string, action: CatalogActionIdentity, historical?: boolean, publication?: {
152
+ at: number;
153
+ publishedAt?: number;
154
+ }): Promise<boolean>;
155
+ /** Resolve immutable catalog evidence for one API bound to a live verified authority. @internal */
156
+ authenticatedCatalog(entry: CachedAuthority, apiId: string): Promise<Readonly<RecordObject> | undefined>;
157
+ /** Authenticate the provider certificate and exact advertised action for a retained endpoint. */
158
+ authorizeProvider(entry: CachedAuthority, apiId: string, generation: string, action: CatalogActionIdentity): Promise<void>;
159
+ /** Stop owned local work without erasing durable OAuth credentials or published historical material. */
160
+ stop(): void;
161
+ /** Read public verification material using a fresh, pinned-issuer authenticated exchange. */
162
+ readIssuerMetadata(query: IssuerMetadataQuery): Promise<IssuerMetadataResponse>;
163
+ /** Authenticate one signed successor from this owner's existing durable pin. */
164
+ acceptIssuerRotation(bytes: Uint8Array): Promise<void>;
165
+ }
166
+ export {};