How to use the @taquito/utils.prefix.edsig function in @taquito/utils

To help you get started, we’ve selected a few @taquito/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ecadlabs / taquito / packages / taquito-signer / src / ed-key.ts View on Github external
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,
    };
  }