//! 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
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
}
}
/**
* 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
*/