/** * A WebCrypto `CryptoKey`, declared structurally so core's published types * need neither the DOM lib nor Node's types. Every runtime's native * `CryptoKey` satisfies it. */ export interface WebCryptoKey { readonly type: string; readonly extractable: boolean; readonly algorithm: object; readonly usages: readonly string[]; } /** The subset of `SubtleCrypto` this package calls, typed loosely on purpose (see {@link WebCryptoKey}). */ export interface WebCryptoSubtle { importKey(format: 'raw' | 'jwk', keyData: object, algorithm: object, extractable: boolean, usages: string[]): Promise; exportKey(format: 'raw', key: WebCryptoKey): Promise; generateKey(algorithm: object, extractable: boolean, usages: string[]): Promise<{ publicKey: WebCryptoKey; privateKey: WebCryptoKey; }>; deriveBits(algorithm: object, baseKey: WebCryptoKey, length: number): Promise; sign(algorithm: string, key: WebCryptoKey, data: Uint8Array): Promise; encrypt(algorithm: object, key: WebCryptoKey, data: Uint8Array): Promise; decrypt(algorithm: object, key: WebCryptoKey, data: Uint8Array): Promise; digest(algorithm: string, data: Uint8Array): Promise; } /** The WebCrypto subtle interface, or a closed-set failure when the runtime lacks it. */ export declare function webCryptoSubtle(): WebCryptoSubtle;