UNPKG

@mobile-wallet-protocol/client

Version:
14 lines (13 loc) 1.04 kB
import { CryptoKey, CryptoKeyPair } from './types'; import { EncryptedData, RPCRequest, RPCResponse } from '../message'; export declare function generateKeyPair(): Promise<CryptoKeyPair>; export declare function deriveSharedSecret(ownPrivateKey: CryptoKey, peerPublicKey: CryptoKey): Promise<CryptoKey>; export declare function encrypt(sharedSecret: CryptoKey, plainText: string): Promise<EncryptedData>; export declare function decrypt(sharedSecret: CryptoKey, { iv, cipherText }: EncryptedData): Promise<string>; export declare function exportKeyToHexString(type: 'public' | 'private', key: CryptoKey): Promise<string>; export declare function importKeyFromHexString(type: 'public' | 'private', hexString: string): Promise<CryptoKey>; export declare function encryptContent(content: RPCRequest | RPCResponse, sharedSecret: CryptoKey): Promise<EncryptedData>; export declare function decryptContent<R extends RPCRequest | RPCResponse>(encryptedData: { iv: Uint8Array; cipherText: Uint8Array; }, sharedSecret: CryptoKey): Promise<R>;