mirror of https://github.com/waku-org/js-waku.git
Remove `Buffer` from `ecRecoverPubKey`
This commit is contained in:
parent
76777744f0
commit
64ea36faa3
|
@ -252,9 +252,12 @@ function getHash(message: Uint8Array, isSigned: boolean): string {
|
||||||
|
|
||||||
function ecRecoverPubKey(
|
function ecRecoverPubKey(
|
||||||
messageHash: string,
|
messageHash: string,
|
||||||
signature: Buffer
|
signature: Uint8Array
|
||||||
): Uint8Array | undefined {
|
): Uint8Array | undefined {
|
||||||
const recovery = signature.slice(64).readIntBE(0, 1);
|
// TODO: This is only needed because we are getting a `Buffer` instance.
|
||||||
|
signature = new Uint8Array(signature);
|
||||||
|
const recoveryDataView = new DataView(signature.slice(64).buffer);
|
||||||
|
const recovery = recoveryDataView.getUint8(0);
|
||||||
const _signature = secp.Signature.fromCompact(signature.slice(0, 64));
|
const _signature = secp.Signature.fromCompact(signature.slice(0, 64));
|
||||||
|
|
||||||
return secp.recoverPublicKey(
|
return secp.recoverPublicKey(
|
||||||
|
|
Loading…
Reference in New Issue