@toruslabs/eccrypto
Version:
JavaScript Elliptic curve cryptography library, includes fix to browser.js so that encrypt/decrypt works
28 lines (27 loc) • 1.33 kB
TypeScript
export interface Ecies {
iv: Uint8Array;
ephemPublicKey: Uint8Array;
ciphertext: Uint8Array;
mac: Uint8Array;
}
/**
* Generate a new valid private key. Will use the window.crypto or window.msCrypto as source
* depending on your browser.
*/
export declare const generatePrivate: () => Uint8Array;
export declare const getPublic: (privateKey: Uint8Array) => Uint8Array;
/**
* Get compressed version of public key.
*/
export declare const getPublicCompressed: (privateKey: Uint8Array) => Uint8Array;
export declare const sign: (privateKey: Uint8Array, msg: Uint8Array) => Promise<Uint8Array>;
export declare const verify: (publicKey: Uint8Array, msg: Uint8Array, sig: Uint8Array) => Promise<null>;
export declare const derive: (privateKeyA: Uint8Array, publicKeyB: Uint8Array) => Promise<Uint8Array>;
export declare const deriveUnpadded: (privateKeyA: Uint8Array, publicKeyB: Uint8Array) => Promise<Uint8Array>;
export declare const derivePadded: (privateKeyA: Uint8Array, publicKeyB: Uint8Array) => Promise<Uint8Array>;
export declare const encrypt: (publicKeyTo: Uint8Array, msg: Uint8Array, opts?: {
iv?: Uint8Array;
ephemPrivateKey?: Uint8Array;
padding?: boolean;
}) => Promise<Ecies>;
export declare const decrypt: (privateKey: Uint8Array, opts: Ecies, _padding?: boolean) => Promise<Uint8Array>;