import * as S from "@parity/truapi/scale"; import { AllocatableResource, Bytes32, CodeFormat, ExecutableKind, FundingDirection, FundingQuote, FundingQuoteRefusal, HostAccountSignVrfRequest, HostDevicePermissionRequest, HostSignPayloadRequest, HostSignPayloadWithLegacyAccountRequest, HostSignRawRequest, HostSignRawWithLegacyAccountRequest, LegacyAccountTxPayload, NftPurseOwner, ProductAccountId, ProductAccountTxPayload, ProductId, ProductProofContext, RemotePermissionRequest, RingLocation } from "@parity/truapi"; import type { FundingFrameOutcome, FundingFrameTarget, GenericError, HostChatCreateRoomRequest, HostChatCreateRoomResponse, HostChatListSubscribeItem, HostChatPostMessageRequest, HostChatPostMessageResponse, HostChatRegisterBotRequest, HostChatRegisterBotResponse, HostChatSetRoomFooterRequest, HostFeatureSupportedRequest, HostFeatureSupportedResponse, HostFundingStatusSubscribeItem, HostLocalStorageChangeItem, HostLocaleSubscribeItem, HostPaymentBalanceSubscribeError, HostPaymentBalanceSubscribeItem, HostPaymentRequest, HostPaymentStatusSubscribeError, HostPaymentStatusSubscribeItem, HostPaymentTopUpRequest, HostPaymentTopUpStatusSubscribeError, HostPaymentTopUpStatusSubscribeItem, HostPocketListSubscribeItem, HostPocketRemoveCardRequest, HostPushNotificationRequest, HostPushNotificationResponse, HostScannerScanRequest, HostThemeSubscribeItem, HostWorkerBeginOperationResponse, Result } from "@parity/truapi"; /** * Review shown before a product asks to access another product account. */ export interface AccountAccessReview { /** * Product currently handling the request. */ requestingProductId: ProductId; /** * Product whose account is being requested. */ targetProductId: ProductId; } /** * Review shown before a product derives a contextual alias (RFC 0004). */ export interface AccountAliasReview { /** * Product requesting the alias. */ callingProductId: ProductId; /** * Product-scoped context the alias is bound to. */ context: ProductProofContext; /** * Ring the alias is derived against. */ ringLocation: RingLocation; } /** * Auth/session lifecycle state the core projects for host UI. The core owns * every transition and emits states in order; hosts render the current state * and never derive auth UI from any other signal. */ export type AuthState = /** * No active session and no login in progress. */ { tag: "Disconnected"; value?: undefined; } /** * A login is in progress: present the pairing deeplink/QR. Leave this * state only on a subsequent emission (connected, failed, or * disconnected after cancellation). */ | { tag: "Pairing"; value: { deeplink: string; }; } /** * A session is active. */ | { tag: "Connected"; value: SessionUiInfo; } /** * The last login attempt failed; show the reason and offer a retry. */ | { tag: "LoginFailed"; value: { kind: LoginFailureKind; reason: string; }; } /** * The wallet accepted the pairing request and the core is resolving and * persisting the session. Hosts should replace the pairing QR with an * in-progress presentation until a terminal state is emitted. */ | { tag: "Authenticating"; value?: undefined; }; /** * A chain the host builds as V5 general transactions, and the transaction * extension pipeline it uses there. */ export interface ChainExtensionVersion { /** * Genesis hash of the chain. */ genesisHash: Bytes32; /** * The pipeline's number in the chain's metadata. */ extensionVersion: number; } /** * Core-owned host-private storage slots. Products never address these slots; * the host chooses the backing store for each slot. * * Storage is host-local; `storage.md` records the current status quo: * */ export type CoreStorageKey = /** * Opaque SSO/auth session blob. */ { tag: "AuthSession"; value?: undefined; } /** * Pairing device identity used during SSO flows. */ | { tag: "PairingDeviceIdentity"; value?: undefined; } /** * Persisted authorization for one product-scoped permission request. */ | { tag: "PermissionAuthorization"; value: { scope: string; request: StoredPermissionRequest; }; } /** * Persisted allowance-slot keys for one paired SSO session. */ | { tag: "AllowanceKeys"; value: { sessionId: string; }; } /** * Last processed SSO pairing response statement for the pairing device. */ | { tag: "LastProcessedPairingStatement"; value?: undefined; } /** * Legacy unscoped RFC-0010 AutoSigning secret. Core only addresses this * slot to reject and erase pre-scoping entries. */ | { tag: "AutoSigningKey"; value: { productId: ProductId; }; } /** * Wallet-bound RFC-0010 AutoSigning capabilities for the active pairing. */ | { tag: "AutoSigningKeys"; value?: undefined; } /** * Wallet-bound RFC-0024 ring-VRF registry snapshot. */ | { tag: "RingVrfRegistry"; value: { rootPublicKey: Uint8Array; }; } /** * Statement-store allowance targets the signing host keeps renewed. */ | { tag: "StatementRenewalTargets"; value?: undefined; } /** * This device's long-lived X25519 encryption secret, advertised to peers * as the device encryption public key. Random rather than identity-derived * so devices restoring one identity stay individually addressable. * * Hosts must back this slot with storage scoped to the install, outliving * logout and any per-user namespacing: once it changes, peers addressing * the previous key can no longer reach this device. */ | { tag: "DeviceEncryptionKey"; value?: undefined; } /** * One product's hard-subtree public key, as the Account Holder answered it * for this paired session. Product account is a hard derivation, so the * answer is fixed for the pair and read back instead of re-asking the * wallet on every launch. * * The value is the 32-byte key with no framing, so a host can derive * product account addresses from the slot it already stores. These are * public keys: every address derived from them already appears on the * reviews the host draws. */ | { tag: "ProductSubtree"; value: { sessionId: string; productId: ProductId; }; } /** * Signing-host request replay state for one wallet and pairing peer. * * The value is a versioned, bounded replay ledger owned by the core. */ | { tag: "SsoResponderRequestLedger"; value: { rootPublicKey: Uint8Array; peerStatementAccountId: Uint8Array; peerEncryptionPublicKey: Uint8Array; }; } /** * Cached root manifest of one product, as published to dotNS. * * The value carries the manifest JSON alongside the time it was read. The * core honours it for a bounded lifetime, which is what makes a revoked * trust grant eventually take effect. */ | { tag: "ProductManifest"; value: { productLabel: string; }; } /** * A product's Worker executable manifest as last read from dotNS, and when, * cached for the same lifetime as `Self::ProductManifest`. */ | { tag: "WorkerManifest"; value: { productLabel: string; }; } /** * What funding providers' quote answers showed about what they serve, * each record trusted for twelve hours. */ | { tag: "FundingSupport"; value?: undefined; } /** * A product's App executable manifest as last read from dotNS, and when, * cached for the same lifetime as `Self::ProductManifest`. */ | { tag: "AppManifest"; value: { productLabel: string; }; } /** * The last descriptor a browser core verified for a stack, so its next * start does not go back to the bundled copy. A native core keeps this * record in its own database instead. */ | { tag: "StackRecord"; value: { stackId: string; }; }; /** * Review shown before a product creates a ring-VRF proof (RFC 0004). */ export interface CreateProofReview { /** * Product requesting the proof. */ callingProductId: ProductId; /** * Product-scoped context the proof's alias is bound to. */ context: ProductProofContext; /** * Ring the proof is generated against. */ ringLocation: RingLocation; /** * Opaque message bound into the proof. */ message: Uint8Array; } /** * Review shown before a transaction-creation request is sent to the paired wallet. */ export type CreateTransactionReview = /** * Product-account transaction request. */ { tag: "Product"; value: { callingProductId?: ProductId; payload: ProductAccountTxPayload; }; } /** * Legacy-account transaction request. */ | { tag: "LegacyAccount"; value: { account: LegacySigningAccount; payload: LegacyAccountTxPayload; }; }; /** * A kind of signature a product makes with another product's account. * * The user approves each kind separately: approving one never lets another * through without a prompt. */ export type CrossProductSignatureKind = "Payload" | "Transaction" | "Raw" | "StatementProof"; /** * What the operating system currently says about a device capability. * * Distinct from `PermissionAuthorizationStatus`, which is the product-scoped * decision the user made through TrUAPI. The two answer different questions * and are combined rather than substituted: a capability is usable only when * the product holds a grant *and* the OS still allows it. */ export type DevicePermissionStatus = "Granted" | "Denied" | "NotDetermined" | "NotApplicable"; /** * What the host did with a request to cover or uncover the expanded card face. */ export type ExpandedCardFaceOutcome = "Applied" | "NotPresented" | "UserMoving" | "Unsupported"; /** * What the host did with a request to turn the expanded card. */ export type ExpandedCardTurnOutcome = "Applied" | "NotPresented" | "UserMoving" | "Unsupported" | "NoBack"; /** * The chains a host builds as V5 general transactions. A chain not listed is * built as V4. */ export interface ExtensionVersionMap { /** * One entry per V5 chain. */ chains: Array; } /** * Why an amount cannot go ahead. */ export type FundingAmountIssue = /** * A withdrawal of more than the user can spend. */ { tag: "NotEnoughBalance"; value?: undefined; } /** * Below the smallest amount any provider takes. */ | { tag: "BelowMinimum"; value: { min: bigint; }; } /** * Above the largest amount any provider takes. */ | { tag: "AboveMaximum"; value: { max: bigint; }; }; /** * How the user left the funding overlay. */ export type FundingPresentOutcome = "Started" | "Dismissed"; /** * A funding session as the host overlay needs it to open on the right screen. */ export interface FundingPresentation { /** * Session id. */ intent: string; /** * Which way value moves, which decides the screen the overlay opens on. */ direction: FundingDirection; /** * Amount the caller asked for, or ``undefined`` to let the user choose. */ amount?: bigint; } /** * The providers' quotes for one ask, as the host draws its provider list. */ export interface FundingQuoteList { /** * The request this list answers, as `request_funding_quotes` returned * it. The core keeps only the current request's list, so a list read * back is always the one to show. */ requestId: bigint; /** * One row per provider asked, in the host's provider order. */ rows: Array; /** * The provider whose quote is best for the user, which the host selects * until the user picks another: the least to pay inbound, the most to * receive outbound. ``undefined`` until one quotes. */ best?: ProductId; /** * When the core asks every provider again, in Unix milliseconds. Each * row keeps its answer until the provider answers again. */ refreshAtMs: bigint; /** * The amount the list prices, in balance units, which `issue` is * about. */ amount: bigint; /** * Once every provider answered and none quoted, the reason they all * gave. ``undefined`` while any is pending or quoted, or when they gave * different reasons. */ refusal?: FundingQuoteUnavailable; /** * Once every provider answered and none quoted, what their refusals * say about the amount: the lowest minimum any showed, otherwise the * highest maximum. */ issue?: FundingAmountIssue; /** * Whether every provider answered: no row is pending. */ complete: boolean; } /** * One provider's place in the list a quote request fills in. */ export interface FundingQuoteRow { /** * The provider. */ providerId: ProductId; /** * Where its quote stands. */ state: FundingQuoteState; } /** * Where a provider's quote stands. */ export type FundingQuoteState = /** * Asked, not answered yet. */ { tag: "Pending"; value?: undefined; } /** * The provider's price. */ | { tag: "Quoted"; value: { quote: FundingQuote; }; } /** * The provider cannot be offered for this ask; the host shows it * disabled. */ | { tag: "Unavailable"; value: { reason: FundingQuoteUnavailable; }; }; /** * Why a provider cannot be offered for an ask. */ export type FundingQuoteUnavailable = /** * The provider refused to price it. */ { tag: "Refused"; value: { reason: FundingQuoteRefusal; }; } /** * The provider did not answer in time. */ | { tag: "Timeout"; value?: undefined; }; /** * Contact handles the core needs turned back into accounts, and the key they * were minted under. * * A handle is `BLAKE2b-256(key = handle_key, message = account)`, the account * being its 32 raw bytes. The host holds the accounts, so it is the one that * can match: hash each contact's account under `handle_key`, or keep that hash * as an indexed column for the session, and look the handles up. */ export interface HostContactLookup { /** * The key every handle here was minted under. Per session, and never * given to a product. */ handleKey: Bytes32; /** * The handles to resolve, in the order the answer must follow. */ handles: Array; } /** * The host's answer to a `HostContactLookup`. * * A named wrapper because the callback emitter cannot return a bare `Vec`. */ export interface HostContactMatches { /** * One entry per requested handle, in order: the contact's account, or * ``undefined`` when no current contact hashes to it. */ accounts: Array; } /** * How a host's contact picker ended. */ export type HostContactPick = /** * The user chose this account. * * Consumed by the core to mint the product-facing handle and never * forwarded to a product: it is the person's real account, and the handle * exists precisely so a product does not receive it. */ { tag: "Picked"; value: { account: Bytes32; }; } /** * The user closed the picker without choosing. */ | { tag: "Dismissed"; value?: undefined; } /** * The user has no contacts, so the host drew nothing. */ | { tag: "NoContacts"; value?: undefined; } /** * This host resolves contacts but cannot present a picker. The core * answers the product `Unsupported`, so it can tell "try again later" * apart from "this host will never pick". */ | { tag: "Unsupported"; value?: undefined; }; /** * The usernames a host lists for the game product. */ export type HostContactUsernames = /** * The dotNS usernames of the unblocked contacts the picker would offer, * in host order, each the bare label with no top-level domain. */ { tag: "Listed"; value: { usernames: Array; }; } /** * This host resolves contacts but does not list their usernames. The core * answers the product `Unsupported`. */ | { tag: "Unsupported"; value?: undefined; }; /** * How the host's scanner ended. */ export type HostScan = /** * The user scanned a code the request accepts. */ { tag: "Scanned"; value: { text: string; format: CodeFormat; }; } /** * The user closed the viewfinder without scanning. */ | { tag: "Dismissed"; value?: undefined; } /** * The device has no camera, or the user refused the host application one. * The host has already told the user how to turn it on. */ | { tag: "CameraUnavailable"; value?: undefined; } /** * The requesting App or Widget is not the screen the user sees, or the * host application is not in front, so the host opened nothing. */ | { tag: "NotVisible"; value?: undefined; }; /** * Review shown before a product learns the user's primary identity. */ export interface IdentityDisclosureReview { /** * Product currently handling the request. */ productId: ProductId; } /** * Account a legacy-account request resolved to, so a host knows the signer * without resolving the request's address itself. */ export type LegacySigningAccount = /** * The wallet's identity account. */ { tag: "Identity"; value?: undefined; } /** * The requesting product's account at derivation index 0. */ | { tag: "Product"; value: ProductAccountId; }; /** * Why a login attempt failed, for hosts that need to act on the cause rather * than only display it. */ export type LoginFailureKind = "NoFreeAllowanceSlots" | "Other"; /** * Where items drained from a purse go. */ export type NftPurseDrainDestination = /** * Fresh keys of this purse. */ { tag: "Purse"; value: { purse: number; }; } /** * This key, outside every purse. */ | { tag: "ExternalKey"; value: { key: Bytes32; }; } /** * A cheque the product delivers to its recipient. */ | { tag: "Cheque"; value?: undefined; } /** * The keys of a deposited cheque, back to its sender. */ | { tag: "Refund"; value?: undefined; }; /** * Review shown before a product moves items out of an NFT purse it does * not own: Root's, or another product's. */ export interface NftPurseDrainReview { /** * Product making the request. */ callingProductId: ProductId; /** * Purse the items leave. */ fromPurse: number; /** * Who owns that purse. */ owner: NftPurseOwner; /** * How many items leave it. */ itemCount: number; /** * Where they go. */ destination: NftPurseDrainDestination; } /** * Permission request whose authorization status can be inspected or updated * by host administration UI. */ export type PermissionAuthorizationRequest = /** * Device-level permission such as camera, microphone, or location. */ { tag: "Device"; value: HostDevicePermissionRequest; } /** * Remote/product-scoped permission such as chain submit or HTTP access. */ | { tag: "Remote"; value: RemotePermissionRequest; } /** * Product-scoped permission to disclose the user's primary identity. */ | { tag: "IdentityDisclosure"; value?: undefined; } /** * Product-scoped permission to access another product's account context. */ | { tag: "AccountAccess"; value: { targetProductId: ProductId; }; } /** * Product-scoped approval to make one kind of signature with another * product's accounts. It is held in memory only and ends when the product * execution closes. */ | { tag: "CrossProductSignature"; value: { targetProductId: ProductId; kind: CrossProductSignatureKind; }; }; /** * Authorization status for a permission request. * * `NotDetermined` means the core has no saved or one-use answer and will prompt the * host the next time the product requests this permission. */ export type PermissionAuthorizationStatus = "NotDetermined" | "Denied" | "Authorized"; /** * User decision including how long an authorization should last. */ export type PermissionDecision = "AllowOnce" | "AllowAlways" | "Deny"; /** * Product identity attached to one product-facing TrUAPI connection. * * A host may create multiple product runtimes from the same long-lived host * runtime, each with its own product context. */ export interface ProductContext { /** * Product identifier used for account derivation and product-scoped * storage/permission namespaces. * * Host-spec C.7 defines accepted product id forms: * */ productId: ProductId; /** * Trusted kind of executable attached to this connection by the host. */ executionKind: ExecutableKind; } /** * Review shown before a product resolves its own account subtree over SSO, * when the value is not cached and the core must ask the Account Holder. */ export interface ProductSubtreeReview { /** * Product resolving its own account. */ productId: ProductId; } /** * Review shown before allocating resources for a product. Names the * beneficiary product so the user knows which product receives the * (signing-capable) allowance key they are approving. */ export interface ResourceAllocationReview { /** * Product the allocation is requested for. */ callingProductId: ProductId; /** * Resources to allocate. */ resources: Array; } /** * Decoded session fields a host shell needs to render account UI without * parsing the opaque session blob the core persists through `CoreStorage`. */ export interface SessionUiInfo { /** * 32-byte sr25519 root public key of the active session. */ publicKey: Bytes32; /** * Wallet identity account id used for the dotNS username lookup on Asset Hub. */ identityAccountId?: Bytes32; /** * X25519 public key addressing this identity in chat. Public counterpart * of the key `CoreAdmin::get_session_chat_identity_key` serves. */ chatPublicKey?: Bytes32; /** * X25519 public key of the wallet device that answered pairing. Hosts * running their own encrypted device-sync channel key it against this. * ``undefined`` on a signing host, which has no paired wallet device. */ peerDeviceEncPublicKey?: Bytes32; /** * Statement-store account id the paired wallet signs every session-channel * statement with. Whether it is scoped to the wallet device or to the * wallet identity is the wallet's choice, so hosts must not treat it as a * device discriminator; use `Self::peer_device_enc_public_key` for that. */ peerStatementAccountId?: Bytes32; /** * Statement-store account id this device advertises in the pairing * proposal; the paired wallet registers the statement-store allowance for * it, and peers address this host on topics derived from it. Rotated per * login. Secret at `CoreAdmin::get_device_statement_key`. */ deviceStatementAccountId?: Bytes32; /** * X25519 public key of this device, which the user's other devices and * contacts encrypt to. A signing host's is its install-wide key; a pairing * host's is the key it advertised next to * `Self::device_statement_account_id`, which the wallet registered and * announces, rotated per login. Secret at * `CoreAdmin::get_device_encryption_key`. */ deviceEncPublicKey?: Bytes32; /** * Short username from the dotNS identity record on Asset Hub. */ liteUsername?: string; /** * Fully qualified username from the dotNS identity record on Asset Hub. */ fullUsername?: string; } /** * Review shown before a sign-payload request is sent to the paired wallet. */ export type SignPayloadReview = /** * Product-account signing request. */ { tag: "Product"; value: { callingProductId?: ProductId; request: HostSignPayloadRequest; }; } /** * Legacy-account signing request, which only the product's account at * index 0 may sign. */ | { tag: "LegacyAccount"; value: { account: ProductAccountId; request: HostSignPayloadWithLegacyAccountRequest; }; }; /** * Review shown before a sign-raw request is sent to the paired wallet. * Hosts must display the payload according to `watermarked` and warn that * unwatermarked signatures can authorize transactions. */ export type SignRawReview = /** * Product-account raw signing request. */ { tag: "Product"; value: { callingProductId?: ProductId; request: HostSignRawRequest; watermarked: boolean; }; } /** * Legacy-account raw signing request. */ | { tag: "LegacyAccount"; value: { account: LegacySigningAccount; request: HostSignRawWithLegacyAccountRequest; watermarked: boolean; }; }; /** * Review shown before signing an RFC-0023 VRF transcript. */ export interface SignVrfReview { /** * Product making the request. */ callingProductId: ProductId; /** * Product account and exact ordered transcript. */ request: HostAccountSignVrfRequest; } /** * Review shown before a product account signs a Statement Store proof * payload. Distinct from raw-message signing: the payload is the exact * unsigned statement, signed as-is (no `` envelope), so the host must * not present it with the raw-signing convention. */ export interface StatementStoreProductSignReview { /** * Product that asked, when the request carries a caller. See * `SignPayloadReview::Product`. */ callingProductId?: ProductId; /** * Product account that will sign the statement payload. */ account: ProductAccountId; /** * Exact unsigned statement payload to be signed. */ payload: Uint8Array; } /** * Permission storage payload, whose targets can be bare manifest labels. */ export type StoredPermissionRequest = /** * Device permission decision. */ { tag: "Device"; value: HostDevicePermissionRequest; } /** * Remote permission decision. */ | { tag: "Remote"; value: RemotePermissionRequest; } /** * Identity disclosure decision. */ | { tag: "IdentityDisclosure"; value?: undefined; } /** * Account access decision. */ | { tag: "AccountAccess"; value: { target: string; }; } /** * Execution-local approval for one signature kind. */ | { tag: "CrossProductSignature"; value: { target: string; kind: CrossProductSignatureKind; }; }; /** * Review shown before a user-confirmed core action continues. */ export type UserConfirmationReview = /** * Sign a SCALE payload with a product or legacy account. */ { tag: "SignPayload"; value: SignPayloadReview; } /** * Sign raw bytes with a product or legacy account. */ | { tag: "SignRaw"; value: SignRawReview; } /** * Sign a Statement Store proof payload with a product account. */ | { tag: "StatementStoreProductSign"; value: StatementStoreProductSignReview; } /** * Create a transaction with a product or legacy account. */ | { tag: "CreateTransaction"; value: CreateTransactionReview; } /** * Allow a product to derive a contextual alias for a ring. */ | { tag: "AccountAlias"; value: AccountAliasReview; } /** * Allow a product to create a ring-VRF proof for a ring. */ | { tag: "CreateProof"; value: CreateProofReview; } /** * Allow a product to learn the user's primary identity. */ | { tag: "IdentityDisclosure"; value: IdentityDisclosureReview; } /** * Allocate resources for the requesting product. */ | { tag: "ResourceAllocation"; value: ResourceAllocationReview; } /** * Allow a product to access another product account. */ | { tag: "AccountAccess"; value: AccountAccessReview; } /** * Sign an RFC-0023 VRF transcript with a product account. */ | { tag: "SignVrf"; value: SignVrfReview; } /** * Resolve a product's own account subtree over SSO. */ | { tag: "ProductSubtree"; value: ProductSubtreeReview; } /** * Move items out of an NFT purse the product does not own. */ | { tag: "NftPurseDrain"; value: NftPurseDrainReview; }; /** * Review shown before a product asks to access another product account. */ export declare const AccountAccessReview: S.Codec; /** * Review shown before a product derives a contextual alias (RFC 0004). */ export declare const AccountAliasReview: S.Codec; /** * Auth/session lifecycle state the core projects for host UI. The core owns * every transition and emits states in order; hosts render the current state * and never derive auth UI from any other signal. */ export declare const AuthState: S.Codec; /** * A chain the host builds as V5 general transactions, and the transaction * extension pipeline it uses there. */ export declare const ChainExtensionVersion: S.Codec; /** * Core-owned host-private storage slots. Products never address these slots; * the host chooses the backing store for each slot. * * Storage is host-local; `storage.md` records the current status quo: * */ export declare const CoreStorageKey: S.Codec; /** * Review shown before a product creates a ring-VRF proof (RFC 0004). */ export declare const CreateProofReview: S.Codec; /** * Review shown before a transaction-creation request is sent to the paired wallet. */ export declare const CreateTransactionReview: S.Codec; /** * A kind of signature a product makes with another product's account. * * The user approves each kind separately: approving one never lets another * through without a prompt. */ export declare const CrossProductSignatureKind: S.Codec; /** * What the operating system currently says about a device capability. * * Distinct from `PermissionAuthorizationStatus`, which is the product-scoped * decision the user made through TrUAPI. The two answer different questions * and are combined rather than substituted: a capability is usable only when * the product holds a grant *and* the OS still allows it. */ export declare const DevicePermissionStatus: S.Codec; /** * What the host did with a request to cover or uncover the expanded card face. */ export declare const ExpandedCardFaceOutcome: S.Codec; /** * What the host did with a request to turn the expanded card. */ export declare const ExpandedCardTurnOutcome: S.Codec; /** * The chains a host builds as V5 general transactions. A chain not listed is * built as V4. */ export declare const ExtensionVersionMap: S.Codec; /** * Why an amount cannot go ahead. */ export declare const FundingAmountIssue: S.Codec; /** * How the user left the funding overlay. */ export declare const FundingPresentOutcome: S.Codec; /** * A funding session as the host overlay needs it to open on the right screen. */ export declare const FundingPresentation: S.Codec; /** * The providers' quotes for one ask, as the host draws its provider list. */ export declare const FundingQuoteList: S.Codec; /** * One provider's place in the list a quote request fills in. */ export declare const FundingQuoteRow: S.Codec; /** * Where a provider's quote stands. */ export declare const FundingQuoteState: S.Codec; /** * Why a provider cannot be offered for an ask. */ export declare const FundingQuoteUnavailable: S.Codec; /** * Contact handles the core needs turned back into accounts, and the key they * were minted under. * * A handle is `BLAKE2b-256(key = handle_key, message = account)`, the account * being its 32 raw bytes. The host holds the accounts, so it is the one that * can match: hash each contact's account under `handle_key`, or keep that hash * as an indexed column for the session, and look the handles up. */ export declare const HostContactLookup: S.Codec; /** * The host's answer to a `HostContactLookup`. * * A named wrapper because the callback emitter cannot return a bare `Vec`. */ export declare const HostContactMatches: S.Codec; /** * How a host's contact picker ended. */ export declare const HostContactPick: S.Codec; /** * The usernames a host lists for the game product. */ export declare const HostContactUsernames: S.Codec; /** * How the host's scanner ended. */ export declare const HostScan: S.Codec; /** * Review shown before a product learns the user's primary identity. */ export declare const IdentityDisclosureReview: S.Codec; /** * Account a legacy-account request resolved to, so a host knows the signer * without resolving the request's address itself. */ export declare const LegacySigningAccount: S.Codec; /** * Why a login attempt failed, for hosts that need to act on the cause rather * than only display it. */ export declare const LoginFailureKind: S.Codec; /** * Where items drained from a purse go. */ export declare const NftPurseDrainDestination: S.Codec; /** * Review shown before a product moves items out of an NFT purse it does * not own: Root's, or another product's. */ export declare const NftPurseDrainReview: S.Codec; /** * Permission request whose authorization status can be inspected or updated * by host administration UI. */ export declare const PermissionAuthorizationRequest: S.Codec; /** * Authorization status for a permission request. * * `NotDetermined` means the core has no saved or one-use answer and will prompt the * host the next time the product requests this permission. */ export declare const PermissionAuthorizationStatus: S.Codec; /** * User decision including how long an authorization should last. */ export declare const PermissionDecision: S.Codec; /** * Product identity attached to one product-facing TrUAPI connection. * * A host may create multiple product runtimes from the same long-lived host * runtime, each with its own product context. */ export declare const ProductContext: S.Codec; /** * Review shown before a product resolves its own account subtree over SSO, * when the value is not cached and the core must ask the Account Holder. */ export declare const ProductSubtreeReview: S.Codec; /** * Review shown before allocating resources for a product. Names the * beneficiary product so the user knows which product receives the * (signing-capable) allowance key they are approving. */ export declare const ResourceAllocationReview: S.Codec; /** * Decoded session fields a host shell needs to render account UI without * parsing the opaque session blob the core persists through `CoreStorage`. */ export declare const SessionUiInfo: S.Codec; /** * Review shown before a sign-payload request is sent to the paired wallet. */ export declare const SignPayloadReview: S.Codec; /** * Review shown before a sign-raw request is sent to the paired wallet. * Hosts must display the payload according to `watermarked` and warn that * unwatermarked signatures can authorize transactions. */ export declare const SignRawReview: S.Codec; /** * Review shown before signing an RFC-0023 VRF transcript. */ export declare const SignVrfReview: S.Codec; /** * Review shown before a product account signs a Statement Store proof * payload. Distinct from raw-message signing: the payload is the exact * unsigned statement, signed as-is (no `` envelope), so the host must * not present it with the raw-signing convention. */ export declare const StatementStoreProductSignReview: S.Codec; /** * Permission storage payload, whose targets can be bare manifest labels. */ export declare const StoredPermissionRequest: S.Codec; /** * Review shown before a user-confirmed core action continues. */ export declare const UserConfirmationReview: S.Codec; /** * Host auth UI driven by core-owned `AuthState` transitions. */ export interface AuthPresenter { /** * Observe an auth state change, in transition order. A pairing host * always receives an opening state once the core has restored the * persisted session, `Disconnected` included; later emissions happen * only when the state changes. Default is a no-op for hosts that render * no auth UI. */ authStateChanged?(state: AuthState): void; } /** * Host-implemented balance view: what a payment request can spend right now, * the figure the host checks a payment against. Optional: a host that omits * it leaves balance subscriptions answered `Unsupported`. * * The balance is the user's, per purse, not the product's: every product * following a purse sees the same figure. The core asks for the product's * balance access before calling here, and checks it again before passing on * each balance the stream emits, so a revoked grant ends the stream with * `PermissionDenied`. */ export interface BalancePlatform { /** * Emit the balance of `purse` (``undefined`` for the main purse) now and on * every change. */ subscribeBalance(product: ProductContext, purse: number | undefined): AsyncIterable>; } /** * JSON-RPC provider factory for chain access. * * The platform provides a way to get a JSON-RPC connection for a given chain. * The server runtime manages the chainHead v1 state machine on top of this. * Host-spec N.6 requires products to access chains through host-mediated * providers: * */ export interface ChainProvider { /** * Open a JSON-RPC connection for the chain identified by `genesis_hash`. * Drop the returned connection to disconnect. */ connect(genesisHash: Uint8Array): Promise; } /** * Host-implemented adapter through which product Chat calls reach host * storage and UI. Optional: a host that omits it leaves Chat requests * answered `Unsupported`. See `OptionalPlatform`. * * The core bounds and screens the product-supplied fields it forwards. Ids, * names and icons on `create_chat_room`, `register_chat_bot`, * `post_chat_message` and `set_chat_room_footer` are NFC-normalized and rejected for control and * bidi characters. Message bodies are bounded and screened but pass through * byte-for-byte, keeping line breaks and tabs, so a product reads back the * bytes it sent. Counts and byte budgets are enforced, and any URL a host may * fetch or open is restricted to `https` or an inline raster image and * delivered as the parser resolved it. * * The core screens a URL's shape, not its reachability. `https://127.0.0.1`, * `https://[::1]`, a private range and `https://169.254.169.254` (the cloud * metadata endpoint) all pass: which networks a host is willing to fetch from * depends on where that host runs, and a core that guessed would break a host * serving its own media from localhost. A host that fetches these URLs owns * that decision. Credentials are the exception and are refused, because * `user:pass@` survives resolution into whatever the host fetches and logs. * * `ChatFile::size_bytes` is a product assertion and is not verified against * the resource it names. Contextual output escaping, storage limits, and * anything a host derives from product-supplied values remain host-owned. */ export interface ChatPlatform { /** * Create or resolve a product-scoped native chat room. */ createChatRoom(product: ProductContext, request: HostChatCreateRoomRequest): Promise; /** * Register or resolve a product-scoped native chat bot. Host-owned in the * same way rooms are. */ registerChatBot(product: ProductContext, request: HostChatRegisterBotRequest): Promise; /** * Persist a product-authored message in a native chat room. A host that * cannot store a given content variant reports a domain error for it. */ postChatMessage(product: ProductContext, request: HostChatPostMessageRequest): Promise; /** * Set what a product-scoped room shows below its messages, for the room * as it is now and every later time it is shown. The core has already * checked the product created the room. A room the product never set a * footer on shows the text input. */ setChatRoomFooter(product: ProductContext, request: HostChatSetRoomFooterRequest): Promise; /** * Emit the current product-scoped room list and later replacements. */ subscribeChatRooms(product: ProductContext): AsyncIterable>; } /** * Host-owned contact picker, drawn from the chat lists the host's chat * extensions hold. * * Optional, and listed on `OptionalPlatform` as `ChatPlatform` is. * * The host owns the UI and the list. It draws the names, so nothing it renders * reaches the product, and the accounts on the list never cross to the core: * the core asks only about the handles a transaction names. Usernames cross * only through `Self::contact_usernames`, for the game product. A * host omits contacts the user has blocked, from the picker, from lookups and * from usernames alike. */ export interface ContactsPlatform { /** * Resolve `lookup.handles` to the contacts they name. * * The one method a host has to write. Answer one entry per handle, in * order, with ``undefined`` for a handle no current contact hashes to — a * removed or blocked contact, or a handle a product made up. The core * re-hashes every account returned and refuses one that does not match * its handle, so a wrong answer is caught rather than trusted. */ contacts(lookup: HostContactLookup): Promise; /** * Present the contact picker on behalf of `product` and return the user's * choice. * * Defaults to `HostContactPick::Unsupported`, so a Rust host that * implements `Self::contacts` alone still compiles and its products get * a truthful answer rather than a dismissal they would retry forever. * * A JS host reaches the same answer by another route: the generated * surface types this method optional, but a capability group counts as * served only when every callback in it is present, so omitting this one * makes the whole group absent and `contacts.pick` answers `Unsupported` * before any of it is reached. * * The core cannot draw UI, so a selection has to come from the host; the * whole point is that the host renders the names rather than shipping * them to the product. `product` is passed so the host can say who is * asking; it is not a filter. A host with no contacts answers * `HostContactPick::NoContacts` instead of drawing an empty overlay. */ pickContact?(product: ProductContext): Promise; /** * List the dotNS usernames of the unblocked contacts the picker would * offer. * * The core calls this only for the game product, so a host does not * check `product` itself: it says who is asking and is not a filter. * Answer from the contacts the host already holds, without a prompt. * Defaults to `HostContactUsernames::Unsupported`, so a host that lists * nothing gives its products a truthful answer. A JS host passes it with * the other two contacts callbacks, or the whole group counts as absent. */ contactUsernames?(product: ProductContext): Promise; } /** * Core-owned administration API exposed to host UI. * * Hosts call this surface to drive global runtime actions or inspect/update * core-owned state without going through a product-scoped TrUAPI request. */ export interface CoreAdmin { /** * Best-effort logout/disconnect. Clears the active session and emits the * resulting auth state transition. */ disconnectSession(): Promise; /** * Read a stored permission authorization status without prompting. * * A device capability also resolves the host application's OS gate, so an * OS refusal reads as `Denied` whatever is stored. Remote, * identity-disclosure and account-access decisions have no OS gate. */ getPermissionAuthorizationStatus(request: PermissionAuthorizationRequest): Promise; /** * Read stored permission authorization statuses without prompting. * * A device capability also resolves the host application's OS gate, so an * OS refusal reads as `Denied` whatever is stored. Remote, * identity-disclosure and account-access decisions have no OS gate. * * Results are returned in the same order as `requests`. */ getPermissionAuthorizationStatuses(requests: Array): Promise>; /** * Update a stored permission authorization status. `NotDetermined` clears * the stored value so the next product request prompts again. */ setPermissionAuthorizationStatus(request: PermissionAuthorizationRequest, status: PermissionAuthorizationStatus): Promise; /** * Read the active session's X25519 chat identity private key, for hosts * that run their own P2P chat channel for the paired identity. * * The wallet derives this key from the identity root and shares it during * pairing; the core retains it verbatim, because a value derived * host-side would address an identity no existing peer can reach. ``undefined`` * when no session is active. * * Deliberately not on `SessionUiInfo`: that projection rides every * `AuthState` broadcast to all registered `AuthPresenter`s, so a * secret placed there would reach hosts that never asked for it. */ getSessionChatIdentityKey(): Promise; /** * Read the active session's expanded sr25519 statement-store secret, for * hosts that run their own statement-store traffic. 64 bytes. * * The key behind `SessionUiInfo::device_statement_account_id`: signing * with anything else produces statements no allowance covers. ``undefined`` * without an active pairing-host session; a signing host has no pairing * proposal of its own. * * Deliberately not on `SessionUiInfo`, for the reason given on * `Self::get_session_chat_identity_key`. */ getDeviceStatementKey(): Promise; /** * Read this device's X25519 encryption secret, for hosts that encrypt * their own chat and device-sync traffic. * * The key behind `SessionUiInfo::device_enc_public_key`: decrypting with * anything else misses what contacts send. The account holder decides * which key that is. A signing host serves its install-wide key, * generated and persisted on first read. A pairing host serves the key * the wallet registered for it at pairing, ``undefined`` before pairing and * rotated per login like `Self::get_device_statement_key`. * * Deliberately not on `SessionUiInfo`, for the reason given on * `Self::get_session_chat_identity_key`. */ getDeviceEncryptionKey(): Promise; /** * Read `product_id`'s hard-subtree public key, so a host can name the * account a review will sign with instead of showing a bare derivation * path. * * Resolves from the memory cache, then the persisted slot, then the * Account Holder. A pairing host reaching the wallet sends an SSO request, * which answers without prompting the user, though it can wake the phone. * A signing host derives locally and never waits. * * `timeout_ms` bounds that wait, and exceeding it is an error rather than * ``undefined``. The underlying wait has no deadline of its own, so a host * calling this while drawing a review should pass a timeout it is willing * to block for. ``undefined`` uses a default sized for a product awaiting a * signature, which is far too long to hold a render. * * ``undefined`` means no active session. Derive account public keys from the * answer with `deriveProductAccountPublicKey`. */ getProductSubtreePublicKey(productId: ProductId, timeoutMs: number | undefined): Promise; } /** * Host-private persistence for core-owned state. * * Clearing product-indexed slots is the host's job. The core drops the ones * it is holding when a session ends, but a product it never opened this run * has no entry to drop, so those slots outlive the disconnect. A host that * removes a product must clear them with the rest of that product's state, or * they accumulate for the life of the install. * * `describe_core_storage_key` names the product owning a slot: * `CoreStorageKeyDescription::owner` names a full product for the * product-indexed variants, which are `PermissionAuthorization`, * `AutoSigningKey`, and `ProductSubtree`. Keying host storage by that value * makes the sweep a prefix delete rather than a scan. */ export interface CoreStorage { /** * Read a core-owned value by typed slot. */ readCoreStorage(key: CoreStorageKey): Promise; /** * Write a core-owned value by typed slot. */ writeCoreStorage(key: CoreStorageKey, value: Uint8Array): Promise; /** * Clear a core-owned value by typed slot. */ clearCoreStorage(key: CoreStorageKey): Promise; } /** * Host control of the card face drawn under an opened card's Widget. * * Carried per connection on `ConnectionAdapters`, because the host owns one * drawer per product execution. A connection without one tells products * `Unsupported`. */ export interface ExpandedCardHost { /** * Uncover (`true`) or cover (`false`) the face under the calling Widget. */ setExpandedCardFaceShown(shown: boolean): Promise; /** * Turn the card above the calling Widget so its back (`true`) or its * front (`false`) is up. */ setExpandedCardBackShown(shown: boolean): Promise; } /** * Which chains the host builds as V5 general transactions. The core builds * its own extrinsics the same way, so both agree on every chain. */ export interface ExtrinsicVersionHost { /** * The chains the host builds as V5, each with its pipeline. A host that * never builds V5 lists none. */ transactionExtensionVersions?(): Promise; } /** * Feature-support probing. The host answers whether it can service a given * capability (currently scoped to per-chain support). */ export interface Features { /** * Report whether the requested feature is supported. */ featureSupported(request: HostFeatureSupportedRequest): Promise; } /** * Host-implemented funding surface: the native overlay a funding session * runs in. Optional: a host that omits it leaves funding requests answered * `Unsupported`. */ export interface FundingPlatform { /** * Show the funding overlay for a session that `product` opened, or the * host itself when `product` is ``undefined``. */ presentFunding(product: ProductContext | undefined, session: FundingPresentation): Promise; /** * `provider` asked to show a screen for session `intent`. The core * holds it until the host calls `open_provider_frame(intent)`, which * the host does at once while the user looks at the session, or once * the user taps a notice that the provider wants to show something. * A worker never puts a screen in front of the user on its own. */ providerFrameRequested(provider: ProductContext, intent: string): void; /** * Show `target` for `provider`'s session `intent` in a frame the host * owns, and answer once it closes. Called only once the host opened the * request `Self::provider_frame_requested` announced. A page is an * https URL the core has checked: the host shows its origin, and closes * the frame with `Returned` when the page reaches its return URL. The * core closes the frame itself, through `Self::close_provider_frame`, * once the session's payment moved. */ presentProviderFrame(provider: ProductContext, intent: string, target: FundingFrameTarget): Promise; /** * Close the frame `present_provider_frame` shows for `provider`'s * session `intent`, answering that call `Closed`, and show the * session's progress in its place. Does nothing when no frame is * open for it. */ closeProviderFrame(provider: ProductContext, intent: string): void; /** * The country the user is likely in, as an ISO 3166-1 alpha-2 code, for * the quotes the core asks before the user picks one. Best effort, * without asking for any permission: the device's coarse location when * already permitted, then its SIM or network country, then its locale's * region. ``undefined`` when nothing says. */ detectedCountry?(): Promise; /** * Observe a session's status change, for host UI such as the in-flight * pill. */ fundingSessionChanged?(intent: string, status: HostFundingStatusSubscribeItem): void; /** * Observe the quote list the host requested, for the provider list: * again whenever a provider answers, and each time the core asks every * provider again. ``undefined`` once a selection on another route withdrew it. */ fundingQuotesChanged?(intent: string, quotes: FundingQuoteList | undefined): void; } /** * Host-implemented adapter that holds a product's next-game reminder. * Optional: a host that omits it leaves Game requests answered `Unsupported`. * See `OptionalPlatform`. * * The core serves only the game product and refuses a start that is not in * the future before it calls here; it asks for no per-product consent. The * host asks the OS for what the reminder needs, rings an alarm where the OS * allows one and delivers an ordinary notification otherwise, and may add the * game to the user's calendar. A host keeps one reminder per product: a * schedule replaces the reminder the same product already holds and leaves * other products' reminders alone. The host keeps each reminder across app * kill and device reboot and drops it once its game has started. */ export interface GamePlatform { /** * Hold `starts_at` (Unix milliseconds, UTC) as the product's reminder, * replacing any it holds. An error, including an OS that allows neither * alarms nor notifications, reaches the product as a host failure. */ scheduleGameReminder(product: ProductContext, startsAt: bigint): Promise; /** * Drop the product's reminder. Idempotent: dropping none succeeds. */ cancelGameReminder(product: ProductContext): Promise; } /** * A live JSON-RPC connection to a chain. */ export interface JsonRpcConnection { /** * Send a JSON-RPC request string. */ send(request: string): void; /** * Stream of JSON-RPC response strings. */ responses(): AsyncIterable; /** * Close the connection lease. * * Hosts may keep a shared underlying transport alive, but this handle * must stop receiving responses and release any per-caller resources. */ close(): void; } /** * Host locale source. */ export interface LocaleHost { /** * Emits the currently selected locale immediately, then future changes. */ subscribeLocale(): AsyncIterable>; } /** * Open URLs in the system browser. Input is already trimmed, categorized, * and (where needed) normalized by the core; the host implementation only * needs to hand the URL to the OS URL handler. */ export interface Navigation { /** * Open the given URL in the system browser. */ navigateTo(url: string): Promise; } /** * Deliver push notifications. */ export interface Notifications { /** * Schedule or immediately display the given notification and return the * host-assigned id. */ pushNotification(notification: HostPushNotificationRequest): Promise; /** * Cancel a notification by id. Idempotent: cancelling an already-fired or * unknown id still returns `success`. */ cancelNotification?(id: number): Promise; } /** * Pairing-host-only administration API exposed to host UI. */ export interface PairingHostAdmin { /** * Cancel any in-flight pairing request. */ cancelPairing(): void; /** * Notify the core that the persisted auth-session blob may have changed. * * The host owns persistence and change detection. The pairing core owns * decoding that blob into live `SessionState` / `AuthState`. */ notifySessionStoreChanged(): void; } /** * Host-implemented payment engine: pays from the user's balance to an * account, once the user approves. Optional: a host that omits it leaves * payment requests answered `Unsupported`. * * The core hashes the product into the id before calling, so ids never * collide across products. The host owns the approval sheet, the transfer * and its persistence. */ export interface PaymentPlatform { /** * Ask the user to approve `request`. Returns once the user has decided: * `Ok` when they authorized it and the host took it on; the payment's * outcome arrives through its status. */ requestPayment(product: ProductContext, request: HostPaymentRequest): Promise; /** * Emit a payment's current status and every later one, ending after a * terminal status. */ subscribePaymentStatus(product: ProductContext, id: Bytes32): AsyncIterable>; } /** * Live OS permission state, read without prompting. * * A product-scoped grant is persisted once and never expires, but the OS * grant behind it can be revoked in system settings, suspended by device * policy, or reset by the platform — Android auto-resets runtime permissions * for apps that go unused. Without this capability the core keeps answering * from the stored grant alone and tells a product `granted` for a capability * the OS has since taken away. * * This is deliberately separate from `Permissions::device_permission`: that * call may show UI, so it cannot be used to re-check a decision the user has * already made without prompting them again on every request. */ export interface PermissionStatusHost { /** * Current OS status of a device capability. Must not prompt. */ devicePermissionStatus(request: HostDevicePermissionRequest): Promise; } /** * Permission prompts. Device permissions (camera, mic, NFC, ...) are separate * from remote permissions (domain access, chain submit, ...), so the platform * surface mirrors that split. */ export interface Permissions { /** * Prompt the user for a device-level permission `product` requested. */ devicePermission(product: ProductContext, request: HostDevicePermissionRequest): Promise; /** * Prompt the user for a remote permission bundle `product` requested. */ remotePermission(product: ProductContext, request: RemotePermissionRequest): Promise; } /** * Adapter through which product Pocket calls reach the card collection. * Optional: a host that omits it leaves Pocket requests answered * `Unsupported`. See `OptionalPlatform`. Native hosts are served by the * core's own collection in its database. */ export interface PocketPlatform { /** * Emit the calling product's current cards and every later replacement. */ subscribePocketCards(product: ProductContext): AsyncIterable>; /** * Remove one of the calling product's cards. Removing an absent card * succeeds; a privileged card is refused with `Privileged`. */ removePocketCard(product: ProductContext, request: HostPocketRemoveCardRequest): Promise; } /** * Host preimage backend. The core builds, signs, and submits the Bulletin * `TransactionStorage.store` transaction itself; the host only owns preimage * content retrieval (P2P/IPFS lookup). */ export interface PreimageHost { /** * Emits current value/miss immediately, then future updates. `key` is * the blake2b-256 digest of the preimage. */ lookupPreimage(key: Uint8Array): AsyncIterable>; } /** * Host store for a product's pending operations, which the host uses to keep * the product's worker runtime alive. Reached only through the `Worker` * protocol trait, so non-worker products never call these. */ export interface ProductOperations { /** * Record a pending operation. `label` is a host log and UI hint, empty * when the product gave none. * * The returned id must be unique among this product's open operations. * The core keys the worker reference an operation holds by that id, so an * id already open for the product records nothing the second time, and * ending it once drops the demand both were holding. Ids may repeat * across products, and may be reused once an operation has ended. */ beginOperation(product: ProductContext, label: string): Promise; /** * Remove a pending operation. Idempotent: an unknown or already-ended id * returns `Ok`, so a retry after an ambiguous failure is safe. */ endOperation(product: ProductContext, id: number): Promise; } /** * Product-scoped key-value storage. * * The core namespaces product keys before calling this trait, and the key * names the product that owns the value. Host implementations may treat * `key` as opaque in one shared store. A host that separates physical storage * by product must decode the owner with `ProductStorageKey` on read, since * that owner is another product on a granted foreign read. * Storage errors are pinned to `v01` rather than taken from `truapi::latest`. * The read error gained a cross-product refusal in v0.2 that the core decides * before it ever calls a host, so a host has no way to produce it and should * not have to match on it. */ export interface ProductStorage { /** * Read a value by key. * * `key` belongs to the calling product, or to another product the core * has already found granting the caller read access in its manifest. The * core refuses every other foreign read itself, so a host is never asked * to enforce a grant and has no variant for one. Writes and clears always * carry the calling product's own keys. */ read(key: string): Promise; /** * Write a value to a key. */ write(key: string, value: Uint8Array): Promise; /** * Clear a value at a key. */ clear(key: string): Promise; /** * Remove every value `product_id` owns. Idempotent. * * The core calls this when it clears the product's state. A host that * keeps one shared store removes every key starting with * `ProductStorageKey::owner_prefix`; a host that separates storage by * product drops that product's store. Values another product wrote stay. * Every subscription to a removed key then sees it empty, as after * `Self::clear`. */ clearProduct(productId: ProductId): Promise; /** * Emit `key`'s current value, then each later change from any of the * product's runtimes. `key` is namespaced exactly as `Self::read` takes * it. * * Reporting a write that left the bytes unchanged is allowed: the core * drops an item repeating the value it last delivered, so the product * sees only real changes whether or not a host filters them itself. */ subscribeStorage(key: string): AsyncIterable>; } /** * Host-owned viewfinder for QR codes and barcodes. Optional. The Swift and * Kotlin bridges and the JS `scanner` callbacks follow the same rules. * * - Title the viewfinder with the product id. Show `request.hint` under it as the product's words. * - Pass every code the camera reads to a `ScanFilter` built from `request`, and never follow a * scanned link. * - Answer `HostScan::NotVisible` for an App or Widget that is not on screen, or for any product * while the host application is not in front. A Worker reaching the host already passed the * core's tap check. * - Close the viewfinder when the core drops the future, and close any still open before opening * another. A JS host is not told about a drop. */ export interface ScannerPlatform { /** * Open the viewfinder on behalf of `product` and wait for the user. */ scanCode(product: ProductContext, request: HostScannerScanRequest): Promise; } /** * Host theme source. */ export interface ThemeHost { /** * Emits current theme immediately, then future changes. Hosts with no * named themes report `ThemeName::Default`. */ subscribeTheme(): AsyncIterable>; } /** * Host-implemented top-up engine: claims a source's funds into the user's * balance through the host's coinage onboarding. Optional: a host that omits * it leaves top-ups answered `Unsupported`. * * The core validates the source keys and hashes the product into the id * before calling, so ids never collide across products. The host owns * retries, partial claims and persistence. */ export interface TopUpPlatform { /** * Start a top-up. Returns once the host has accepted it. */ topUp(product: ProductContext, request: HostPaymentTopUpRequest): Promise; /** * Emit a top-up's current status and every later one, ending after a * terminal status. */ subscribeTopUpStatus(product: ProductContext, id: Bytes32): AsyncIterable>; } /** * Local user confirmation UI for sensitive core-owned operations. */ export interface UserConfirmation { /** * Preserve the lifetime of consent for identity and account disclosures. */ confirmPermission?(review: UserConfirmationReview): Promise; /** * Confirm a reviewed action before the core continues. * * The core drops this future when the request behind the review is * withdrawn, and an answer given afterwards reaches nobody. A host should * dismiss its prompt when that happens. */ confirmUserAction(review: UserConfirmationReview): Promise; } /** * Combined platform interface. A host must provide every capability trait * listed here. Members marked optional may be omitted; the core answers their * product calls with `Unsupported`. See `OptionalPlatform`. */ export interface HostCallbacks { navigation: Navigation; notifications: Notifications; permissions: Permissions; features: Features; extrinsicVersion: ExtrinsicVersionHost; productStorage: ProductStorage; coreStorage: CoreStorage; chain: ChainProvider; auth: AuthPresenter; userConfirmation: UserConfirmation; theme: ThemeHost; locale: LocaleHost; preimage: PreimageHost; productOperations: ProductOperations; chat?: ChatPlatform; contacts?: ContactsPlatform; game?: GamePlatform; permissionStatus?: PermissionStatusHost; pocket?: PocketPlatform; scanner?: ScannerPlatform; } export interface RequiredHostCallbacks { navigation: Required; notifications: Required; permissions: Required; features: Required; extrinsicVersion: Required; productStorage: Required; coreStorage: Required; chain: Required; auth: Required; userConfirmation: Required; theme: Required; locale: Required; preimage: Required; productOperations: Required; chat?: Required; contacts?: Required; game?: Required; permissionStatus?: Required; pocket?: Required; scanner?: Required; }