]> zoso.dev Git - libnemo.git/commitdiff
Fix tools sign function.
authorChris Duncan <chris@zoso.dev>
Mon, 25 Nov 2024 20:52:39 +0000 (12:52 -0800)
committerChris Duncan <chris@zoso.dev>
Mon, 25 Nov 2024 20:52:39 +0000 (12:52 -0800)
src/lib/tools.ts

index bc76205526f86fe6d22584ff727877925c38711d..153539bdcf3234c88c8b15e248ba917553dc9623 100644 (file)
@@ -86,10 +86,11 @@ export async function hash (data: string | string[], encoding?: 'hex'): Promise<
 * @returns {Promise<string>} Hexadecimal-formatted signature
 */
 export async function sign (key: string, ...input: string[]): Promise<string> {
+       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))
 }