@sd-jwt/crypto-browser 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 +4 -4
- package/dist/index.mjs +4 -4
- package/package.json +2 -2
- package/src/crypto.ts +4 -4
package/dist/index.js
CHANGED
|
@@ -60,7 +60,7 @@ var generateSalt = (length) => {
|
|
|
60
60
|
).join("");
|
|
61
61
|
return salt;
|
|
62
62
|
};
|
|
63
|
-
function digest(data, algorithm = "
|
|
63
|
+
function digest(data, algorithm = "sha-256") {
|
|
64
64
|
return __async(this, null, function* () {
|
|
65
65
|
const ec = new TextEncoder();
|
|
66
66
|
const digest2 = yield window.crypto.subtle.digest(
|
|
@@ -70,7 +70,7 @@ function digest(data, algorithm = "SHA-256") {
|
|
|
70
70
|
return new Uint8Array(digest2);
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
var getHasher = (algorithm = "
|
|
73
|
+
var getHasher = (algorithm = "sha-256") => {
|
|
74
74
|
return (data) => digest(data, algorithm);
|
|
75
75
|
};
|
|
76
76
|
var ES256 = {
|
|
@@ -118,7 +118,7 @@ var ES256 = {
|
|
|
118
118
|
const signature = yield window.crypto.subtle.sign(
|
|
119
119
|
{
|
|
120
120
|
name: "ECDSA",
|
|
121
|
-
hash: { name: "
|
|
121
|
+
hash: { name: "sha-256" }
|
|
122
122
|
// Required for ES256
|
|
123
123
|
},
|
|
124
124
|
privateKey,
|
|
@@ -151,7 +151,7 @@ var ES256 = {
|
|
|
151
151
|
const isValid = yield window.crypto.subtle.verify(
|
|
152
152
|
{
|
|
153
153
|
name: "ECDSA",
|
|
154
|
-
hash: { name: "
|
|
154
|
+
hash: { name: "sha-256" }
|
|
155
155
|
// Required for ES256
|
|
156
156
|
},
|
|
157
157
|
publicKey,
|
package/dist/index.mjs
CHANGED
|
@@ -32,7 +32,7 @@ var generateSalt = (length) => {
|
|
|
32
32
|
).join("");
|
|
33
33
|
return salt;
|
|
34
34
|
};
|
|
35
|
-
function digest(data, algorithm = "
|
|
35
|
+
function digest(data, algorithm = "sha-256") {
|
|
36
36
|
return __async(this, null, function* () {
|
|
37
37
|
const ec = new TextEncoder();
|
|
38
38
|
const digest2 = yield window.crypto.subtle.digest(
|
|
@@ -42,7 +42,7 @@ function digest(data, algorithm = "SHA-256") {
|
|
|
42
42
|
return new Uint8Array(digest2);
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
var getHasher = (algorithm = "
|
|
45
|
+
var getHasher = (algorithm = "sha-256") => {
|
|
46
46
|
return (data) => digest(data, algorithm);
|
|
47
47
|
};
|
|
48
48
|
var ES256 = {
|
|
@@ -90,7 +90,7 @@ var ES256 = {
|
|
|
90
90
|
const signature = yield window.crypto.subtle.sign(
|
|
91
91
|
{
|
|
92
92
|
name: "ECDSA",
|
|
93
|
-
hash: { name: "
|
|
93
|
+
hash: { name: "sha-256" }
|
|
94
94
|
// Required for ES256
|
|
95
95
|
},
|
|
96
96
|
privateKey,
|
|
@@ -123,7 +123,7 @@ var ES256 = {
|
|
|
123
123
|
const isValid = yield window.crypto.subtle.verify(
|
|
124
124
|
{
|
|
125
125
|
name: "ECDSA",
|
|
126
|
-
hash: { name: "
|
|
126
|
+
hash: { name: "sha-256" }
|
|
127
127
|
// Required for ES256
|
|
128
128
|
},
|
|
129
129
|
publicKey,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sd-jwt/crypto-browser",
|
|
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",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"esm"
|
|
50
50
|
]
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "3c85e8e283fa53e871a14c321b3a04fc4380b875"
|
|
53
53
|
}
|
package/src/crypto.ts
CHANGED
|
@@ -15,7 +15,7 @@ export const generateSalt = (length: number): string => {
|
|
|
15
15
|
|
|
16
16
|
export async function digest(
|
|
17
17
|
data: string | ArrayBuffer,
|
|
18
|
-
algorithm = '
|
|
18
|
+
algorithm = 'sha-256',
|
|
19
19
|
): Promise<Uint8Array> {
|
|
20
20
|
const ec = new TextEncoder();
|
|
21
21
|
const digest = await window.crypto.subtle.digest(
|
|
@@ -25,7 +25,7 @@ export async function digest(
|
|
|
25
25
|
return new Uint8Array(digest);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export const getHasher = (algorithm = '
|
|
28
|
+
export const getHasher = (algorithm = 'sha-256') => {
|
|
29
29
|
return (data: string) => digest(data, algorithm);
|
|
30
30
|
};
|
|
31
31
|
|
|
@@ -72,7 +72,7 @@ export const ES256 = {
|
|
|
72
72
|
const signature = await window.crypto.subtle.sign(
|
|
73
73
|
{
|
|
74
74
|
name: 'ECDSA',
|
|
75
|
-
hash: { name: '
|
|
75
|
+
hash: { name: 'sha-256' }, // Required for ES256
|
|
76
76
|
},
|
|
77
77
|
privateKey,
|
|
78
78
|
encoder.encode(data),
|
|
@@ -107,7 +107,7 @@ export const ES256 = {
|
|
|
107
107
|
const isValid = await window.crypto.subtle.verify(
|
|
108
108
|
{
|
|
109
109
|
name: 'ECDSA',
|
|
110
|
-
hash: { name: '
|
|
110
|
+
hash: { name: 'sha-256' }, // Required for ES256
|
|
111
111
|
},
|
|
112
112
|
publicKey,
|
|
113
113
|
signature,
|