From: Chris Duncan Date: Sat, 23 Nov 2024 09:48:11 +0000 (-0800) Subject: Start testing new tweetnacl rewrite in Account. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=704da0504429e2dd0ff1299198c6d317caa2c6fb;p=libnemo.git Start testing new tweetnacl rewrite in Account. --- diff --git a/src/lib/account.ts b/src/lib/account.ts index 1f54c92..3e9be66 100644 --- a/src/lib/account.ts +++ b/src/lib/account.ts @@ -4,7 +4,7 @@ import blake2b from 'blake2b' import { ACCOUNT_KEY_LENGTH, ALPHABET, PREFIX, PREFIX_LEGACY } from './constants.js' import { base32, bytes, hex } from './convert.js' -import Ed25519 from './ed25519.js' +import { keyPair, secretKeyLength } from './workers/nano25519.js' import { Rpc } from './rpc.js' import { Safe } from './safe.js' @@ -87,8 +87,8 @@ export class Account { */ static async fromPrivateKey (key: string, index?: number): Promise { Account.#validateKey(key) - const publicKey = Ed25519.getPublicKey(key) - const account = await Account.fromPublicKey(publicKey, index) + const { publicKey } = keyPair.fromSecretKey(hex.toBytes(key)) + const account = await Account.fromPublicKey(bytes.toHex(publicKey), index) account.#prv = key.toUpperCase() return account }