Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { b58cencode, b58cdecode, prefix, buf2hex } from '@taquito/utils';
import toBuffer from 'typedarray-to-buffer';
import elliptic from 'elliptic';
const pref = {
p256: {
pk: prefix['p2pk'],
sk: prefix['p2sk'],
pkh: prefix.tz3,
sig: prefix.p2sig,
},
secp256k1: {
pk: prefix['sppk'],
sk: prefix['spsk'],
pkh: prefix.tz2,
sig: prefix.spsig,
},
};
/**
* @description Provide signing logic for elliptic curve based key (tz2, tz3)
*/
export class ECKey {
private _key: Uint8Array;
private _publicKey: Uint8Array;
/**
*
* @param curve Curve to use with the key
* @param key Encoded private key
* @param encrypted Is the private key encrypted
* @param decrypt Decrypt function