UNPKG

1.23 kBTypeScriptView Raw
1/**
2 * @prettier
3 *
4 * Utility methods for Ellipic-Curve Diffie-Hellman (ECDH) shared secret generation
5 *
6 * > Elliptic-curve Diffie–Hellman (ECDH) is a key agreement protocol that allows two parties, each having an
7 * > elliptic-curve public–private key pair, to establish a shared secret over an insecure channel.
8 * > This shared secret may be directly used as a key, or to derive another key. The key, or the derived key, can then
9 * > be used to encrypt subsequent communications using a symmetric-key cipher. It is a variant of the Diffie–Hellman
10 * > protocol using elliptic-curve cryptography.
11 *
12 * https://en.wikipedia.org/wiki/Elliptic-curve_Diffie%E2%80%93Hellman
13 */
14/// <reference types="node" />
15import * as bip32 from 'bip32';
16import * as utxolib from '@bitgo/utxo-lib';
17/**
18 * Calculate the Elliptic Curve Diffie Hellman
19 * @param privateKey HDNode of private key
20 * @param publicKey [neutered] HDNode of public key
21 * @returns Buffer public key buffer that can be used as shared secret (see note)
22 */
23export declare function getSharedSecret(privateKey: bip32.BIP32Interface | utxolib.ECPair.ECPairInterface | Buffer, publicKey: bip32.BIP32Interface | Buffer): Buffer;
24//# sourceMappingURL=ecdh.d.ts.map
\No newline at end of file