From 372cbf31b9e79432a2b4984c698fd5d415f6e86c Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Sun, 5 Jul 2026 12:44:50 -0700 Subject: [PATCH] Use nano25519 directly in rolodex instead of calling out to Tools. --- src/lib/rolodex.ts | 5 ++--- src/lib/tools.ts | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib/rolodex.ts b/src/lib/rolodex.ts index 02dd422..40952de 100644 --- a/src/lib/rolodex.ts +++ b/src/lib/rolodex.ts @@ -1,9 +1,9 @@ //! SPDX-FileCopyrightText: 2025 Chris Duncan //! SPDX-License-Identifier: GPL-3.0-or-later +import { verify as nano25519_verify } from 'nano25519' import { Account } from './account' import { Database } from './database' -import * as Tools from './tools' /** * Represents a basic address book of Nano accounts. Multiple addresses can be @@ -186,8 +186,7 @@ export class Rolodex { const addresses = await this.getAddresses(name) for (const address of addresses) { const { publicKey } = new Account(address) - const verified = await Tools.verify(publicKey, signature, data) - if (verified) { + if (nano25519_verify(publicKey, signature, data)) { return true } } diff --git a/src/lib/tools.ts b/src/lib/tools.ts index b1df95f..4470314 100644 --- a/src/lib/tools.ts +++ b/src/lib/tools.ts @@ -207,8 +207,8 @@ export async function sweep ( /** * Verifies the signature of an arbitrary string using a public key. * - * @param {(string|ArrayBuffer|Bytes)} publicKey - 32-byte hexadecimal public key - * @param {(string|ArrayBuffer|Bytes)} signature - 128-character hexadcimal signature + * @param {(string|ArrayBuffer|Bytes)} publicKey - 32-byte buffer or 64-character hexadecimal + * @param {(string|ArrayBuffer|Bytes)} signature - 64-byte buffer or 128-character hexadcimal * @param {string} input - Data to be verified * @returns {boolean} True if the data was signed by the public key's matching private key */ -- 2.52.0