@florianjs/opaque 0.1.6 → 0.2.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.d.mts +2 -2
- package/dist/index.mjs +4 -4
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -39,8 +39,8 @@ interface SignRequestParams {
|
|
|
39
39
|
}
|
|
40
40
|
interface SignedHeaders {
|
|
41
41
|
signature: string;
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
'signature-input': string;
|
|
43
|
+
'signature-agent': string;
|
|
44
44
|
}
|
|
45
45
|
declare function signRequest(params: SignRequestParams): Promise<SignedHeaders>;
|
|
46
46
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -29,8 +29,8 @@ function base64ToBytes(b64) {
|
|
|
29
29
|
}
|
|
30
30
|
function parseJwkPrivateKey(jwkString) {
|
|
31
31
|
const jwk = JSON.parse(jwkString);
|
|
32
|
-
if (jwk.kty !== "OKP" || jwk.crv !== "Ed25519") throw new Error("opaque: invalid private key JWK
|
|
33
|
-
if (!jwk.d) throw new Error("opaque: invalid private key JWK
|
|
32
|
+
if (jwk.kty !== "OKP" || jwk.crv !== "Ed25519") throw new Error("opaque: invalid private key JWK - expected OKP Ed25519");
|
|
33
|
+
if (!jwk.d) throw new Error("opaque: invalid private key JWK - missing d parameter");
|
|
34
34
|
const b64 = jwk.d.replace(/-/g, "+").replace(/_/g, "/");
|
|
35
35
|
return base64ToBytes(b64 + "=".repeat((4 - b64.length % 4) % 4));
|
|
36
36
|
}
|
|
@@ -86,7 +86,7 @@ async function fetchSecrets(config) {
|
|
|
86
86
|
});
|
|
87
87
|
if (!res.ok) {
|
|
88
88
|
const body = await res.text();
|
|
89
|
-
throw new Error(`opaque: failed to fetch secrets (${res.status})
|
|
89
|
+
throw new Error(`opaque: failed to fetch secrets (${res.status}) - ${body}`);
|
|
90
90
|
}
|
|
91
91
|
return res.json();
|
|
92
92
|
}
|
|
@@ -123,7 +123,7 @@ async function rotateKey(config, adminToken) {
|
|
|
123
123
|
});
|
|
124
124
|
if (!res.ok) {
|
|
125
125
|
const body = await res.text();
|
|
126
|
-
throw new Error(`opaque: failed to rotate key (${res.status})
|
|
126
|
+
throw new Error(`opaque: failed to rotate key (${res.status}) - ${body}`);
|
|
127
127
|
}
|
|
128
128
|
return await res.json();
|
|
129
129
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@florianjs/opaque",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"types": "./dist/index.d.mts"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"pack": "vp pack"
|
|
16
|
-
},
|
|
17
14
|
"dependencies": {
|
|
18
15
|
"@noble/ed25519": "^2.2.3"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"pack": "vp pack"
|
|
19
19
|
}
|
|
20
|
-
}
|
|
20
|
+
}
|