feat: add PublicKey.toBytes and fix buffer incompatibility
This commit is contained in:
committed by
Justin Starry
parent
abada56ba1
commit
a622198235
@@ -195,14 +195,8 @@ export class Secp256k1Program {
|
||||
`Private key must be ${PRIVATE_KEY_BYTES} bytes but received ${pkey.length} bytes`,
|
||||
);
|
||||
|
||||
let privateKey;
|
||||
if (Array.isArray(pkey)) {
|
||||
privateKey = Uint8Array.from(pkey);
|
||||
} else {
|
||||
privateKey = pkey;
|
||||
}
|
||||
|
||||
try {
|
||||
const privateKey = toBuffer(pkey);
|
||||
const publicKey = publicKeyCreate(privateKey, false).slice(1); // throw away leading byte
|
||||
const messageHash = Buffer.from(
|
||||
keccak_256.update(toBuffer(message)).digest(),
|
||||
|
Reference in New Issue
Block a user