import * as v from "valibot"; import { StandardSchemaV1 } from "@standard-schema/spec"; //#region ../connect-core/build/index-LpxnCt_F.d.mts //#region src/util/core/core_valibot_schemas.d.ts type TTypeAndId = `${S}::${string}`; //#endregion //#region src/util/crypto/aes_gcm/createAesGcmKeyFromX25519Keys.d.ts declare const createAesGcmKeyFromX25519Keys: ({ externalX25519PublicKey, internalX25519PrivateKey, infoString, saltString }: { internalX25519PrivateKey: CryptoKey; externalX25519PublicKey: CryptoKey; saltString?: string; infoString?: string; }) => Promise; //#endregion //#region src/util/crypto/crypto.schema.d.ts declare enum ECryptoKeyAlgo { ed25519 = "ed25519", x25519 = "x25519" } declare enum ECryptoKeyFormat { raw_base64 = "raw_base64", jwk = "jwk" } declare const vSerializedCryptoKeyDataEd25519_Raw: v.SchemaWithPipe | undefined>]>; declare const vSerializedCryptoKeyDataEd25519_Jwk: v.SchemaWithPipe | undefined>]>; type TSerializedCryptoKeyData_Ed25519_Raw = v.InferInput; type TSerializedCryptoKeyData_Ed25519_Raw_Transformed = { formattedString: `${ECryptoKeyAlgo.ed25519}::${ECryptoKeyFormat.raw_base64}::${string}`; type: ECryptoKeyAlgo.ed25519; format: ECryptoKeyFormat.raw_base64; data: string; }; type TSerializedCryptoKeyData_Ed25519_Jwk = v.InferInput; type TSerializedCryptoKeyData_Ed25519_Jwk_Transformed = { formattedString: `${ECryptoKeyAlgo.ed25519}::${ECryptoKeyFormat.jwk}::${string}`; type: ECryptoKeyAlgo.ed25519; format: ECryptoKeyFormat.jwk; data: JsonWebKey; }; declare const vSerializedCryptoKeyDataX25519_Raw: v.SchemaWithPipe | undefined>]>; declare const vSerializedCryptoKeyDataX25519_Jwk: v.SchemaWithPipe | undefined>]>; declare const vCryptoKeyPairDataX25519: v.ObjectSchema<{ readonly publicKey: v.SchemaWithPipe | undefined>]>; readonly privateKey: v.SchemaWithPipe | undefined>]>; }, undefined>; type TSerializedCryptoKeyPairDataX25519 = v.InferInput; declare const vCryptoKeyPairDataEd25519: v.ObjectSchema<{ readonly publicKey: v.SchemaWithPipe | undefined>]>; readonly privateKey: v.SchemaWithPipe | undefined>]>; }, undefined>; type TSerializedCryptoKeyPairDataEd25519 = v.InferInput; type TSerializedCryptoKeyData_X25519_Raw = v.InferInput; type TSerializedCryptoKeyData_X25519_Raw_Transformed = { formattedString: `${ECryptoKeyAlgo.x25519}::${ECryptoKeyFormat.raw_base64}::${string}`; type: ECryptoKeyAlgo.x25519; format: ECryptoKeyFormat.raw_base64; data: string; }; type TSerializedCryptoKeyData_X25519_Jwk = v.InferInput; type TSerializedCryptoKeyData_X25519_Jwk_Transformed = { formattedString: `${ECryptoKeyAlgo.x25519}::${ECryptoKeyFormat.jwk}::${string}`; type: ECryptoKeyAlgo.x25519; format: ECryptoKeyFormat.jwk; data: JsonWebKey; }; declare const vVerifyChallengeWithSignature_Input: v.ObjectSchema<{ readonly challenge: v.StringSchema; readonly signatureBase64: v.SchemaWithPipe, v.Base64Action]>; }, undefined>; declare const vVerifyChallengeWithSignature_WithThrow_Input: v.IntersectSchema<[v.ObjectSchema<{ readonly challenge: v.StringSchema; readonly signatureBase64: v.SchemaWithPipe, v.Base64Action]>; }, undefined>, v.ObjectSchema<{ readonly throwOnInvalid: v.OptionalSchema, undefined>; }, undefined>], undefined>; type TVerifyChallengeWithSignature_Input = v.InferInput; type TVerifyChallengeWithSignature_WithThrow_Input = v.InferInput; declare const vEncryptedAesGcmPayload: v.ObjectSchema<{ readonly nonce: v.SchemaWithPipe, v.Base64Action]>; readonly ciphertext: v.SchemaWithPipe, v.Base64Action]>; }, undefined>; type TEncryptedAesGcmPayload = v.InferInput; type TEncryptedAesGcmPayload_Transformed = v.InferOutput; /** * Raw-bytes counterpart of {@link TEncryptedAesGcmPayload} — keeps `nonce`/`ciphertext` as binary * instead of base64 strings. For binary channels (e.g. msgpack WebSocket frames) this avoids the * ~33% base64 inflation the text payload incurs. */ type TEncryptedAesGcmBytes = { nonce: Uint8Array; ciphertext: Uint8Array; }; interface ISerializedKeyData { transformed: T; prefixed: P; } interface ISerializedKeyData_Ed25519_Raw extends ISerializedKeyData {} interface ISerializedKeyData_Ed25519_Jwk extends ISerializedKeyData {} interface ISerializedKeyData_X25519_Raw extends ISerializedKeyData {} interface ISerializedKeyData_X25519_Jwk extends ISerializedKeyData {} type TSerializedKeyData = ISerializedKeyData_Ed25519_Raw | ISerializedKeyData_Ed25519_Jwk | ISerializedKeyData_X25519_Raw | ISerializedKeyData_X25519_Jwk; //#endregion //#region src/util/crypto/aes_gcm/decryptBytesWithAesGcmKey.d.ts /** * Decrypts a raw-bytes AES-GCM payload (binary nonce + ciphertext) back to bytes. The counterpart of * {@link decryptTextDataWithAesGcmKey}. AES-GCM verifies integrity, so a tampered ciphertext throws. */ declare const decryptBytesWithAesGcmKey: ({ aesGcmKey, dataToDecrypt }: { aesGcmKey: CryptoKey; dataToDecrypt: TEncryptedAesGcmBytes; }) => Promise; //#endregion //#region src/util/crypto/aes_gcm/decryptTextDataWithAesGcmKey.d.ts declare const decryptTextDataWithAesGcmKey: ({ aesGcmKey, dataToDecrypt }: { aesGcmKey: CryptoKey; dataToDecrypt: TEncryptedAesGcmPayload; }) => Promise; //#endregion //#region src/util/crypto/aes_gcm/encryptBytesWithAesGcmKey.d.ts /** * Encrypts raw bytes with an AES-GCM key, returning the binary nonce + ciphertext. The bytes * counterpart of {@link encryptTextDataWithAesGcmKey} — use it for binary channels (msgpack frames) * to avoid base64 inflation. A fresh 12-byte nonce is generated per call (never reuse a nonce). */ declare const encryptBytesWithAesGcmKey: ({ aesGcmKey, dataToEncrypt }: { aesGcmKey: CryptoKey; dataToEncrypt: Uint8Array; }) => Promise; //#endregion //#region src/util/crypto/aes_gcm/encryptTextDataWithAesGcmKey.d.ts declare const encryptTextDataWithAesGcmKey: ({ aesGcmKey, dataToEncrypt }: { aesGcmKey: CryptoKey; dataToEncrypt: string; }) => Promise; //#endregion //#region src/util/crypto/canonical/canonical.types.d.ts /** * A value that is exactly one JSON value — the strict input type for canonical serialization. * No `undefined`, no sparse slots, no functions/symbols/bigints, no class instances relying on * `toJSON`: every alias that would let two different JavaScript values canonicalize to the same * bytes (or serialize surprisingly) is excluded at the type level. * * The runtime serializer (`stringifyCanonicalJson`) additionally accepts and defends `unknown` * with documented compatibility behaviors (dropped `undefined` object entries, sparse-hole * `null`s); APIs that *sign* canonical bytes should require this type instead. */ type TCanonicalJsonValue = null | boolean | number | string | readonly TCanonicalJsonValue[] | { readonly [key: string]: TCanonicalJsonValue; }; //#endregion //#region src/util/crypto/canonical/buildCanonicalChallenge.d.ts /** * A signing challenge with unambiguous byte layout: a domain tag and version separate this * operation's signatures from every other operation's (and from future format revisions), and * canonical-JSON field encoding gives exact field boundaries — no delimiter-join ambiguity, no * key-order sensitivity. Pre-hash large members (ciphertexts, payload bodies) into `fields` * rather than embedding them whole. */ interface ICanonicalChallenge { /** Namespaces the signature to one operation, e.g. `"meteor-connect-multi-action-submit"`. */ readonly domainTag: string; /** Versioned per challenge domain — bump it when this challenge's field contract changes. */ readonly version: number; /** The signed fields. Strict JSON values only — validated at build time, not silently coerced. */ readonly fields: Readonly>; } /** * The canonical string a {@link ICanonicalChallenge} signs: * `stringifyCanonicalJson({ domainTag, version, fields })`. Both signer and verifier call this, * so the signed bytes are constructed one way, everywhere. * * Unlike the general serializer (which accepts `unknown` with documented compatibility * behaviors), this **rejects** anything that is not a strict {@link TCanonicalJsonValue}: values * that alias to the same JSON (`undefined` entries, sparse arrays, non-plain objects) are refused * rather than normalized — a signing API must not guess. An empty `domainTag` or a non-positive / * unsafe `version` throws. */ declare function buildCanonicalChallenge(challenge: ICanonicalChallenge): string; //#endregion //#region src/util/crypto/canonical/hashCanonicalJson.d.ts /** * SHA-256 over `stringifyCanonicalJson(value)` — the canonical string is UTF-8 encoded exactly * once and hashed. Equal data (regardless of key order) always yields the same digest, so these * are safe for content addressing, idempotency keys, and signed-hash bindings. */ declare function hashCanonicalJsonSha256Hex(value: unknown): string; /** {@link hashCanonicalJsonSha256Hex}, as standard padded base64 (RFC 4648 §4). */ declare function hashCanonicalJsonSha256Base64(value: unknown): string; //#endregion //#region src/util/crypto/canonical/sha256.d.ts /** SHA-256 of a UTF-8 string or raw bytes, as the 32-byte digest. */ declare function sha256Bytes(input: string | Uint8Array): Uint8Array; /** SHA-256 of a UTF-8 string or raw bytes, as lowercase hex. */ declare function sha256Hex(input: string | Uint8Array): string; /** SHA-256 of a UTF-8 string or raw bytes, as standard padded base64 (RFC 4648 §4). */ declare function sha256Base64(input: string | Uint8Array): string; //#endregion //#region src/util/crypto/canonical/stringifyCanonicalJson.d.ts /** * Deterministic, signing-grade JSON serialization: the same data always produces the same bytes, * regardless of key insertion order — the foundation for content hashes, idempotency keys, and * signed challenges. This is a **frozen project contract** (guarded by byte-level test vectors), * not RFC 8785/JCS. The exact rules: * * - `null`, booleans, strings, and finite numbers serialize with native `JSON.stringify` spelling * and escaping (so `-0` emits `0`). * - Objects contribute their **own enumerable string-keyed** entries only, sorted by UTF-16 * code-unit order; entries whose value is `undefined` are omitted. Symbol keys and prototype * properties are ignored. `toJSON` is **never** invoked — a Date/Map/Set/class instance * contributes only its own enumerable entries. * - Arrays retain element order. A sparse **hole** serializes as `null` (native JSON behavior); an * **explicit** `undefined`/function/symbol/bigint element throws. * - Non-finite numbers, bigints, functions/symbols as values, top-level `undefined`, and circular * references throw. Repeated (non-cyclic) references are allowed. * * Error *messages* are not part of the contract; accepted-value bytes are. */ declare function stringifyCanonicalJson(value: unknown): string; //#endregion //#region src/util/crypto/client_key_link/buildVerifyKeyBoundInfoString.d.ts interface IBuildVerifyKeyBoundInfoString_Input { infoString?: string; verifyPublicKeys: [TSerializedCryptoKeyData_Ed25519_Raw, TSerializedCryptoKeyData_Ed25519_Raw]; } /** * The canonical HKDF `info` for a client-to-client shared key that binds both sides' verify * public keys into the derivation. * * When the two keys are relayed through an intermediary, a tampered key produces mismatched AES * keys on the two sides — the very first decryption fails, so key substitution is detected without * any extra signature ceremony. * * The keys are sorted lexicographically so the result is independent of which side is "local" — * both ends of a link compute the identical string without coordinating an order. Used internally * by ClientCryptoKeyLink (`bindVerifyKeysIntoDerivation`); exported for code that derives the same * key outside the link. */ declare const buildVerifyKeyBoundInfoString: ({ infoString, verifyPublicKeys }: IBuildVerifyKeyBoundInfoString_Input) => string; //#endregion //#region src/util/storage_adapter/storage_adapter.types.d.ts declare enum EStorageAdapterType { string = "string", json = "json" } interface IStorageAdapterMethods_String { type: EStorageAdapterType.string; /** * Whether this backing store outlives a page reload / process restart. Consumers that persist * long-lived state (e.g. a crypto identity whose verify key the server pins on first use) check * this to warn when handed a store that silently forgets. `undefined` = unknown (custom adapters); * such adapters are never warned about. */ durable?: boolean; setItem: (key: string, value: string) => Promise; getItem: (key: string) => Promise; removeItem: (key: string) => Promise; } interface IStorageAdapterMethods_Json { type: EStorageAdapterType.json; /** See {@link IStorageAdapterMethods_String.durable}. */ durable?: boolean; setItem: (key: string, value: T) => Promise; getItem: (key: string) => Promise; removeItem: (key: string) => Promise; } type TStorageAdapterMethods = IStorageAdapterMethods_String | IStorageAdapterMethods_Json; interface IStorageKeyGetterAndSetter { get: () => Promise; set: (value: T) => Promise; } //#endregion //#region src/util/storage_adapter/StorageAdapter.d.ts interface IStorageAdapterConstructor { methods: TStorageAdapterMethods; trackKeysForClearing?: boolean; keyPrefix?: string; } declare class StorageAdapter { private implementation; readonly keyPrefix: string; /** * Whether the backing store outlives a page reload / process restart (from the methods' * {@link TStorageAdapterMethods} `durable` flag). `false` on the memory and web-session adapters, * `true` on localStorage / Durable Object / KV, `undefined` (unknown) on custom methods. */ readonly durable: boolean | undefined; private readonly trackKeysForClearing; private readonly adapterStorage?; /** * Serializes mutations of the `__usedKeys__` index so its read-modify-write cycles can't * interleave. Without this, two overlapping `trackUsedKey`/`untrackUsedKey` calls each read the * old index and the later write clobbers the earlier one (last-writer-wins), silently dropping * entries — so `clearAll` leaves those keys behind. The window is negligible on synchronous * stores (localStorage) but wide on real async I/O (React Native AsyncStorage), where it routinely * corrupts a client-identity reset. See docs/issues/storage-adapter-clearall-react-native.md. */ private indexMutationChain; constructor({ methods, keyPrefix, trackKeysForClearing: trackKeys }: IStorageAdapterConstructor); private getPrefixedKey; /** * Runs `fn` after every previously-enqueued index mutation has settled, so the index's * read-modify-write cycles execute one at a time per adapter instance. Failures don't break the * chain — the next waiter still runs. */ private withIndexLock; /** * Derive a new adapter over the *same* backing store with an extra key-prefix segment appended. * Lets an independent namespace (e.g. a second crypto identity) share one underlying storage without * key collisions. Key-tracking policy is inherited: deriving from an intentionally untracked * adapter must not silently create a `__usedKeys__` index. */ withKeyPrefix(extraPrefix: string): StorageAdapter; private trackUsedKey; private untrackUsedKey; clearAll(): Promise; removeItem(rawKey: string): Promise; setJson(rawKey: string, value: any): Promise; getJson(rawKey: string): Promise; getJsonOrDef(rawKey: string, defVal: T): Promise; updateJson(rawKey: string, updater: (currentVal: T | undefined) => T): Promise; updateJsonOrDef(rawKey: string, defVal: T, updater: (currentVal: T) => T): Promise; createJsonGetterSetter(rawKey: string): IStorageKeyGetterAndSetter; } //#endregion //#region src/util/crypto/client_key_link/ClientCryptoKeyLink.d.ts /** * How the local identity (the exchange + verify key pairs) is allowed to come into being: * * - `"lazy"` (default): generate + persist the identity on first use. Correct for frontend / ephemeral * peers, and safe on a *strongly-consistent* store (a read miss genuinely means "never written"). * - `"required"`: never auto-mint. `ensureLocal*` throws {@link IdentityNotProvisionedError} if no * identity was loaded from storage; the only way to mint is the explicit one-shot * {@link ClientCryptoKeyLink.provisionIdentity}. Use this for a shared backend identity that must * stay stable across isolates: on an *eventually-consistent* store (e.g. Cloudflare KV) a transient * read miss must NOT be allowed to silently fork a second identity — that would change the server's * verify key and get it permanently rejected by every trust-on-first-use-pinned client. */ type TIdentityMode = "lazy" | "required"; /** * Thrown by the local-key getters when the link is in {@link TIdentityMode} `"required"` and no * identity has been provisioned. Surfacing this (instead of silently minting a fresh identity on a * storage miss) is what keeps a shared backend identity from forking across isolates. */ declare class IdentityNotProvisionedError extends Error { constructor(message?: string); } interface IClientCryptoKeyLink_Constructor { storageAdapter?: StorageAdapter; /** * Controls whether the local identity may be minted on first use. Defaults to `"lazy"` (unchanged * behavior). Pass `"required"` for a stable shared backend identity — see {@link TIdentityMode}. */ identityMode?: TIdentityMode; } interface ILinkedClientPublicKeys { verifyPublicKey?: TSerializedCryptoKeyData_Ed25519_Raw; exchangePublicKey?: TSerializedCryptoKeyData_X25519_Raw; } interface ILocalPublicKeys { verifyPublicKey: TSerializedCryptoKeyData_Ed25519_Raw; exchangePublicKey: TSerializedCryptoKeyData_X25519_Raw; } interface ILinkClientKeys { linkedClientId: TTypeAndId; verifyPublicKey?: TSerializedCryptoKeyData_Ed25519_Raw; exchangePublicKey?: TSerializedCryptoKeyData_X25519_Raw; saltString?: string; infoString?: string; bindVerifyKeysIntoDerivation?: boolean; } interface IEncryptDataForLinkedClient { linkedClientId: TTypeAndId; dataToEncrypt: string; } interface IDecryptDataFromLinkedClient { linkedClientId: TTypeAndId; dataToDecrypt: TEncryptedAesGcmPayload; } interface IDecryptAndVerifyDataFromLinkedClient extends IDecryptDataFromLinkedClient { signatureBase64: string; } interface IVerifyChallengeFromLinkedClient { linkedClientId: TTypeAndId; challenge: string; signatureBase64: string; } declare class ClientCryptoKeyLink { private localExchangeKeyPair; private localVerifyKeyPair; private linkedClientKeys; private storage; private readonly identityMode; private initialized; private initializePromise; private localExchangeKeyPairPromise; private localVerifyKeyPairPromise; constructor({ storageAdapter, identityMode }?: IClientCryptoKeyLink_Constructor); /** * Loads the local key pairs and any linked client public keys from storage (when a storage * adapter was provided), generating and persisting fresh local key pairs if none exist yet. * * Must be called (and awaited) before any sign/verify/encrypt/decrypt operation. */ initialize(): Promise; private runInitialize; /** * Provision the local identity once: load any persisted identity, then mint + persist the exchange * and verify key pairs only if absent. Idempotent — a no-op when an identity already exists. * * This is the *only* way to mint when {@link TIdentityMode} is `"required"`. Run it from a single * coordinated writer (a deploy hook, a first-boot path, a locked admin route) — **never on the hot * request path** — because concurrent provisioning over an eventually-consistent store could read * "absent" on two isolates at once and fork divergent identities. The serving path uses `"required"`, * which never mints, so a transient storage miss fails that one request loudly instead of forking. * * A genuine storage *read error* propagates here (it is never coerced to "absent"), so an outage * surfaces rather than silently minting a replacement identity. */ provisionIdentity(): Promise; /** * Loads the local key pairs from storage if they were previously persisted. Does NOT generate * fresh keys — local identity is created lazily on first use (see {@link ensureLocalExchangeKeyPair} * / {@link ensureLocalVerifyKeyPair}), so a verify-only or otherwise key-less consumer never * generates or stores keys it does not need. */ private loadStoredLocalKeys; /** * Returns the local exchange (X25519) key pair. In `"lazy"` mode it generates + persists it on first * use; in `"required"` mode it throws {@link IdentityNotProvisionedError} when none was loaded (mint * only via {@link provisionIdentity}). The read path of every encrypt/derive operation. */ private ensureLocalExchangeKeyPair; /** * Generates + persists the local exchange key pair if absent, returning an already-loaded pair * untouched (so provisioning is idempotent). Bypasses the `"required"` guard by design — it is the * sole minting path. Concurrent callers share a single generation. */ private mintLocalExchangeKeyPair; /** * Returns the local verify (Ed25519) key pair. In `"lazy"` mode it generates + persists it on first * use; in `"required"` mode it throws {@link IdentityNotProvisionedError} when none was loaded (mint * only via {@link provisionIdentity}). The read path of every sign operation. */ private ensureLocalVerifyKeyPair; /** * Generates + persists the local verify key pair if absent, returning an already-loaded pair * untouched (so provisioning is idempotent). Bypasses the `"required"` guard by design — it is the * sole minting path. Concurrent callers share a single generation. */ private mintLocalVerifyKeyPair; private loadLinkedClients; private serializeExchangeKeyPair; private serializeVerifyKeyPair; /** * The local public keys that should be shared with a linked client so that it can verify this * client's signatures and derive a shared encryption key. Generates the local identity on first * use. */ getLocalPublicKeys(): Promise; /** * The local exchange (X25519) public key, generating the exchange key pair on first use. Does not * touch the verify key pair — useful for an exchange-only consumer (e.g. a bridge) that never * signs. */ getLocalExchangePublicKey(): Promise; /** * The local verify (Ed25519) public key, generating the verify key pair on first use. Does not * touch the exchange key pair. */ getLocalVerifyPublicKey(): Promise; /** * Registers (or updates) the public keys of a linked client in memory only — nothing is written * to storage. Use this for ephemeral links (e.g. a per-session bridge or end-to-end peer keyed by * a session salt/info), so the derived shared key never outlives the process. * * Re-linking with a new exchange public key, salt, or info invalidates any previously cached * shared key for the link. */ linkClient({ linkedClientId, verifyPublicKey, exchangePublicKey, saltString, infoString, bindVerifyKeysIntoDerivation }: ILinkClientKeys): Promise; /** * Like {@link linkClient}, but also persists the linked client's public keys (and salt/info) to * storage so the link survives a reload. * * NOTE: salt/info are written in plaintext. When they are session secrets (e.g. a partner secret * or bridge salt), prefer {@link linkClient} and re-establish the link per session instead. */ linkClientAndStore(input: ILinkClientKeys): Promise; /** * Whether a linked client is currently registered (in memory) under this id. */ hasLinkedClient(linkedClientId: TTypeAndId): boolean; /** * The serialized public keys registered for a linked client, or undefined when the client is not * linked. Useful when a holder needs to relay a linked client's keys onward (e.g. a backend * relaying a wallet's verify key to a partner). */ getLinkedClientPublicKeys(linkedClientId: TTypeAndId): ILinkedClientPublicKeys | undefined; /** * Removes a single linked client from memory and, when storage is available, from persisted * state. Any cached shared key for the link is dropped with it. */ unlinkClient(linkedClientId: TTypeAndId): Promise; /** * Removes all linked clients from memory and persisted state, while keeping the local identity * key pairs intact. */ unlinkAllClients(): Promise; /** * Wipes everything this instance owns — local identity key pairs and all linked clients, in * memory and in storage. After a reset, {@link initialize} must be called again before use (it * will generate a fresh local identity). * * Only the keys owned by this util are removed, so a shared storage adapter's other data is left * untouched. */ reset(): Promise; private getLinkedClient; private getAesGcmKeyForLinkedClient; /** * Derive the shared AES-GCM key from *explicit* key material + this link's local exchange private * key, returning a standalone key that is **not** stored in (or read from) the per-`linkedClientId` * cache. Use it to give a single session its own immutable key: two sessions that share one * `linkedClientId` (e.g. a secure WebSocket and a secure HTTP exchange to the same peer) would * otherwise clobber each other's cached shared key — the second handshake's re-link drops the * first's key, so frames on the other transport fail to decrypt. Mirrors the derivation in * {@link getAesGcmKeyForLinkedClient} exactly, so the resulting key matches the peer's. * * Requires the local identity to be loaded — call {@link initialize} first when resuming a link * cold (the handshake paths have already initialized by the time they hold key material). */ deriveSharedAesGcmKey({ exchangePublicKey, saltString, infoString, bindVerifyKeysIntoDerivation, verifyPublicKey }: { exchangePublicKey: TSerializedCryptoKeyData_X25519_Raw; saltString?: string; infoString?: string; bindVerifyKeysIntoDerivation?: boolean; /** The peer's verify public key — required when `bindVerifyKeysIntoDerivation` is true. */ verifyPublicKey?: TSerializedCryptoKeyData_Ed25519_Raw; }): Promise; /** * Derive a symmetric AES-GCM key bound to **this link's own identity** — for sealing data the server * hands a client and reads back later (e.g. a stateless secure-exchange session ticket), where only * this server (any isolate that loaded the same persisted identity) can open it. * * Deterministic: an X25519 ECDH of the local exchange private key against its own public key, fed * through the same vetted HKDF as peer key derivation, with a fixed versioned info label. So every * isolate sharing the persisted identity derives the identical key, and no raw private-key bytes are * exposed. The {@link version} is part of the label, so a future rotation can run two keys during a * grace window (old tickets opened with `v1` while new ones issue under `v2`). * * Requires the local identity (call {@link initialize} / {@link provisionIdentity} first); in * `"required"` mode an unprovisioned link throws {@link IdentityNotProvisionedError}. */ deriveLocalSealKey(options?: { version?: string; }): Promise; encryptDataForLinkedClient({ dataToEncrypt, linkedClientId }: IEncryptDataForLinkedClient): Promise; decryptDataFromLinkedClient({ dataToDecrypt, linkedClientId }: IDecryptDataFromLinkedClient): Promise; /** * Bytes counterpart of {@link encryptDataForLinkedClient} — encrypts raw bytes with the shared * AES-GCM key, returning a binary nonce + ciphertext. Use it for binary channels (e.g. msgpack * WebSocket frames) to avoid base64 inflation. */ encryptBytesForLinkedClient({ dataToEncrypt, linkedClientId }: { dataToEncrypt: Uint8Array; linkedClientId: TTypeAndId; }): Promise; /** Bytes counterpart of {@link decryptDataFromLinkedClient}. */ decryptBytesFromLinkedClient({ dataToDecrypt, linkedClientId }: { dataToDecrypt: TEncryptedAesGcmBytes; linkedClientId: TTypeAndId; }): Promise; signAndEncryptDataForLinkedClient({ dataToEncrypt, linkedClientId }: IEncryptDataForLinkedClient): Promise<{ encryptedData: TEncryptedAesGcmPayload; signatureBase64: string; }>; /** * Decrypts a payload from a linked client and verifies that the decrypted plaintext was signed * by that client. Counterpart to {@link signAndEncryptDataForLinkedClient}. * * Returns the decrypted `data` alongside `isValid` — the caller decides how to handle an invalid * signature. (A tampered ciphertext fails earlier at AES-GCM decryption.) */ decryptAndVerifyDataFromLinkedClient({ dataToDecrypt, linkedClientId, signatureBase64 }: IDecryptAndVerifyDataFromLinkedClient): Promise<{ data: string; isValid: boolean; }>; /** * ⚠ Multi-part challenges join with `"::"` — a **concatenation-ambiguity** hazard: when a caller * controls two adjacent parts, distinct tuples can produce identical signed bytes (`["a::b"]` * vs `["a","b"]`), and two operations' challenges can collide unless every call site remembers * its own fixed tag. Prefer {@link signChallengeCanonical}: domain-tagged, versioned, exact * field boundaries by construction. This method stays byte-for-byte for deployed contracts. */ signChallenge(challenge: [string, ...string[]]): Promise<{ signatureBase64: string; }>; /** * Sign a {@link ICanonicalChallenge} — the canonical, domain-tagged, versioned challenge form * ({@link buildCanonicalChallenge} defines the signed bytes). Same key and signature scheme as * {@link signChallenge}, safer byte layout; the verify dual is * {@link verifyChallengeCanonicalFromLinkedClient}, which takes the same structured challenge. */ signChallengeCanonical(challenge: ICanonicalChallenge): Promise<{ signatureBase64: string; }>; /** * Verify a signature produced by {@link signChallengeCanonical} against the linked client's * verify key. Takes the **structured** challenge and rebuilds the canonical string itself, so * signer and verifier can never disagree on byte construction. */ verifyChallengeCanonicalFromLinkedClient({ linkedClientId, challenge, signatureBase64 }: { linkedClientId: TTypeAndId; challenge: ICanonicalChallenge; signatureBase64: string; }): Promise; /** * Verifies a signature over `challenge` against the linked client's verify (Ed25519) public key. */ verifyChallengeFromLinkedClient({ linkedClientId, challenge, signatureBase64 }: IVerifyChallengeFromLinkedClient): Promise; } //#endregion //#region src/util/crypto/crypto.converters.d.ts /** * * [CRYPTO ALGO] ED25519 * */ declare const convertEd25519RawDataStringToObject: (inputDataString: `ed25519::raw_base64::${string}`) => { formattedString: `ed25519::raw_base64::${string}`; type: ECryptoKeyAlgo.ed25519; format: ECryptoKeyFormat.raw_base64; data: string; }; declare const convertEd25519JwkDataStringToObject: (inputDataString: `ed25519::jwk::${string}`) => { formattedString: `ed25519::jwk::${string}`; type: ECryptoKeyAlgo.ed25519; format: ECryptoKeyFormat.jwk; data: JsonWebKey; }; declare const convertEd25519FormattedStringToObject: (inputDataString: `ed25519::raw_base64::${string}` | `ed25519::jwk::${string}`) => { formattedString: `ed25519::raw_base64::${string}` | `ed25519::jwk::${string}`; type: ECryptoKeyAlgo.ed25519; format: ECryptoKeyFormat; data: string; }; declare const convertEd25519RawDataStringToSerializedKeyData: (input: TSerializedCryptoKeyData_Ed25519_Raw) => ISerializedKeyData_Ed25519_Raw; declare const convertEd25519JwkDataStringToSerializedKeyData: (input: TSerializedCryptoKeyData_Ed25519_Jwk) => ISerializedKeyData_Ed25519_Jwk; declare const convertEd25519FormattedStringToSerializedKeyData: (input: I) => O; /** * * [CRYPTO ALGO] X25519 * */ declare const convertX25519RawDataStringToObject: (inputDataString: `x25519::raw_base64::${string}`) => { formattedString: `x25519::raw_base64::${string}`; type: ECryptoKeyAlgo.x25519; format: ECryptoKeyFormat.raw_base64; data: string; }; declare const convertX25519JwkDataStringToObject: (inputDataString: `x25519::jwk::${string}`) => { formattedString: `x25519::jwk::${string}`; type: ECryptoKeyAlgo.x25519; format: ECryptoKeyFormat.jwk; data: JsonWebKey; }; declare const convertX25519FormattedStringToObject: (inputDataString: `x25519::raw_base64::${string}` | `x25519::jwk::${string}`) => { formattedString: `x25519::raw_base64::${string}` | `x25519::jwk::${string}`; type: ECryptoKeyAlgo.x25519; format: ECryptoKeyFormat; data: string; }; declare const convertX25519RawDataStringToSerializedKeyData: (input: TSerializedCryptoKeyData_X25519_Raw) => ISerializedKeyData_X25519_Raw; declare const convertX25519JwkDataStringToSerializedKeyData: (input: TSerializedCryptoKeyData_X25519_Jwk) => ISerializedKeyData_X25519_Jwk; declare const convertX25519FormattedStringToSerializedKeyData: (input: I) => O; //#endregion //#region src/util/crypto/ed25519/generateEd25519KeyPair.d.ts declare const generateEd25519KeyPair: () => Promise; //#endregion //#region src/util/crypto/ed25519/importEd25519Key.d.ts declare const importEd25519Key: { private: { fromFormattedString: { readonly extractable: (input: `ed25519::jwk::${string}`) => Promise; readonly nonExtractable: (input: `ed25519::jwk::${string}`) => Promise; }; fromSerializedObject: { readonly extractable: (input: TSerializedCryptoKeyData_Ed25519_Jwk_Transformed) => Promise; readonly nonExtractable: (input: TSerializedCryptoKeyData_Ed25519_Jwk_Transformed) => Promise; }; fromJwk: { readonly extractable: (input: JsonWebKey) => Promise; readonly nonExtractable: (input: JsonWebKey) => Promise; }; }; public: { fromBase64: { readonly extractable: (input: string) => Promise; readonly nonExtractable: (input: string) => Promise; }; fromFormattedString: { readonly extractable: (input: `ed25519::raw_base64::${string}` | `ed25519::jwk::${string}`) => Promise; readonly nonExtractable: (input: `ed25519::raw_base64::${string}` | `ed25519::jwk::${string}`) => Promise; }; fromSerializedObject: { readonly extractable: (input: TSerializedCryptoKeyData_Ed25519_Raw_Transformed | TSerializedCryptoKeyData_Ed25519_Jwk_Transformed) => Promise; readonly nonExtractable: (input: TSerializedCryptoKeyData_Ed25519_Raw_Transformed | TSerializedCryptoKeyData_Ed25519_Jwk_Transformed) => Promise; }; fromJwk: { readonly extractable: (input: JsonWebKey) => Promise; readonly nonExtractable: (input: JsonWebKey) => Promise; }; }; }; //#endregion //#region src/util/crypto/ed25519/serializeEd25519Key_Jwk.d.ts declare const serializeEd25519Key_Jwk: (key: CryptoKey) => Promise; //#endregion //#region src/util/crypto/ed25519/serializeEd25519Key_Raw.d.ts declare const serializeEd25519Key_Raw: (publicKey: CryptoKey) => Promise; //#endregion //#region src/util/crypto/ed25519/signCombinedTextDataWithKeyEd25519.d.ts declare const DEFAULT_COMBINED_TEXT_DATA_SEPARATOR = "::"; /** * ⚠ Separator-joining caller-controlled strings is a **concatenation-ambiguity** hazard: the parts * have no escaping, so `["a::b"]` and `["a","b"]` sign identical bytes, and two operations' * challenges can collide unless every call site adds its own fixed tag. For new signing surfaces * prefer the canonical challenge form (`buildCanonicalChallenge` / * `ClientCryptoKeyLink.signChallengeCanonical`) — exact field boundaries by construction. This * helper stays byte-for-byte for deployed contracts. */ declare const signCombinedTextDataWithKeyEd25519: (data: string[], cryptoKey: CryptoKey, separator?: string) => Promise; //#endregion //#region src/util/crypto/ed25519/signTextDataWithKeyEd25519.d.ts declare const signTextDataWithKeyEd25519: (data: string, cryptoKey: CryptoKey) => Promise; //#endregion //#region src/util/crypto/ed25519/verifyWithKeyEd25519.d.ts declare const verifyWithKeyEd25519: ({ challenge, signatureBase64, publicKey }: { challenge: string; signatureBase64: string; publicKey: CryptoKey; }) => Promise; //#endregion //#region src/util/crypto/portable_key/key_encrypted_payload.d.ts /** * Encrypts a JSON-serializable value under a freshly generated portable AES-256-GCM key. * The returned `keyString` is the ONLY way to decrypt — hand it to the user (QR / copy), * never send it alongside `encryptedData`. */ declare const encryptJsonWithGeneratedKey: ({ data, keyPrefix }: { data: T; keyPrefix: string; }) => Promise<{ keyString: string; encryptedData: TEncryptedAesGcmPayload; }>; type TKeyEncryptedDecryptResult = { ok: true; data: TOut; } | { ok: false; reason: "bad_key_string" | "decrypt_failed" | "invalid_payload"; }; /** * Decrypts with a user-entered portable key string and validates the recovered plaintext against * `schema` before returning it — decrypted data is untrusted input until it parses. Never throws * for bad key strings, wrong keys, or tampered/invalid payloads. */ declare const decryptJsonWithKeyString: ({ keyString, expectedKeyPrefix, encryptedData, schema }: { keyString: string; expectedKeyPrefix: string; encryptedData: TEncryptedAesGcmPayload; schema: TSchema; }) => Promise>>; //#endregion //#region src/util/crypto/portable_key/portable_symmetric_key.d.ts declare const generatePortableAesGcmKey: () => Promise; declare const exportPortableAesGcmKeyToString: ({ aesGcmKey, keyPrefix }: { aesGcmKey: CryptoKey; keyPrefix: string; }) => Promise; type TPortableKeyImportResult = { ok: true; aesGcmKey: CryptoKey; } | { ok: false; reason: "bad_format" | "bad_prefix" | "bad_checksum" | "bad_key_length"; }; /** * Parses a user-entered portable key string. Never throws for bad input strings — every failure * mode maps to a typed `{ ok: false }` reason so UIs can render friendly feedback. (An invalid * `expectedKeyPrefix` still throws: that is a programming error, not user input.) */ declare const importPortableAesGcmKeyFromString: ({ keyString, expectedKeyPrefix }: { keyString: string; expectedKeyPrefix: string; }) => Promise; //#endregion //#region src/util/crypto/x25519/createSharedBitsFromX25519.d.ts declare const createSharedBitsFromX25519: ({ privateKey, publicKey }: { privateKey: CryptoKey; publicKey: CryptoKey; }) => Promise; //#endregion //#region src/util/crypto/x25519/generateX25519KeyPair.d.ts declare const generateX25519KeyPair: () => Promise; //#endregion //#region src/util/crypto/x25519/importX25519Key.d.ts declare const importX25519Key: { private: { fromFormattedString: { readonly extractable: (input: `x25519::jwk::${string}`) => Promise; readonly nonExtractable: (input: `x25519::jwk::${string}`) => Promise; }; fromSerializedObject: { readonly extractable: (input: TSerializedCryptoKeyData_X25519_Jwk_Transformed) => Promise; readonly nonExtractable: (input: TSerializedCryptoKeyData_X25519_Jwk_Transformed) => Promise; }; fromJwk: { readonly extractable: (input: JsonWebKey) => Promise; readonly nonExtractable: (input: JsonWebKey) => Promise; }; }; public: { fromBase64: { readonly extractable: (input: string) => Promise; readonly nonExtractable: (input: string) => Promise; }; fromFormattedString: { readonly extractable: (input: `x25519::raw_base64::${string}` | `x25519::jwk::${string}`) => Promise; readonly nonExtractable: (input: `x25519::raw_base64::${string}` | `x25519::jwk::${string}`) => Promise; }; fromSerializedObject: { readonly extractable: (input: TSerializedCryptoKeyData_X25519_Raw_Transformed | TSerializedCryptoKeyData_X25519_Jwk_Transformed) => Promise; readonly nonExtractable: (input: TSerializedCryptoKeyData_X25519_Raw_Transformed | TSerializedCryptoKeyData_X25519_Jwk_Transformed) => Promise; }; fromJwk: { readonly extractable: (input: JsonWebKey) => Promise; readonly nonExtractable: (input: JsonWebKey) => Promise; }; }; }; //#endregion //#region src/util/crypto/x25519/serializeX25519Key_Jwk.d.ts declare const serializeX25519Key_Jwk: (key: CryptoKey) => Promise; //#endregion //#region src/util/crypto/x25519/serializeX25519Key_Raw.d.ts declare const serializeX25519Key_Raw: (key: CryptoKey) => Promise; //#endregion //#region src/util/data_type/bytes/base64.d.ts /** * Byte ⇄ base64 conversions that work in **every** JavaScript runtime — browsers, Node, Cloudflare * Workers, Deno, Bun, and React Native (Hermes) — without leaning on environment-specific interfaces: * the browser-only `btoa`/`atob` globals (absent in Hermes), or Node's `Buffer` (absent in browsers / * Workers / RN). Built on `@scure/base` (pure JS, audited, zero-dependency) — the same base64 * implementation the crypto layer already uses, so the whole library stays consistent. * * Produces / consumes **standard** base64 (RFC 4648 §4: `+` and `/`, `=` padding) — byte-for-byte * interchangeable with `btoa`/`atob` and Node's `Buffer.toString("base64")`, so it interoperates with * any peer regardless of how that peer encodes. * * NOTE: the TC39 `Uint8Array.prototype.toBase64()` / `Uint8Array.fromBase64()` methods would be the * "native" choice, but as of 2026 they are not yet available across all target runtimes (notably Hermes), * so a pure-JS implementation remains the portable option. */ declare function bytesToBase64(bytes: Uint8Array): string; declare function base64ToBytes(encoded: string): Uint8Array; //#endregion //#region src/util/typescript/special_typescript_types.d.ts type StringKeys = keyof T & string; //#endregion //#region src/util/storage_adapter/typed_storage/StorageValidationError.d.ts /** * A typed-storage read, default, write, or update failed schema validation. Always thrown — * validation is fail-closed; the `onInvalid` option observes, it never suppresses. Carries the * storage `key` and the schema's `issues` so callers can branch (e.g. treat a corrupt record as * absent, run a migration, or surface telemetry). */ declare class StorageValidationError extends Error { readonly key: string; readonly issues: readonly StandardSchemaV1.Issue[]; constructor(key: string, issues: readonly StandardSchemaV1.Issue[]); } //#endregion //#region src/util/storage_adapter/typed_storage/createTypedStorage.d.ts interface ITypedStorage> { getJson: >(key: K) => Promise; getJsonOrDef: >(key: K, defVal: T[K]) => Promise; setJson: >(key: K, val: T[K]) => Promise; removeItem: >(key: K) => Promise; updateJson: >(key: K, updater: (currentVal: T[K] | undefined) => T[K]) => Promise; updateJsonWithDef: >(key: K, defaultVal: T[K], updater: (currentVal: T[K]) => T[K]) => Promise; clearAll: () => Promise; } /** Per-key Standard Schemas — each schema's output type must match its storage field type. */ type TTypedStorageSchemas> = { [K in StringKeys]?: StandardSchemaV1; }; interface ITypedStorageValidationOptions> { /** * Opt-in, per key: when a key has a schema, every value crossing the storage boundary for it is * validated **fail-closed** — reads, supplied defaults, writes, and both sides of an update * (what the updater receives and what it returns). The schema's transformed/defaulted output * (`result.value`) is what gets returned and persisted, so schema and storage never disagree. * Keys without a schema keep the blind typed-cast behavior. Validation is synchronous-only: a * schema returning a Promise fails validation. */ schemas?: TTypedStorageSchemas; /** * Observation hook (telemetry, logging) called with the error before it is thrown. The * operation ALWAYS fails afterwards — this cannot suppress; a throwing hook fails it too. */ onInvalid?: (error: StorageValidationError) => void; } interface ITypedStorage_Create_Input = Record> extends ITypedStorageValidationOptions { storageAdapter: StorageAdapter; } /** * A typed view over a {@link StorageAdapter}. Without `schemas` it is types-only (the stored value * is trusted to match `T` — fine for values only your own code writes). With `schemas`, the * storage boundary gets the same treatment the action layer gives the wire: values are validated * on the way out **and** in, because durable storage is where stale shapes live longest — a value * written by version N and read by version N+3 has crossed every schema change in between. */ declare function createTypedStorage>({ storageAdapter, schemas, onInvalid }: ITypedStorage_Create_Input): ITypedStorage; //#endregion //#region src/util/storage_adapter/specific/browser/browser_storage.d.ts /** * * Web Storage [LOCAL STORAGE] * */ type TCreateWebLocalStorageOptions = Omit & { localStorage: typeof localStorage; }; declare function createWebLocalStorageMethods(_localStorage: typeof localStorage): IStorageAdapterMethods_String; declare const createWebLocalStorageAdapter: ({ localStorage: _localStorage, ...options }: TCreateWebLocalStorageOptions) => StorageAdapter; declare function createTypedWebLocalStorage>(options: TCreateWebLocalStorageOptions & ITypedStorageValidationOptions): ITypedStorage; /** * * Web Storage [SESSION STORAGE] * */ type TCreateWebSessionStorageOptions = Omit & { sessionStorage: typeof sessionStorage; }; declare function createWebSessionStorageMethods(_sessionStorage: typeof sessionStorage): IStorageAdapterMethods_String; declare const createWebSessionStorageAdapter: ({ sessionStorage: _sessionStorage, ...options }: TCreateWebSessionStorageOptions) => StorageAdapter; declare function createTypedWebSessionStorage>(options: TCreateWebSessionStorageOptions & ITypedStorageValidationOptions): ITypedStorage; //#endregion //#region src/util/storage_adapter/specific/cloudflare/durable_object/durable_object_storage.types.d.ts interface DurableObjectGetOptions { allowConcurrency?: boolean; noCache?: boolean; } interface DurableObjectPutOptions { allowConcurrency?: boolean; allowUnconfirmed?: boolean; noCache?: boolean; } interface IDurableObjectStorage { get(key: string, options?: DurableObjectGetOptions): Promise; get(keys: string[], options?: DurableObjectGetOptions): Promise>; put(key: string, value: T, options?: DurableObjectPutOptions): Promise; put(entries: Record, options?: DurableObjectPutOptions): Promise; delete(key: string, options?: DurableObjectPutOptions): Promise; delete(keys: string[], options?: DurableObjectPutOptions): Promise; } //#endregion //#region src/util/storage_adapter/specific/cloudflare/durable_object/durable_object_storage.d.ts declare function createDurableObjectStorageMethods(durableObjectStorage: IDurableObjectStorage): IStorageAdapterMethods_Json; type TCreateDurableObjectStorageOptions = Omit & { durableObjectStorage: IDurableObjectStorage; }; /** * Wraps a Durable Object's storage in the generic StorageAdapter interface, e.g. for handing to a * ClientCryptoKeyLink so it can persist its keys inside the DO's own storage. */ declare const createDurableObjectStorageAdapter: ({ durableObjectStorage, ...options }: TCreateDurableObjectStorageOptions) => StorageAdapter; declare function createDurableObjectTypedStorage>(options: TCreateDurableObjectStorageOptions & ITypedStorageValidationOptions): ITypedStorage; //#endregion //#region src/util/storage_adapter/specific/cloudflare/kv/kv_storage.types.d.ts interface IKVNamespaceGetOptions { cacheTtl?: number; } interface IKVNamespacePutOptions { /** Absolute time (seconds since epoch) at which the key should expire. */ expiration?: number; /** Relative TTL (in seconds) from now, after which the key should expire. */ expirationTtl?: number; metadata?: unknown; } /** * Minimal subset of Cloudflare's `KVNamespace` binding that our storage adapter relies on. Values * are always written/read as strings (KV's `put` only accepts string/stream/buffer values), so the * adapter is a {@link EStorageAdapterType.string} adapter and JSON (de)serialization happens in the * generic `StorageAdapter`. */ interface IKVNamespace { get(key: string, options?: IKVNamespaceGetOptions): Promise; put(key: string, value: string, options?: IKVNamespacePutOptions): Promise; delete(key: string): Promise; } //#endregion //#region src/util/storage_adapter/specific/cloudflare/kv/kv_storage.d.ts interface ICreateKVStorageMethodsOptions { /** The `KVNamespace` binding, e.g. accessed off `env.MY_KV` inside a worker. */ kvNamespace: IKVNamespace; /** Default options applied to every `put`, e.g. `{ expirationTtl }` for TTL-based eviction. */ defaultPutOptions?: IKVNamespacePutOptions; } declare function createKVStorageMethods({ kvNamespace, defaultPutOptions }: ICreateKVStorageMethodsOptions): IStorageAdapterMethods_String; type TCreateKVStorageOptions = Omit & ICreateKVStorageMethodsOptions; /** * Wraps a Cloudflare KV namespace binding in the generic StorageAdapter interface, e.g. for handing * to a ClientCryptoKeyLink so it can persist its keys inside KV. */ declare const createKVStorageAdapter: ({ kvNamespace, defaultPutOptions, ...options }: TCreateKVStorageOptions) => StorageAdapter; declare function createKVTypedStorage>(options: TCreateKVStorageOptions & ITypedStorageValidationOptions): ITypedStorage; //#endregion //#region src/util/storage_adapter/specific/memory/memory_storage.d.ts type TMemoryStorage_string = Map; type TMemoryStorage_json = Map; /** * * Memory Storage [STRING] * */ type TCreateMemoryStorageOptions_string = Omit & { memoryStorageMap?: TMemoryStorage_string; }; declare function createMemoryStorageMethods_string(memoryStorageMap?: TMemoryStorage_string): IStorageAdapterMethods_String; declare const createMemoryStorageAdapter_string: (options?: TCreateMemoryStorageOptions_string) => StorageAdapter; declare function createTypedMemoryStorage_string>(options?: TCreateMemoryStorageOptions_string & ITypedStorageValidationOptions): ITypedStorage; /** * * Memory Storage [JSON] * */ type TCreateMemoryStorageOptions_json = Omit & { memoryStorageMap?: TMemoryStorage_json; }; declare function createMemoryStorageMethods_json(memoryStorageMap?: TMemoryStorage_json): IStorageAdapterMethods_Json; declare const createMemoryStorageAdapter_json: (options?: TCreateMemoryStorageOptions_json) => StorageAdapter; declare function createTypedMemoryStorage_json>(options?: TCreateMemoryStorageOptions_json & ITypedStorageValidationOptions): ITypedStorage; //#endregion //#region src/util/timing/unrefTimer.d.ts /** * Detach a pending timer from the event loop so it never, by itself, keeps a Node process (or a * test runner) alive — a no-op in browsers and Workers, where a timer handle is a plain `number` * with no `unref`. * * It exists to keep the one cross-environment shape difference in a single place instead of at every * timer site: the `ReturnType` a caller holds is `NodeJS.Timeout` under Node (it * carries `unref`) and a bare `number` under the DOM lib (it does not). Typing the parameter as the * union of both lets every `setTimeout` handle pass without a cast, and the `typeof` narrows to the * only arm that has the method. */ declare function unrefTimer(timer: number | { unref?: () => void; }): void; //#endregion export { bytesToBase64 as $, sha256Bytes as $t, TKeyEncryptedDecryptResult as A, createWebLocalStorageMethods as At, TSerializedCryptoKeyData_X25519_Raw as B, generateEd25519KeyPair as Bt, TCanonicalJsonValue as C, createSharedBitsFromX25519 as Ct, TEncryptedAesGcmPayload as D, createTypedWebLocalStorage as Dt, TEncryptedAesGcmBytes as E, createTypedStorage as Et, TSerializedCryptoKeyData_Ed25519_Jwk_Transformed as F, decryptTextDataWithAesGcmKey as Ft, TStorageAdapterMethods as G, importEd25519Key as Gt, TSerializedCryptoKeyPairDataEd25519 as H, generateX25519KeyPair as Ht, TSerializedCryptoKeyData_Ed25519_Raw as I, encryptBytesWithAesGcmKey as It, TVerifyChallengeWithSignature_Input as J, serializeEd25519Key_Jwk as Jt, TTypeAndId as K, importPortableAesGcmKeyFromString as Kt, TSerializedCryptoKeyData_Ed25519_Raw_Transformed as L, encryptJsonWithGeneratedKey as Lt, TMemoryStorage_string as M, createWebSessionStorageMethods as Mt, TPortableKeyImportResult as N, decryptBytesWithAesGcmKey as Nt, TEncryptedAesGcmPayload_Transformed as O, createTypedWebSessionStorage as Ot, TSerializedCryptoKeyData_Ed25519_Jwk as P, decryptJsonWithKeyString as Pt, buildVerifyKeyBoundInfoString as Q, sha256Base64 as Qt, TSerializedCryptoKeyData_X25519_Jwk as R, encryptTextDataWithAesGcmKey as Rt, StringKeys as S, createMemoryStorageMethods_string as St, TCreateKVStorageOptions as T, createTypedMemoryStorage_string as Tt, TSerializedCryptoKeyPairDataX25519 as U, hashCanonicalJsonSha256Base64 as Ut, TSerializedCryptoKeyData_X25519_Raw_Transformed as V, generatePortableAesGcmKey as Vt, TSerializedKeyData as W, hashCanonicalJsonSha256Hex as Wt, base64ToBytes as X, serializeX25519Key_Jwk as Xt, TVerifyChallengeWithSignature_WithThrow_Input as Y, serializeEd25519Key_Raw as Yt, buildCanonicalChallenge as Z, serializeX25519Key_Raw as Zt, ITypedStorageValidationOptions as _, createKVStorageMethods as _t, EStorageAdapterType as a, vCryptoKeyPairDataEd25519 as an, convertEd25519RawDataStringToSerializedKeyData as at, StorageAdapter as b, createMemoryStorageAdapter_string as bt, ISerializedKeyData_Ed25519_Jwk as c, vSerializedCryptoKeyDataEd25519_Jwk as cn, convertX25519JwkDataStringToObject as ct, ISerializedKeyData_X25519_Raw as d, vSerializedCryptoKeyDataX25519_Raw as dn, convertX25519RawDataStringToSerializedKeyData as dt, sha256Hex as en, convertEd25519FormattedStringToObject as et, IStorageAdapterConstructor as f, vVerifyChallengeWithSignature_Input as fn, createAesGcmKeyFromX25519Keys as ft, ITypedStorage as g, createKVStorageAdapter as gt, IStorageKeyGetterAndSetter as h, createDurableObjectTypedStorage as ht, ECryptoKeyFormat as i, unrefTimer as in, convertEd25519RawDataStringToObject as it, TMemoryStorage_json as j, createWebSessionStorageAdapter as jt, TIdentityMode as k, createWebLocalStorageAdapter as kt, ISerializedKeyData_Ed25519_Raw as l, vSerializedCryptoKeyDataEd25519_Raw as ln, convertX25519JwkDataStringToSerializedKeyData as lt, IStorageAdapterMethods_String as m, verifyWithKeyEd25519 as mn, createDurableObjectStorageMethods as mt, DEFAULT_COMBINED_TEXT_DATA_SEPARATOR as n, signTextDataWithKeyEd25519 as nn, convertEd25519JwkDataStringToObject as nt, ICanonicalChallenge as o, vCryptoKeyPairDataX25519 as on, convertX25519FormattedStringToObject as ot, IStorageAdapterMethods_Json as p, vVerifyChallengeWithSignature_WithThrow_Input as pn, createDurableObjectStorageAdapter as pt, TTypedStorageSchemas as q, importX25519Key as qt, ECryptoKeyAlgo as r, stringifyCanonicalJson as rn, convertEd25519JwkDataStringToSerializedKeyData as rt, ICreateKVStorageMethodsOptions as s, vEncryptedAesGcmPayload as sn, convertX25519FormattedStringToSerializedKeyData as st, ClientCryptoKeyLink as t, signCombinedTextDataWithKeyEd25519 as tn, convertEd25519FormattedStringToSerializedKeyData as tt, ISerializedKeyData_X25519_Jwk as u, vSerializedCryptoKeyDataX25519_Jwk as un, convertX25519RawDataStringToObject as ut, ITypedStorage_Create_Input as v, createKVTypedStorage as vt, TCreateDurableObjectStorageOptions as w, createTypedMemoryStorage_json as wt, StorageValidationError as x, createMemoryStorageMethods_json as xt, IdentityNotProvisionedError as y, createMemoryStorageAdapter_json as yt, TSerializedCryptoKeyData_X25519_Jwk_Transformed as z, exportPortableAesGcmKeyToString as zt }; //# sourceMappingURL=index-LpxnCt_F-DNsGOYe-.d.mts.map