return signedMsg\r
}\r
\r
- const open = function (signedMsg: Uint8Array, publicKey: Uint8Array): Uint8Array | null {\r
+ const open = function (signedMsg: Uint8Array, publicKey: Uint8Array): Uint8Array {\r
checkArrayTypes(signedMsg, publicKey)\r
if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)\r
throw new Error('bad public key size')\r
const tmp = new Uint8Array(signedMsg.length)\r
var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey)\r
\r
- if (mlen < 0) return null\r
+ if (mlen < 0) return new Uint8Array(0)\r
\r
var m = new Uint8Array(mlen)\r
for (var i = 0; i < m.length; i++) m[i] = tmp[i]\r
return m\r
}\r
\r
- const detached = function (msg: Uint8Array, secretKey: Uint8Array): Uint8Array {\r
+ const detached = function (msg: Uint8Array, secretKey: Uint8Array): string {\r
var signedMsg = sign(msg, secretKey)\r
var sig = new Uint8Array(crypto_sign_BYTES)\r
for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i]\r
- return sig\r
+ return hexify(sig).toUpperCase()\r
}\r
\r
const verify = function (msg: Uint8Array, sig: Uint8Array, publicKey: Uint8Array): boolean {\r