@cryptoeconomicslab/signature
Advanced tools
Comparing version 0.0.35 to 0.0.36
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const bs58check_1 = tslib_1.__importDefault(require("bs58check")); | ||
const tweetnacl_1 = tslib_1.__importDefault(require("tweetnacl")); | ||
exports.ed25519Verifier = { | ||
verify: async (message, signature, publicKey) => { | ||
const sig = Buffer.from(signature.toHexString().slice(2), 'hex'); | ||
const msg = Buffer.from(message.toHexString()); | ||
const pk = bs58check_1.default.decode(publicKey.intoString()).slice(4); | ||
const publicKeyHeaderAndBody = publicKey.split(1); | ||
const [sig, msg, pk] = [ | ||
signature, | ||
message, | ||
publicKeyHeaderAndBody[1] | ||
].map(b => Buffer.from(b.toHexString().substr(2), 'hex')); | ||
return tweetnacl_1.default.sign.detached.verify(msg, sig, pk); | ||
@@ -12,0 +14,0 @@ } |
{ | ||
"name": "@cryptoeconomicslab/signature", | ||
"version": "0.0.35", | ||
"version": "0.0.36", | ||
"description": "signatures and verifiers", | ||
@@ -32,3 +32,2 @@ "author": { | ||
"dependencies": { | ||
"bs58check": "^2.1.2", | ||
"ethers": "^4.0.43", | ||
@@ -38,3 +37,3 @@ "tweetnacl": "^1.0.3" | ||
"devDependencies": { | ||
"@cryptoeconomicslab/primitives": "^0.0.35", | ||
"@cryptoeconomicslab/primitives": "^0.0.36", | ||
"@types/libsodium-wrappers-sumo": "^0.7.3" | ||
@@ -45,3 +44,3 @@ }, | ||
}, | ||
"gitHead": "7ff03bfccb9535c21068bd3ad45d0ea982c80553" | ||
"gitHead": "3cf96a9462b6ff0bdf64995dbbbbdee7a6a1f48d" | ||
} |
Sorry, the diff of this file is not supported yet
3
110
20321
- Removedbs58check@^2.1.2
- Removedbase-x@3.0.10(transitive)
- Removedbs58@4.0.1(transitive)
- Removedbs58check@2.1.2(transitive)
- Removedcipher-base@1.0.6(transitive)
- Removedcreate-hash@1.2.0(transitive)
- Removedhash-base@3.1.0(transitive)
- Removedmd5.js@1.3.5(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedripemd160@2.0.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsha.js@2.4.11(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)