vestauth 0.1.8 → 0.1.9
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 +1 -1
- package/src/lib/helpers/sign.js +5 -4
package/package.json
CHANGED
package/src/lib/helpers/sign.js
CHANGED
|
@@ -6,9 +6,6 @@ secp.hashes.sha256 = sha256
|
|
|
6
6
|
secp.hashes.hmacSha256 = (key, msg) => hmac(sha256, key, msg)
|
|
7
7
|
const hash = require('./hash')
|
|
8
8
|
|
|
9
|
-
// // privateKey: 32-byte Uint8Array (or hex depending on your setup)
|
|
10
|
-
// const signature = await sign(hash, privateKey, { der: false })
|
|
11
|
-
//
|
|
12
9
|
// // publicKey (compressed): Uint8Array
|
|
13
10
|
// const publicKey = getPublicKey(privateKey, true)
|
|
14
11
|
//
|
|
@@ -16,7 +13,11 @@ const hash = require('./hash')
|
|
|
16
13
|
// const ok = verify(signature, hash, publicKey)
|
|
17
14
|
|
|
18
15
|
function sign (message, privateKey) {
|
|
19
|
-
|
|
16
|
+
const hashMessage = hash(message)
|
|
17
|
+
const hashPrivateKey = hash(privateKey)
|
|
18
|
+
const signature = secp.sign(hashMessage, hashPrivateKey)
|
|
19
|
+
|
|
20
|
+
return Buffer.from(signature).toString('base64url') // base64 returned
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
module.exports = sign
|