import { BURN_ADDRESS, PREAMBLE, THRESHOLD_RECEIVE, THRESHOLD_SEND } from './constants.js'
import { Account } from './account.js'
import { Blake2b } from './blake2b.js'
-import { bytes, dec, hex } from './convert.js'
+import { dec, hex } from './convert.js'
import { NanoNaCl } from './nano-nacl.js'
import { Pool } from './pool.js'
import { Rpc } from './rpc.js'
}
const account = await Account.fromPrivateKey(key)
try {
- const signature = NanoNaCl.sign(
+ const signature = NanoNaCl.detached(
hex.toBytes(await this.hash()),
hex.toBytes(`${account.privateKey}${account.publicKey}`)
)
- this.signature = bytes.toHex(signature.subarray(0, 64))
+ this.signature = signature
} catch (err) {
throw new Error(`Failed to sign block with key ${key}: ${err}`)
}
import { Account } from './account.js'
import { Blake2b } from './blake2b.js'
import { UNITS } from './constants.js'
-import { bytes, hex } from './convert.js'
+import { hex } from './convert.js'
import { Rpc } from './rpc.js'
import { Bip44Wallet, Blake2bWallet, LedgerWallet } from './wallet.js'
import { SendBlock } from './block.js'
export async function sign (key: string, ...input: string[]): Promise<string> {
const account = await Account.fromPrivateKey(key)
const data = hash(input)
- const signature = NanoNaCl.sign(
+ return NanoNaCl.detached(
hex.toBytes(data),
hex.toBytes(`${account.privateKey}${account.publicKey}`))
- return bytes.toHex(signature.subarray(0, 64))
}
/**