jose 4.3.3 → 4.3.7
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/browser/jws/compact/verify.js +1 -5
- package/dist/node/cjs/jws/compact/verify.js +1 -5
- package/dist/node/cjs/runtime/aeskw.js +1 -2
- package/dist/node/cjs/runtime/get_sign_verify_key.js +1 -2
- package/dist/node/cjs/runtime/node_key.js +2 -1
- package/dist/node/esm/jws/compact/verify.js +1 -5
- package/dist/node/esm/runtime/aeskw.js +2 -3
- package/dist/node/esm/runtime/get_sign_verify_key.js +2 -3
- package/dist/node/esm/runtime/node_key.js +2 -1
- package/dist/types/types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/node/cjs/runtime/secret_key.js +0 -14
- package/dist/node/esm/runtime/secret_key.js +0 -11
|
@@ -12,11 +12,7 @@ export async function compactVerify(jws, key, options) {
|
|
|
12
12
|
if (length !== 3) {
|
|
13
13
|
throw new JWSInvalid('Invalid Compact JWS');
|
|
14
14
|
}
|
|
15
|
-
const verified = await flattenedVerify({
|
|
16
|
-
payload: (payload || undefined),
|
|
17
|
-
protected: protectedHeader || undefined,
|
|
18
|
-
signature: (signature || undefined),
|
|
19
|
-
}, key, options);
|
|
15
|
+
const verified = await flattenedVerify({ payload, protected: protectedHeader, signature }, key, options);
|
|
20
16
|
const result = { payload: verified.payload, protectedHeader: verified.protectedHeader };
|
|
21
17
|
if (typeof key === 'function') {
|
|
22
18
|
return { ...result, key: verified.key };
|
|
@@ -15,11 +15,7 @@ async function compactVerify(jws, key, options) {
|
|
|
15
15
|
if (length !== 3) {
|
|
16
16
|
throw new errors_js_1.JWSInvalid('Invalid Compact JWS');
|
|
17
17
|
}
|
|
18
|
-
const verified = await (0, verify_js_1.flattenedVerify)({
|
|
19
|
-
payload: (payload || undefined),
|
|
20
|
-
protected: protectedHeader || undefined,
|
|
21
|
-
signature: (signature || undefined),
|
|
22
|
-
}, key, options);
|
|
18
|
+
const verified = await (0, verify_js_1.flattenedVerify)({ payload, protected: protectedHeader, signature }, key, options);
|
|
23
19
|
const result = { payload: verified.payload, protectedHeader: verified.protectedHeader };
|
|
24
20
|
if (typeof key === 'function') {
|
|
25
21
|
return { ...result, key: verified.key };
|
|
@@ -5,7 +5,6 @@ const buffer_1 = require("buffer");
|
|
|
5
5
|
const crypto_1 = require("crypto");
|
|
6
6
|
const errors_js_1 = require("../util/errors.js");
|
|
7
7
|
const buffer_utils_js_1 = require("../lib/buffer_utils.js");
|
|
8
|
-
const secret_key_js_1 = require("./secret_key.js");
|
|
9
8
|
const webcrypto_js_1 = require("./webcrypto.js");
|
|
10
9
|
const crypto_key_js_1 = require("../lib/crypto_key.js");
|
|
11
10
|
const is_key_object_js_1 = require("./is_key_object.js");
|
|
@@ -22,7 +21,7 @@ function ensureKeyObject(key, alg, usage) {
|
|
|
22
21
|
return key;
|
|
23
22
|
}
|
|
24
23
|
if (key instanceof Uint8Array) {
|
|
25
|
-
return (0,
|
|
24
|
+
return (0, crypto_1.createSecretKey)(key);
|
|
26
25
|
}
|
|
27
26
|
if ((0, webcrypto_js_1.isCryptoKey)(key)) {
|
|
28
27
|
(0, crypto_key_js_1.checkEncCryptoKey)(key, alg, usage);
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const crypto_1 = require("crypto");
|
|
4
4
|
const webcrypto_js_1 = require("./webcrypto.js");
|
|
5
5
|
const crypto_key_js_1 = require("../lib/crypto_key.js");
|
|
6
|
-
const secret_key_js_1 = require("./secret_key.js");
|
|
7
6
|
const invalid_key_input_js_1 = require("../lib/invalid_key_input.js");
|
|
8
7
|
const is_key_like_js_1 = require("./is_key_like.js");
|
|
9
8
|
function getSignVerifyKey(alg, key, usage) {
|
|
@@ -11,7 +10,7 @@ function getSignVerifyKey(alg, key, usage) {
|
|
|
11
10
|
if (!alg.startsWith('HS')) {
|
|
12
11
|
throw new TypeError((0, invalid_key_input_js_1.default)(key, ...is_key_like_js_1.types));
|
|
13
12
|
}
|
|
14
|
-
return (0,
|
|
13
|
+
return (0, crypto_1.createSecretKey)(key);
|
|
15
14
|
}
|
|
16
15
|
if (key instanceof crypto_1.KeyObject) {
|
|
17
16
|
return key;
|
|
@@ -8,7 +8,8 @@ const [major, minor] = process.version
|
|
|
8
8
|
.substr(1)
|
|
9
9
|
.split('.')
|
|
10
10
|
.map((str) => parseInt(str, 10));
|
|
11
|
-
const
|
|
11
|
+
const electron = 'electron' in process.versions;
|
|
12
|
+
const rsaPssParams = !electron && (major >= 17 || (major === 16 && minor >= 9));
|
|
12
13
|
const PSS = {
|
|
13
14
|
padding: crypto_1.constants.RSA_PKCS1_PSS_PADDING,
|
|
14
15
|
saltLength: crypto_1.constants.RSA_PSS_SALTLEN_DIGEST,
|
|
@@ -12,11 +12,7 @@ export async function compactVerify(jws, key, options) {
|
|
|
12
12
|
if (length !== 3) {
|
|
13
13
|
throw new JWSInvalid('Invalid Compact JWS');
|
|
14
14
|
}
|
|
15
|
-
const verified = await flattenedVerify({
|
|
16
|
-
payload: (payload || undefined),
|
|
17
|
-
protected: protectedHeader || undefined,
|
|
18
|
-
signature: (signature || undefined),
|
|
19
|
-
}, key, options);
|
|
15
|
+
const verified = await flattenedVerify({ payload, protected: protectedHeader, signature }, key, options);
|
|
20
16
|
const result = { payload: verified.payload, protectedHeader: verified.protectedHeader };
|
|
21
17
|
if (typeof key === 'function') {
|
|
22
18
|
return { ...result, key: verified.key };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Buffer } from 'buffer';
|
|
2
|
-
import { KeyObject, createDecipheriv, createCipheriv } from 'crypto';
|
|
2
|
+
import { KeyObject, createDecipheriv, createCipheriv, createSecretKey } from 'crypto';
|
|
3
3
|
import { JOSENotSupported } from '../util/errors.js';
|
|
4
4
|
import { concat } from '../lib/buffer_utils.js';
|
|
5
|
-
import getSecretKey from './secret_key.js';
|
|
6
5
|
import { isCryptoKey } from './webcrypto.js';
|
|
7
6
|
import { checkEncCryptoKey } from '../lib/crypto_key.js';
|
|
8
7
|
import isKeyObject from './is_key_object.js';
|
|
@@ -19,7 +18,7 @@ function ensureKeyObject(key, alg, usage) {
|
|
|
19
18
|
return key;
|
|
20
19
|
}
|
|
21
20
|
if (key instanceof Uint8Array) {
|
|
22
|
-
return
|
|
21
|
+
return createSecretKey(key);
|
|
23
22
|
}
|
|
24
23
|
if (isCryptoKey(key)) {
|
|
25
24
|
checkEncCryptoKey(key, alg, usage);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { KeyObject } from 'crypto';
|
|
1
|
+
import { KeyObject, createSecretKey } from 'crypto';
|
|
2
2
|
import { isCryptoKey } from './webcrypto.js';
|
|
3
3
|
import { checkSigCryptoKey } from '../lib/crypto_key.js';
|
|
4
|
-
import getSecretKey from './secret_key.js';
|
|
5
4
|
import invalidKeyInput from '../lib/invalid_key_input.js';
|
|
6
5
|
import { types } from './is_key_like.js';
|
|
7
6
|
export default function getSignVerifyKey(alg, key, usage) {
|
|
@@ -9,7 +8,7 @@ export default function getSignVerifyKey(alg, key, usage) {
|
|
|
9
8
|
if (!alg.startsWith('HS')) {
|
|
10
9
|
throw new TypeError(invalidKeyInput(key, ...types));
|
|
11
10
|
}
|
|
12
|
-
return
|
|
11
|
+
return createSecretKey(key);
|
|
13
12
|
}
|
|
14
13
|
if (key instanceof KeyObject) {
|
|
15
14
|
return key;
|
|
@@ -6,7 +6,8 @@ const [major, minor] = process.version
|
|
|
6
6
|
.substr(1)
|
|
7
7
|
.split('.')
|
|
8
8
|
.map((str) => parseInt(str, 10));
|
|
9
|
-
const
|
|
9
|
+
const electron = 'electron' in process.versions;
|
|
10
|
+
const rsaPssParams = !electron && (major >= 17 || (major === 16 && minor >= 9));
|
|
10
11
|
const PSS = {
|
|
11
12
|
padding: constants.RSA_PKCS1_PSS_PADDING,
|
|
12
13
|
saltLength: constants.RSA_PSS_SALTLEN_DIGEST,
|
package/dist/types/types.d.ts
CHANGED
|
@@ -262,7 +262,7 @@ export interface CompactJWSHeaderParameters extends JWSHeaderParameters {
|
|
|
262
262
|
alg: string
|
|
263
263
|
}
|
|
264
264
|
export interface JWTHeaderParameters extends CompactJWSHeaderParameters {
|
|
265
|
-
b64
|
|
265
|
+
b64?: true
|
|
266
266
|
}
|
|
267
267
|
export interface CompactJWEHeaderParameters extends JWEHeaderParameters {
|
|
268
268
|
alg: string
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const crypto_1 = require("crypto");
|
|
4
|
-
function getSecretKey(key) {
|
|
5
|
-
let keyObject;
|
|
6
|
-
if (key instanceof Uint8Array) {
|
|
7
|
-
keyObject = (0, crypto_1.createSecretKey)(key);
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
keyObject = key;
|
|
11
|
-
}
|
|
12
|
-
return keyObject;
|
|
13
|
-
}
|
|
14
|
-
exports.default = getSecretKey;
|