vestauth 0.1.29 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/lib/helpers/sign.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
const secp = require('@noble/secp256k1')
|
|
2
2
|
const hash = require('./hash')
|
|
3
|
+
const stripFormatting = require('./stripFormatting')
|
|
3
4
|
|
|
4
|
-
async function sign (challenge,
|
|
5
|
+
async function sign (challenge, privateKeyHexPossiblyFormatted) {
|
|
6
|
+
const privateKeyHex = stripFormatting(privateKeyHexPossiblyFormatted)
|
|
5
7
|
const hashChallenge = hash(challenge)
|
|
6
8
|
const privateKeyBytes = Buffer.from(privateKeyHex, 'hex')
|
|
7
9
|
const signature = await secp.sign(hashChallenge, privateKeyBytes)
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
const secp = require('@noble/secp256k1')
|
|
2
2
|
const hash = require('./hash')
|
|
3
|
+
const stripFormatting = require('./stripFormatting')
|
|
3
4
|
|
|
4
|
-
function verify (challenge, signatureBase64,
|
|
5
|
+
function verify (challenge, signatureBase64, publicKeyHexPossiblyFormatted) {
|
|
6
|
+
const publicKeyHex = stripFormatting(publicKeyHexPossiblyFormatted)
|
|
5
7
|
const hashChallenge = hash(challenge)
|
|
6
8
|
const signature = Buffer.from(signatureBase64, 'base64url')
|
|
7
9
|
const publicKeyBytes = Buffer.from(publicKeyHex, 'hex')
|