static detached (message: Uint8Array<ArrayBuffer>, privateKey: Uint8Array<ArrayBuffer>): Uint8Array<ArrayBuffer>\r
static detached (message: unknown, privateKey: unknown): Uint8Array<ArrayBuffer> {\r
try {\r
- if (!(message instanceof Uint8Array)) {\r
- throw new TypeError('Message must be Uint8Array')\r
- }\r
- if (!(privateKey instanceof Uint8Array)) {\r
- throw new TypeError('Private key must be Uint8Array')\r
- }\r
- const m = new Uint8Array(message)\r
- const mLen = m.length\r
- const prv = new Uint8Array(privateKey)\r
- message = undefined\r
- privateKey = undefined\r
- const sm = new Uint8Array(this.crypto_sign_BYTES + mLen)\r
- const pub = this.convert(prv)\r
- this.crypto_sign(sm, m, mLen, prv, pub)\r
+ const sm = this.sign(message as Uint8Array<ArrayBuffer>, privateKey as Uint8Array<ArrayBuffer>)\r
return new Uint8Array(sm.buffer.slice(0, this.crypto_sign_BYTES))\r
} catch (err) {\r
throw new Error('Failed to sign and return signature', { cause: err })\r