ECDSA
Getting Started
import { PrivateKey, Utils } from '@bsv/sdk'const privateKey = PrivateKey.fromRandom()
const message = Utils.toArray('Message to sign!')
// The .sign() method creates an ECDSA digital signature for the message from the private key.
const signature = privateKey.sign(message)
// Anyone with the corresponding public key can now verify the message.
const publicKey = privateKey.toPublicKey()
// The .verify() method is used for message verification
const valid = publicKey.verify(message, signature)
// console.log(valid) --> trueLast updated
