From: Chris Duncan Date: Mon, 25 Nov 2024 20:52:39 +0000 (-0800) Subject: Fix tools sign function. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=75c9779f81552c817c9c31b7bbcdee071f2f5156;p=libnemo.git Fix tools sign function. --- diff --git a/src/lib/tools.ts b/src/lib/tools.ts index bc76205..153539b 100644 --- a/src/lib/tools.ts +++ b/src/lib/tools.ts @@ -86,10 +86,11 @@ export async function hash (data: string | string[], encoding?: 'hex'): Promise< * @returns {Promise} Hexadecimal-formatted signature */ export async function sign (key: string, ...input: string[]): Promise { + const account = await Account.fromPrivateKey(key) const data = await hash(input) const signature = Ed25519.sign( hex.toBytes(data), - hex.toBytes(key)) + hex.toBytes(`${account.privateKey}${account.publicKey}`)) return bytes.toHex(signature.subarray(0, 64)) }