/* tslint:disable */ /* eslint-disable */ /** * JS-callable handle to a long-lived pairing-host runtime shared by product * cores. */ export class WasmPairingHostRuntime { private constructor(); free(): void; [Symbol.dispose](): void; /** * Take one reference on the product's worker for a modality holder. The * first one reports `"Start"` to the host's `requestWorkerTransition` * callback. Pair every call with one `releaseWorker`. An id that is not a * product id is logged and dropped. */ acquireWorker(raw_product_id: string): void; /** * Activate an externally persisted canonical session without writing it * to core storage; resolves only after product frames may use it. */ activateExternalSession(blob: Uint8Array): Promise; /** * Restore the persisted auth session and resolve only after it is active. */ activateStoredSession(): Promise; /** * Cancel an in-flight pairing flow. */ cancelPairing(): void; /** * Clear one product's durable and in-memory capability state and the * values it wrote to product storage. */ clearProductState(raw_product_id: string): Promise; /** * Build a shared runtime from host-level platform callbacks and host * config. Resolves once the core has read its stack record from the * host's core storage, or after a few seconds without it. */ static create(callbacks: any, host_config: any): Promise; /** * Read this device's X25519 encryption secret, the one behind * `deviceEncPublicKey`, or `undefined` before pairing. */ deviceEncryptionKey(): Promise; /** * Read the active session's sr25519 statement-store secret, or * `undefined` when no session is active. */ deviceStatementKey(): Uint8Array | undefined; /** * Disconnect the shared account-authority session. */ disconnectSession(): Promise; /** * Notify the runtime that the host's contacts changed, so cached contact * handles are dropped and the next resolution reads the list. */ notifyContactsChanged(): void; /** * Notify the runtime that the auth session slot may have changed. */ notifySessionStoreChanged(): void; /** * Read a permission authorization status for a product. * * A device capability resolves the host application's OS gate as well as * storage, so an OS refusal reads as `Denied` whatever is stored. Remote, * identity-disclosure and account-access decisions have no OS gate. */ permissionAuthorizationStatus(raw_product_id: string, payload: Uint8Array): Promise; /** * Read permission authorization statuses for a product. * * A device capability resolves the host application's OS gate as well as * storage, so an OS refusal reads as `Denied` whatever is stored. Remote, * identity-disclosure and account-access decisions have no OS gate. */ permissionAuthorizationStatuses(raw_product_id: string, payloads: Array): Promise>; /** * Build one product-scoped runtime from this pairing host runtime. */ productRuntime(product: any, core_callbacks: any): WasmProductRuntime; /** * Resolve a product's hard-subtree public key from the cache, the * persisted slot, or the Account Holder. `timeoutMs` bounds that wait and * exceeding it rejects. `undefined` when no session is active. */ productSubtreePublicKey(raw_product_id: string, timeout_ms?: number | null): Promise; /** * Fetch the stack's descriptor now instead of when the copy is an hour * old. Returns at once. A status the fetch changes arrives through * `stackChanged`, and `stackStatus()` reads it at any time. Does nothing * for a test stack or without a `fetchStackDescriptor` callback. */ refreshStack(): void; /** * Release one reference. The last one reports `"Stop"`, after which the * host may stop the worker; releasing with none held is a no-op, and so * is an id that is not a product id. */ releaseWorker(raw_product_id: string): void; /** * Clear canonical paired-session state without notifying the peer. */ resetSessionState(): Promise; /** * Read the active session's X25519 chat identity private key, or * `undefined` when no session is active. */ sessionChatIdentityKey(): Uint8Array | undefined; /** * Update a stored permission authorization status for a product. */ setPermissionAuthorizationStatus(raw_product_id: string, payload: Uint8Array, status: string): Promise; /** * Keep preimage submissions in the core instead of the Bulletin chain. * * For a test host whose wallet answers allowances in-page: the Bulletin * allowance it hands out was never authorized on chain, so a real `store` * would be refused at dry-run. The product gets the content key back and * reads the value from the core's lookup cache, as after a landed * submission. A refused Bulletin allowance still refuses the submission. */ setSubmitPreimagesLocally(local: boolean): void; /** * The stack the runtime runs: `{ descriptor, generation, stale, expired, * restartRequired, lastRefresh? }`, the value the `stackChanged` * callback receives. `undefined` for a test stack. */ stackStatus(): any; /** * Report that the product's worker stopped running without being asked * to. While references remain, `"Start"` is reported again to the * host's `requestWorkerTransition` callback. An id that is not a product * id is logged and dropped. */ workerExited(product_id: string): void; } /** * JS-callable handle to one product-scoped TrUAPI core. */ export class WasmProductRuntime { private constructor(); free(): void; [Symbol.dispose](): void; /** * Build the core from a JS callbacks object. The object must define * every host capability the [`crate::platform::Platform`] trait set * requires (camelCase property names; see the source for the full * list). Resolves once the core has read its stack record from the host's * core storage, or after a few seconds without it. A product runtime * built on its own starts from that record but does not refresh the * descriptor: it has no `stackStatus` or `refreshStack`, and a host * runtime is what keeps the stack current. */ static create(callbacks: any, runtime_config: any): Promise; /** * Core-owned logout/disconnect. Best-effort notifies the SSO peer when * the session has channel material, then clears in-memory and persisted * session state. */ disconnectSession(): Promise; /** * Tear down the bridge. Invokes the JS-side `dispose` callback so the * host can drop its end of the wiring. */ dispose(): void; /** * Notify the runtime that the host's contacts changed, so cached contact * handles are dropped and the next resolution asks the host. */ notifyContactsChanged(): void; /** * Read a permission authorization status without prompting. * * A device capability resolves the host application's OS gate as well as * storage, so an OS refusal reads as `Denied` whatever is stored. Remote, * identity-disclosure and account-access decisions have no OS gate. * * `payload` is a SCALE-encoded `PermissionAuthorizationRequest`. */ permissionAuthorizationStatus(payload: Uint8Array): Promise; /** * Read permission authorization statuses without prompting. * * A device capability resolves the host application's OS gate as well as * storage, so an OS refusal reads as `Denied` whatever is stored. Remote, * identity-disclosure and account-access decisions have no OS gate. * * `payloads` is an array of SCALE-encoded * `PermissionAuthorizationRequest` values. Results follow the same order. */ permissionAuthorizationStatuses(payloads: Array): Promise>; /** * Publish one host-authored Chat action into this connection's action * stream, buffered until the product subscribes. Takes a SCALE-encoded * `HostChatActionSubscribeItem`. */ publishChatAction(action: Uint8Array): void; /** * Publish one action triggered inside a product-rendered body, buffered * until the product subscribes. Takes a SCALE-encoded * `HostRendererActionSubscribeItem`. */ publishRendererAction(item: Uint8Array): void; /** * Push a SCALE-encoded protocol frame into the dispatcher. Responses * (and subscription items) flow back through the `emitFrame` * callback. */ receiveFrame(frame: Uint8Array): Promise; /** * Start the host-initiated render subscription for one body. `request` is * a SCALE-encoded `ProductRendererRenderRequest`. `onUpdate` receives each * replacement tree as a SCALE-encoded `RendererNode`. Exactly one terminal * follows: `onComplete` when the stream ended with the last tree standing, * or `onError` when the product could not serve the render and the last * tree is partial. Rejects when this connection may not render. */ render(request: Uint8Array, on_update: Function, on_complete: Function, on_error: Function): WasmRendererSubscription; /** * Update a stored permission authorization status. Passing * `"NotDetermined"` clears the stored value so the next product request * prompts again. */ setPermissionAuthorizationStatus(payload: Uint8Array, status: string): Promise; } /** * Cancellable observation of one render instance. Dropping the handle on the * JS side does not stop the stream; call `cancel`. */ export class WasmRendererSubscription { private constructor(); free(): void; [Symbol.dispose](): void; /** * Stop delivering renderer updates. Idempotent. */ cancel(): void; } /** * JS-callable handle to a wallet-local signing-host runtime. */ export class WasmSigningHostRuntime { private constructor(); free(): void; [Symbol.dispose](): void; /** * Take one reference on the product's worker for a modality holder. The * first one reports `"Start"` to the host's `requestWorkerTransition` * callback. Pair every call with one `releaseWorker`. An id that is not a * product id is logged and dropped. */ acquireWorker(raw_product_id: string): void; /** * Activate a wallet-local session from raw BIP-39 entropy. */ activateLocalSession(secret: Uint8Array): Promise; /** * Activate a wallet-local session and attach known identity metadata. */ activateLocalSessionWithIdentity(secret: Uint8Array, lite_username?: string | null): Promise; /** * Revoke one product's grants from the current local activation and * clear the values it wrote to product storage. */ clearProductState(raw_product_id: string): Promise; /** * Build a shared signing runtime from host callbacks and host config. * Resolves once the core has read its stack record from the host's core * storage, or after a few seconds without it. */ static create(callbacks: any, host_config: any): Promise; /** * Disconnect the active wallet-local session. */ disconnectSession(): Promise; /** * Notify the runtime that the host's contacts changed, so cached contact * handles are dropped and the next resolution reads the list. */ notifyContactsChanged(): void; /** * Read a permission authorization status for a product. * * A device capability resolves the host application's OS gate as well as * storage, so an OS refusal reads as `Denied` whatever is stored. Remote, * identity-disclosure and account-access decisions have no OS gate. */ permissionAuthorizationStatus(raw_product_id: string, payload: Uint8Array): Promise; /** * Read permission authorization statuses for a product. * * A device capability resolves the host application's OS gate as well as * storage, so an OS refusal reads as `Denied` whatever is stored. Remote, * identity-disclosure and account-access decisions have no OS gate. */ permissionAuthorizationStatuses(raw_product_id: string, payloads: Array): Promise>; /** * Build one product-scoped runtime from this signing host. */ productRuntime(product: any, core_callbacks: any): WasmProductRuntime; /** * The product's hard-subtree public key, derived from the active session * root, or `undefined` while no session is active. * * Paired with `deriveProductAccountPublicKey` and `productAccountAddress` * this gives a host the product's address without asking the product. */ productSubtreePublicKey(raw_product_id: string): Uint8Array | undefined; /** * Fetch the stack's descriptor now instead of when the copy is an hour * old. Returns at once. A status the fetch changes arrives through * `stackChanged`, and `stackStatus()` reads it at any time. Does nothing * for a test stack or without a `fetchStackDescriptor` callback. */ refreshStack(): void; /** * Release one reference. The last one reports `"Stop"`, after which the * host may stop the worker; releasing with none held is a no-op, and so * is an id that is not a product id. */ releaseWorker(raw_product_id: string): void; /** * Answer resource allocation as granted without performing it. * * A test host serves suites that exercise allowance-dependent product * paths without an on-chain personhood identity. Nothing is allocated, so * a green run says the product handles a grant, not that a host would * have given one. * * Preimage submissions then stay in the core: the Bulletin allowance was * never authorized on chain, so a real `store` would be refused. The * product gets the content key back and reads the value from the core's * lookup cache, as after a landed submission. */ setGrantAllowancesUnchecked(granted: boolean): void; /** * Update a stored permission authorization status for a product. */ setPermissionAuthorizationStatus(raw_product_id: string, payload: Uint8Array, status: string): Promise; /** * Keep preimage submissions in the core instead of the Bulletin chain. * * For a test host whose wallet answers allowances in-page: the Bulletin * allowance it hands out was never authorized on chain, so a real `store` * would be refused at dry-run. The product gets the content key back and * reads the value from the core's lookup cache, as after a landed * submission. A refused Bulletin allowance still refuses the submission. */ setSubmitPreimagesLocally(local: boolean): void; /** * Answer these resource tags as refused, replacing any earlier set. * * A suite proving its product survives a refused resource needs that one * withheld while the rest stay granted. The tag is the * `AllocatableResource` variant name, so `SmartContractAllowance` * withholds every derivation index. */ setWithheldResources(tags: string[]): void; /** * The stack the runtime runs: `{ descriptor, generation, stale, expired, * restartRequired, lastRefresh? }`, the value the `stackChanged` * callback receives. `undefined` for a test stack. */ stackStatus(): any; /** * Report that the product's worker stopped running without being asked * to. While references remain, `"Start"` is reported again to the * host's `requestWorkerTransition` callback. An id that is not a product * id is logged and dropped. */ workerExited(product_id: string): void; } /** * Soft-derive a product account public key from a product's hard-subtree key * and a SCALE-encoded `DerivationIndex`. * * The index crosses encoded rather than as a number so the chain code stays * core-owned: a host that rebuilds it wrongly gets a valid-looking wrong * address rather than an error. */ export function deriveProductAccountPublicKey(product_subtree_public_key: Uint8Array, derivation_index: Uint8Array): Uint8Array; /** * Derive a product's hard-subtree public key from a session's root entropy. * * Pure: no runtime and no session, so a test harness can work out the address * a product will be given before it starts a host. The entropy is the same 32 * bytes `activateLocalSession` takes. */ export function deriveProductSubtreePublicKey(root_entropy: Uint8Array, raw_product_id: string): Uint8Array; /** * Strictly decode a SCALE-encoded core-storage key for host storage policy. */ export function describeCoreStorageKey(encoded: Uint8Array): any; /** * Whether `productId` is a first-party product the host grants every * `RemotePermission` without prompting. * * Trusted products bypass recorded permissions and permission prompts. Device * permissions still need the OS grant. Hosts mediating product network access * can use this check before storage. * * Normalizes before matching, and answers `false` for an id that does not * normalize, so an unknown spelling is never read as trusted. */ export function hasTrustedRemotePermissions(raw_product_id: string): boolean; /** * Validate and normalize an identifier before the host stores it. */ export function parseProductId(value: string): string; /** * Format a product account public key as the SS58 address host-spec C.6 * mandates, so hosts do not each pick a prefix. */ export function productAccountAddress(public_key: Uint8Array): string; /** * The key the host stores `product_id`'s storage entry `key` under. * * Pure, so a test host can seed an entry where the core will read it without * rebuilding the core's namespacing or its product id normalization. */ export function productStorageKey(product_id: string, key: string): string; /** * The ring-VRF member for `entropy`, derived through the module this core * loads on demand. * * For test hosts: it shows the core finds `truapi_verifiable` beside it and accepts * the build it pins, which no product call reaches without a chain. */ export function ringVrfMember(entropy: Uint8Array): Promise; /** * Set the live log level (`off`/`error`/`warn`/`info`/`debug`/`trace`). * Hosts may call this during boot, or again at any time to re-tune verbosity. * Unknown values are parsed as `off`. */ export function setLogLevel(level: string): void; /** * This core's wire-contract fingerprint, for a host to stamp on each debug * envelope it forwards to the debugger. * * The frames a web host taps are encoded by *this* core, so the identity the * debugger checks has to come from here. A host that stamped its JS client's * hash instead would attest to a table it did not encode with: `dist/wasm/web/` * is a hand-built, gitignored artifact, so a stale core paired with a fresh * client would pass the identity check while emitting frames from a different * contract - exactly the silent mis-decode the fingerprint exists to stop. */ export function wireSchemaHash(): string; export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export interface InitOutput { readonly memory: WebAssembly.Memory; readonly __wbg_wasmpairinghostruntime_free: (a: number, b: number) => void; readonly __wbg_wasmproductruntime_free: (a: number, b: number) => void; readonly __wbg_wasmrenderersubscription_free: (a: number, b: number) => void; readonly __wbg_wasmsigninghostruntime_free: (a: number, b: number) => void; readonly deriveProductAccountPublicKey: (a: number, b: number, c: number, d: number, e: number) => void; readonly deriveProductSubtreePublicKey: (a: number, b: number, c: number, d: number, e: number) => void; readonly describeCoreStorageKey: (a: number, b: number, c: number) => void; readonly hasTrustedRemotePermissions: (a: number, b: number) => number; readonly parseProductId: (a: number, b: number, c: number) => void; readonly productAccountAddress: (a: number, b: number, c: number) => void; readonly productStorageKey: (a: number, b: number, c: number, d: number, e: number) => void; readonly ringVrfMember: (a: number, b: number) => number; readonly setLogLevel: (a: number, b: number) => void; readonly wasmpairinghostruntime_acquireWorker: (a: number, b: number, c: number) => void; readonly wasmpairinghostruntime_activateExternalSession: (a: number, b: number, c: number) => number; readonly wasmpairinghostruntime_activateStoredSession: (a: number) => number; readonly wasmpairinghostruntime_cancelPairing: (a: number) => void; readonly wasmpairinghostruntime_clearProductState: (a: number, b: number, c: number) => number; readonly wasmpairinghostruntime_create: (a: number, b: number) => number; readonly wasmpairinghostruntime_deviceEncryptionKey: (a: number) => number; readonly wasmpairinghostruntime_deviceStatementKey: (a: number, b: number) => void; readonly wasmpairinghostruntime_disconnectSession: (a: number) => number; readonly wasmpairinghostruntime_notifyContactsChanged: (a: number) => void; readonly wasmpairinghostruntime_notifySessionStoreChanged: (a: number) => void; readonly wasmpairinghostruntime_permissionAuthorizationStatus: (a: number, b: number, c: number, d: number, e: number) => number; readonly wasmpairinghostruntime_permissionAuthorizationStatuses: (a: number, b: number, c: number, d: number) => number; readonly wasmpairinghostruntime_productRuntime: (a: number, b: number, c: number, d: number) => void; readonly wasmpairinghostruntime_productSubtreePublicKey: (a: number, b: number, c: number, d: number) => number; readonly wasmpairinghostruntime_refreshStack: (a: number) => void; readonly wasmpairinghostruntime_releaseWorker: (a: number, b: number, c: number) => void; readonly wasmpairinghostruntime_resetSessionState: (a: number) => number; readonly wasmpairinghostruntime_sessionChatIdentityKey: (a: number, b: number) => void; readonly wasmpairinghostruntime_setPermissionAuthorizationStatus: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number; readonly wasmpairinghostruntime_setSubmitPreimagesLocally: (a: number, b: number) => void; readonly wasmpairinghostruntime_stackStatus: (a: number) => number; readonly wasmpairinghostruntime_workerExited: (a: number, b: number, c: number) => void; readonly wasmproductruntime_create: (a: number, b: number) => number; readonly wasmproductruntime_disconnectSession: (a: number) => number; readonly wasmproductruntime_dispose: (a: number, b: number) => void; readonly wasmproductruntime_notifyContactsChanged: (a: number) => void; readonly wasmproductruntime_permissionAuthorizationStatus: (a: number, b: number, c: number) => number; readonly wasmproductruntime_permissionAuthorizationStatuses: (a: number, b: number) => number; readonly wasmproductruntime_publishChatAction: (a: number, b: number, c: number, d: number) => void; readonly wasmproductruntime_publishRendererAction: (a: number, b: number, c: number, d: number) => void; readonly wasmproductruntime_receiveFrame: (a: number, b: number, c: number) => number; readonly wasmproductruntime_render: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void; readonly wasmproductruntime_setPermissionAuthorizationStatus: (a: number, b: number, c: number, d: number, e: number) => number; readonly wasmrenderersubscription_cancel: (a: number) => void; readonly wasmsigninghostruntime_acquireWorker: (a: number, b: number, c: number) => void; readonly wasmsigninghostruntime_activateLocalSession: (a: number, b: number, c: number) => number; readonly wasmsigninghostruntime_activateLocalSessionWithIdentity: (a: number, b: number, c: number, d: number, e: number) => number; readonly wasmsigninghostruntime_clearProductState: (a: number, b: number, c: number) => number; readonly wasmsigninghostruntime_create: (a: number, b: number) => number; readonly wasmsigninghostruntime_disconnectSession: (a: number) => number; readonly wasmsigninghostruntime_notifyContactsChanged: (a: number) => void; readonly wasmsigninghostruntime_permissionAuthorizationStatus: (a: number, b: number, c: number, d: number, e: number) => number; readonly wasmsigninghostruntime_permissionAuthorizationStatuses: (a: number, b: number, c: number, d: number) => number; readonly wasmsigninghostruntime_productRuntime: (a: number, b: number, c: number, d: number) => void; readonly wasmsigninghostruntime_productSubtreePublicKey: (a: number, b: number, c: number, d: number) => void; readonly wasmsigninghostruntime_refreshStack: (a: number) => void; readonly wasmsigninghostruntime_releaseWorker: (a: number, b: number, c: number) => void; readonly wasmsigninghostruntime_setGrantAllowancesUnchecked: (a: number, b: number) => void; readonly wasmsigninghostruntime_setPermissionAuthorizationStatus: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number; readonly wasmsigninghostruntime_setSubmitPreimagesLocally: (a: number, b: number) => void; readonly wasmsigninghostruntime_setWithheldResources: (a: number, b: number, c: number) => void; readonly wasmsigninghostruntime_stackStatus: (a: number) => number; readonly wasmsigninghostruntime_workerExited: (a: number, b: number, c: number) => void; readonly wireSchemaHash: (a: number) => void; readonly __wasm_bindgen_func_elem_21935: (a: number, b: number, c: number, d: number) => void; readonly __wasm_bindgen_func_elem_21937: (a: number, b: number, c: number, d: number) => void; readonly __wasm_bindgen_func_elem_7303: (a: number, b: number, c: number) => void; readonly __wasm_bindgen_func_elem_7304: (a: number, b: number, c: number) => void; readonly __wasm_bindgen_func_elem_17136: (a: number, b: number) => void; readonly __wasm_bindgen_func_elem_7305: (a: number, b: number) => void; readonly __wbindgen_export: (a: number, b: number) => number; readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number; readonly __wbindgen_export3: (a: number) => void; readonly __wbindgen_export4: (a: number, b: number, c: number) => void; readonly __wbindgen_export5: (a: number, b: number) => void; readonly __wbindgen_add_to_stack_pointer: (a: number) => number; } export type SyncInitInput = BufferSource | WebAssembly.Module; /** * Instantiates the given `module`, which can either be bytes or * a precompiled `WebAssembly.Module`. * * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. * * @returns {InitOutput} */ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; /** * If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * * @param {{ module_or_path: InitInput | Promise }} module_or_path - Passing `InitInput` directly is deprecated. * * @returns {Promise} */ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise } | InitInput | Promise): Promise;