]> git.codecow.com Git - libnemo.git/commitdiff
Use nano25519 directly in rolodex instead of calling out to Tools.
authorChris Duncan <chris@codecow.com>
Sun, 5 Jul 2026 19:44:50 +0000 (12:44 -0700)
committerChris Duncan <chris@codecow.com>
Sun, 5 Jul 2026 19:44:50 +0000 (12:44 -0700)
src/lib/rolodex.ts
src/lib/tools.ts

index 02dd42296297b90ac3de7e9424e95ad54b4cc1b5..40952dec08ec4169790d91ac21ff0b8ecfb0590d 100644 (file)
@@ -1,9 +1,9 @@
 //! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
 //! 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
                        }
                }
index b1df95f948532445fa6fa9fd50c8ff1d08c1a794..4470314a5432b1be72398b233d93766b85bf8a67 100644 (file)
@@ -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
  */