Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async sign(bytes: string, bytesHash: Uint8Array) {
await this.isInit;
const signature = sodium.crypto_sign_detached(
new Uint8Array(bytesHash),
new Uint8Array(this._key)
);
const signatureBuffer = toBuffer(signature);
const sbytes = bytes + buf2hex(signatureBuffer);
return {
bytes,
sig: b58cencode(signature, prefix.sig),
prefixSig: b58cencode(signature, prefix.edsig),
sbytes,
};
}