@@ -96,7 +96,7 @@ export function generateMetadataParams(ecCurve: Curve, serverTimeOffset: number,
9696 } ;
9797 const msgHash = keccak256Bytes ( utf8ToBytes ( stringify ( setData ) ) ) ;
9898 // metadata only uses secp for sig validation; prehash: false because msgHash is already hashed
99- const sig = secp256k1 . sign ( msgHash , hexToBytes ( bigintToHex ( privateKey ) ) , { prehash : false } ) ;
99+ const sig = secp256k1 . sign ( msgHash , numberToBytesBE ( privateKey , 32 ) , { prehash : false } ) ;
100100 const pubKey = derivePubKey ( ecCurve , privateKey ) ;
101101 return {
102102 pub_key_X : pubKey . x . toString ( 16 ) , // DO NOT PAD THIS. BACKEND DOESN'T
@@ -148,7 +148,7 @@ export function generateNonceMetadataParams(
148148 }
149149
150150 const msgHash = keccak256Bytes ( utf8ToBytes ( stringify ( setData ) ) ) ;
151- const sig = secp256k1 . sign ( msgHash , hexToBytes ( bigintToHex ( privateKey ) ) , { prehash : false } ) ;
151+ const sig = secp256k1 . sign ( msgHash , numberToBytesBE ( privateKey , 32 ) , { prehash : false } ) ;
152152 const pubKey = derivePubKey ( secp256k1 , privateKey ) ;
153153 return {
154154 pub_key_X : bigintToHex ( pubKey . x ) ,
@@ -259,7 +259,7 @@ export async function getOrSetSapphireMetadataNonce(
259259 timestamp : ( ~ ~ ( serverTimeOffset + Date . now ( ) / 1000 ) ) . toString ( 16 ) ,
260260 } ;
261261 const msgHash = keccak256Bytes ( utf8ToBytes ( stringify ( setData ) ) ) ;
262- const sig = secp256k1 . sign ( msgHash , hexToBytes ( bigintToHex ( privKey ) ) , { prehash : false } ) ;
262+ const sig = secp256k1 . sign ( msgHash , numberToBytesBE ( privKey , 32 ) , { prehash : false } ) ;
263263 const pubKey = derivePubKey ( secp256k1 , privKey ) ;
264264 data = {
265265 ...data ,
0 commit comments