open-collaboration-protocol
Version:
Open Collaboration Protocol implementation, part of the Open Collaboration Tools project
26 lines • 953 B
TypeScript
export interface KeyPair {
publicKey: string;
privateKey: string;
}
export interface CryptoLib {
/**
* Encrypts the given data with the given key.
*/
symEncrypt(data: Uint8Array, key: string, iv: string): Promise<Uint8Array>;
/**
* Decrypts the given data with the given key.
*/
symDecrypt(data: Uint8Array, key: string, iv: string): Promise<Uint8Array>;
generateSymKey(): Promise<string>;
generateIV(): Promise<string>;
publicEncrypt(data: Uint8Array, key: string): Promise<Uint8Array>;
privateDecrypt(data: Uint8Array, key: string): Promise<Uint8Array>;
/**
* Generates a random key pair.
*/
generateKeyPair(): Promise<KeyPair>;
}
export type CryptoModule = typeof self.crypto | typeof import('node:crypto').webcrypto;
export declare const setCryptoModule: (cm: CryptoModule) => void;
export declare const getCryptoLib: () => CryptoLib;
//# sourceMappingURL=crypto.d.ts.map