@sd-jwt/crypto-nodejs 0.9.2-next.0 → 0.9.2-next.2
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/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +2 -2
- package/src/crypto.ts +3 -3
package/dist/index.js
CHANGED
|
@@ -56,7 +56,7 @@ var generateSalt = (length) => {
|
|
|
56
56
|
const salt = saltBytes.toString("hex");
|
|
57
57
|
return salt.substring(0, length);
|
|
58
58
|
};
|
|
59
|
-
var digest = (data, algorithm = "
|
|
59
|
+
var digest = (data, algorithm = "sha-256") => {
|
|
60
60
|
const nodeAlg = toNodeCryptoAlg(algorithm);
|
|
61
61
|
const hash = (0, import_node_crypto.createHash)(nodeAlg);
|
|
62
62
|
if (typeof data === "string") {
|
|
@@ -107,7 +107,7 @@ var ES256 = {
|
|
|
107
107
|
const signature = yield import_node_crypto.subtle.sign(
|
|
108
108
|
{
|
|
109
109
|
name: "ECDSA",
|
|
110
|
-
hash: { name: "
|
|
110
|
+
hash: { name: "sha-256" }
|
|
111
111
|
// Required for ES256
|
|
112
112
|
},
|
|
113
113
|
privateKey,
|
|
@@ -140,7 +140,7 @@ var ES256 = {
|
|
|
140
140
|
const isValid = yield import_node_crypto.subtle.verify(
|
|
141
141
|
{
|
|
142
142
|
name: "ECDSA",
|
|
143
|
-
hash: { name: "
|
|
143
|
+
hash: { name: "sha-256" }
|
|
144
144
|
// Required for ES256
|
|
145
145
|
},
|
|
146
146
|
publicKey,
|
package/dist/index.mjs
CHANGED
|
@@ -29,7 +29,7 @@ var generateSalt = (length) => {
|
|
|
29
29
|
const salt = saltBytes.toString("hex");
|
|
30
30
|
return salt.substring(0, length);
|
|
31
31
|
};
|
|
32
|
-
var digest = (data, algorithm = "
|
|
32
|
+
var digest = (data, algorithm = "sha-256") => {
|
|
33
33
|
const nodeAlg = toNodeCryptoAlg(algorithm);
|
|
34
34
|
const hash = createHash(nodeAlg);
|
|
35
35
|
if (typeof data === "string") {
|
|
@@ -80,7 +80,7 @@ var ES256 = {
|
|
|
80
80
|
const signature = yield subtle.sign(
|
|
81
81
|
{
|
|
82
82
|
name: "ECDSA",
|
|
83
|
-
hash: { name: "
|
|
83
|
+
hash: { name: "sha-256" }
|
|
84
84
|
// Required for ES256
|
|
85
85
|
},
|
|
86
86
|
privateKey,
|
|
@@ -113,7 +113,7 @@ var ES256 = {
|
|
|
113
113
|
const isValid = yield subtle.verify(
|
|
114
114
|
{
|
|
115
115
|
name: "ECDSA",
|
|
116
|
-
hash: { name: "
|
|
116
|
+
hash: { name: "sha-256" }
|
|
117
117
|
// Required for ES256
|
|
118
118
|
},
|
|
119
119
|
publicKey,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sd-jwt/crypto-nodejs",
|
|
3
|
-
"version": "0.9.2-next.
|
|
3
|
+
"version": "0.9.2-next.2+3c85e8e",
|
|
4
4
|
"description": "sd-jwt draft 7 implementation in typescript",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"esm"
|
|
53
53
|
]
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "3c85e8e283fa53e871a14c321b3a04fc4380b875"
|
|
56
56
|
}
|
package/src/crypto.ts
CHANGED
|
@@ -11,7 +11,7 @@ export const generateSalt = (length: number): string => {
|
|
|
11
11
|
|
|
12
12
|
export const digest = (
|
|
13
13
|
data: string | ArrayBuffer,
|
|
14
|
-
algorithm = '
|
|
14
|
+
algorithm = 'sha-256',
|
|
15
15
|
): Uint8Array => {
|
|
16
16
|
const nodeAlg = toNodeCryptoAlg(algorithm);
|
|
17
17
|
const hash = createHash(nodeAlg);
|
|
@@ -64,7 +64,7 @@ export const ES256 = {
|
|
|
64
64
|
const signature = await subtle.sign(
|
|
65
65
|
{
|
|
66
66
|
name: 'ECDSA',
|
|
67
|
-
hash: { name: '
|
|
67
|
+
hash: { name: 'sha-256' }, // Required for ES256
|
|
68
68
|
},
|
|
69
69
|
privateKey,
|
|
70
70
|
encoder.encode(data),
|
|
@@ -98,7 +98,7 @@ export const ES256 = {
|
|
|
98
98
|
const isValid = await subtle.verify(
|
|
99
99
|
{
|
|
100
100
|
name: 'ECDSA',
|
|
101
|
-
hash: { name: '
|
|
101
|
+
hash: { name: 'sha-256' }, // Required for ES256
|
|
102
102
|
},
|
|
103
103
|
publicKey,
|
|
104
104
|
signature,
|