jose 5.9.1 → 5.9.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.
|
@@ -10,7 +10,7 @@ function isCloudflareWorkers() {
|
|
|
10
10
|
let USER_AGENT;
|
|
11
11
|
if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
|
|
12
12
|
const NAME = 'jose';
|
|
13
|
-
const VERSION = 'v5.9.
|
|
13
|
+
const VERSION = 'v5.9.2';
|
|
14
14
|
USER_AGENT = `${NAME}/${VERSION}`;
|
|
15
15
|
}
|
|
16
16
|
export const jwksCache = Symbol();
|
|
@@ -13,7 +13,7 @@ function isCloudflareWorkers() {
|
|
|
13
13
|
let USER_AGENT;
|
|
14
14
|
if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
|
|
15
15
|
const NAME = 'jose';
|
|
16
|
-
const VERSION = 'v5.9.
|
|
16
|
+
const VERSION = 'v5.9.2';
|
|
17
17
|
USER_AGENT = `${NAME}/${VERSION}`;
|
|
18
18
|
}
|
|
19
19
|
exports.jwksCache = Symbol();
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const node_crypto_1 = require("node:crypto");
|
|
4
|
-
const parse = (
|
|
5
|
-
|
|
4
|
+
const parse = (key) => {
|
|
5
|
+
if (key.d) {
|
|
6
|
+
return (0, node_crypto_1.createPrivateKey)({ format: 'jwk', key });
|
|
7
|
+
}
|
|
8
|
+
return (0, node_crypto_1.createPublicKey)({ format: 'jwk', key });
|
|
6
9
|
};
|
|
7
10
|
exports.default = parse;
|
|
@@ -10,7 +10,7 @@ function isCloudflareWorkers() {
|
|
|
10
10
|
let USER_AGENT;
|
|
11
11
|
if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
|
|
12
12
|
const NAME = 'jose';
|
|
13
|
-
const VERSION = 'v5.9.
|
|
13
|
+
const VERSION = 'v5.9.2';
|
|
14
14
|
USER_AGENT = `${NAME}/${VERSION}`;
|
|
15
15
|
}
|
|
16
16
|
export const jwksCache = Symbol();
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { createPrivateKey, createPublicKey } from 'node:crypto';
|
|
2
|
-
const parse = (
|
|
3
|
-
|
|
2
|
+
const parse = (key) => {
|
|
3
|
+
if (key.d) {
|
|
4
|
+
return createPrivateKey({ format: 'jwk', key });
|
|
5
|
+
}
|
|
6
|
+
return createPublicKey({ format: 'jwk', key });
|
|
4
7
|
};
|
|
5
8
|
export default parse;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -51,8 +51,6 @@ export interface JWKParameters {
|
|
|
51
51
|
x5u?: string
|
|
52
52
|
/** JWK "kid" (Key ID) Parameter. */
|
|
53
53
|
kid?: string
|
|
54
|
-
|
|
55
|
-
[propName: string]: unknown
|
|
56
54
|
}
|
|
57
55
|
|
|
58
56
|
/** Convenience interface for Public OKP JSON Web Keys */
|
|
@@ -61,16 +59,12 @@ export interface JWK_OKP_Public extends JWKParameters {
|
|
|
61
59
|
crv: string
|
|
62
60
|
/** The public key */
|
|
63
61
|
x: string
|
|
64
|
-
|
|
65
|
-
[propName: string]: unknown
|
|
66
62
|
}
|
|
67
63
|
|
|
68
64
|
/** Convenience interface for Private OKP JSON Web Keys */
|
|
69
65
|
export interface JWK_OKP_Private extends JWK_OKP_Public, JWKParameters {
|
|
70
66
|
/** The Private Key */
|
|
71
67
|
d: string
|
|
72
|
-
|
|
73
|
-
[propName: string]: unknown
|
|
74
68
|
}
|
|
75
69
|
|
|
76
70
|
/** Convenience interface for Public EC JSON Web Keys */
|
|
@@ -81,16 +75,12 @@ export interface JWK_EC_Public extends JWKParameters {
|
|
|
81
75
|
x: string
|
|
82
76
|
/** Y Coordinate */
|
|
83
77
|
y: string
|
|
84
|
-
|
|
85
|
-
[propName: string]: unknown
|
|
86
78
|
}
|
|
87
79
|
|
|
88
80
|
/** Convenience interface for Private EC JSON Web Keys */
|
|
89
81
|
export interface JWK_EC_Private extends JWK_EC_Public, JWKParameters {
|
|
90
82
|
/** ECC Private Key */
|
|
91
83
|
d: string
|
|
92
|
-
|
|
93
|
-
[propName: string]: unknown
|
|
94
84
|
}
|
|
95
85
|
|
|
96
86
|
/** Convenience interface for Public RSA JSON Web Keys */
|
|
@@ -99,8 +89,6 @@ export interface JWK_RSA_Public extends JWKParameters {
|
|
|
99
89
|
e: string
|
|
100
90
|
/** Modulus */
|
|
101
91
|
n: string
|
|
102
|
-
|
|
103
|
-
[propName: string]: unknown
|
|
104
92
|
}
|
|
105
93
|
|
|
106
94
|
/** Convenience interface for Private RSA JSON Web Keys */
|
|
@@ -123,16 +111,12 @@ export interface JWK_RSA_Private extends JWK_RSA_Public, JWKParameters {
|
|
|
123
111
|
q: string
|
|
124
112
|
/** First CRT Coefficient */
|
|
125
113
|
qi: string
|
|
126
|
-
|
|
127
|
-
[propName: string]: unknown
|
|
128
114
|
}
|
|
129
115
|
|
|
130
116
|
/** Convenience interface for oct JSON Web Keys */
|
|
131
117
|
export interface JWK_oct extends JWKParameters {
|
|
132
118
|
/** Key Value */
|
|
133
119
|
k: string
|
|
134
|
-
|
|
135
|
-
[propName: string]: unknown
|
|
136
120
|
}
|
|
137
121
|
|
|
138
122
|
/**
|
|
@@ -188,8 +172,6 @@ export interface JWK extends JWKParameters {
|
|
|
188
172
|
x?: string
|
|
189
173
|
/** (EC) Y Coordinate */
|
|
190
174
|
y?: string
|
|
191
|
-
|
|
192
|
-
[propName: string]: unknown
|
|
193
175
|
}
|
|
194
176
|
|
|
195
177
|
/**
|