From 704da0504429e2dd0ff1299198c6d317caa2c6fb Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sat, 23 Nov 2024 01:48:11 -0800 Subject: [PATCH] Start testing new tweetnacl rewrite in Account. --- src/lib/account.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 } -- 2.34.1