jose 6.1.0 → 6.1.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/README.md +3 -2
- package/dist/types/jwe/compact/encrypt.d.ts +4 -4
- package/dist/types/jwe/flattened/encrypt.d.ts +4 -4
- package/dist/types/jwe/general/encrypt.d.ts +9 -0
- package/dist/types/jwt/encrypt.d.ts +4 -4
- package/dist/types/types.d.ts +14 -5
- package/dist/webapi/jwe/flattened/decrypt.js +12 -12
- package/dist/webapi/jwe/flattened/encrypt.js +17 -13
- package/dist/webapi/jwe/general/decrypt.js +1 -1
- package/dist/webapi/jwe/general/encrypt.js +16 -16
- package/dist/webapi/jwk/embedded.js +1 -1
- package/dist/webapi/jwk/thumbprint.js +5 -5
- package/dist/webapi/jwks/local.js +1 -1
- package/dist/webapi/jwks/remote.js +2 -2
- package/dist/webapi/jws/flattened/sign.js +23 -17
- package/dist/webapi/jws/flattened/verify.js +13 -9
- package/dist/webapi/jws/general/verify.js +1 -1
- package/dist/webapi/key/export.js +1 -1
- package/dist/webapi/key/generate_key_pair.js +3 -3
- package/dist/webapi/key/import.js +5 -5
- package/dist/webapi/lib/aesgcmkw.js +4 -4
- package/dist/webapi/lib/asn1.js +3 -7
- package/dist/webapi/lib/buffer_utils.js +11 -0
- package/dist/webapi/lib/cek.js +2 -2
- package/dist/webapi/lib/check_cek_length.js +2 -2
- package/dist/webapi/lib/check_iv_length.js +2 -2
- package/dist/webapi/lib/check_key_length.js +2 -2
- package/dist/webapi/lib/check_key_type.js +13 -17
- package/dist/webapi/lib/crypto_key.js +2 -6
- package/dist/webapi/lib/decrypt.js +7 -7
- package/dist/webapi/lib/decrypt_key_management.js +4 -4
- package/dist/webapi/lib/digest.js +2 -2
- package/dist/webapi/lib/ecdhes.js +5 -5
- package/dist/webapi/lib/encrypt.js +8 -8
- package/dist/webapi/lib/encrypt_key_management.js +4 -4
- package/dist/webapi/lib/get_sign_verify_key.js +3 -3
- package/dist/webapi/lib/invalid_key_input.js +2 -6
- package/dist/webapi/lib/is_disjoint.js +2 -2
- package/dist/webapi/lib/is_jwk.js +6 -14
- package/dist/webapi/lib/is_key_like.js +11 -8
- package/dist/webapi/lib/is_object.js +3 -5
- package/dist/webapi/lib/iv.js +1 -1
- package/dist/webapi/lib/jwk_to_key.js +2 -2
- package/dist/webapi/lib/jwt_claims_set.js +59 -6
- package/dist/webapi/lib/key_to_jwk.js +2 -2
- package/dist/webapi/lib/normalize_key.js +4 -4
- package/dist/webapi/lib/pbes2kw.js +5 -3
- package/dist/webapi/lib/rsaes.js +1 -1
- package/dist/webapi/lib/sign.js +6 -6
- package/dist/webapi/lib/subtle_dsa.js +2 -2
- package/dist/webapi/lib/validate_algorithms.js +2 -2
- package/dist/webapi/lib/validate_crit.js +2 -2
- package/dist/webapi/lib/verify.js +6 -6
- package/dist/webapi/util/base64url.js +1 -1
- package/dist/webapi/util/decode_jwt.js +1 -1
- package/dist/webapi/util/decode_protected_header.js +1 -1
- package/package.json +1 -1
- package/dist/webapi/lib/epoch.js +0 -1
- package/dist/webapi/lib/secs.js +0 -55
|
@@ -10,7 +10,7 @@ export function decode(input) {
|
|
|
10
10
|
if (encoded instanceof Uint8Array) {
|
|
11
11
|
encoded = decoder.decode(encoded);
|
|
12
12
|
}
|
|
13
|
-
encoded = encoded.replace(/-/g, '+').replace(/_/g, '/')
|
|
13
|
+
encoded = encoded.replace(/-/g, '+').replace(/_/g, '/');
|
|
14
14
|
try {
|
|
15
15
|
return decodeBase64(encoded);
|
|
16
16
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { decode as b64u } from './base64url.js';
|
|
2
2
|
import { decoder } from '../lib/buffer_utils.js';
|
|
3
|
-
import isObject from '../lib/is_object.js';
|
|
3
|
+
import { isObject } from '../lib/is_object.js';
|
|
4
4
|
import { JWTInvalid } from './errors.js';
|
|
5
5
|
export function decodeJwt(jwt) {
|
|
6
6
|
if (typeof jwt !== 'string')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { decode as b64u } from './base64url.js';
|
|
2
2
|
import { decoder } from '../lib/buffer_utils.js';
|
|
3
|
-
import isObject from '../lib/is_object.js';
|
|
3
|
+
import { isObject } from '../lib/is_object.js';
|
|
4
4
|
export function decodeProtectedHeader(token) {
|
|
5
5
|
let protectedB64u;
|
|
6
6
|
if (typeof token === 'string') {
|
package/package.json
CHANGED
package/dist/webapi/lib/epoch.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default (date) => Math.floor(date.getTime() / 1000);
|
package/dist/webapi/lib/secs.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
const minute = 60;
|
|
2
|
-
const hour = minute * 60;
|
|
3
|
-
const day = hour * 24;
|
|
4
|
-
const week = day * 7;
|
|
5
|
-
const year = day * 365.25;
|
|
6
|
-
const REGEX = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;
|
|
7
|
-
export default (str) => {
|
|
8
|
-
const matched = REGEX.exec(str);
|
|
9
|
-
if (!matched || (matched[4] && matched[1])) {
|
|
10
|
-
throw new TypeError('Invalid time period format');
|
|
11
|
-
}
|
|
12
|
-
const value = parseFloat(matched[2]);
|
|
13
|
-
const unit = matched[3].toLowerCase();
|
|
14
|
-
let numericDate;
|
|
15
|
-
switch (unit) {
|
|
16
|
-
case 'sec':
|
|
17
|
-
case 'secs':
|
|
18
|
-
case 'second':
|
|
19
|
-
case 'seconds':
|
|
20
|
-
case 's':
|
|
21
|
-
numericDate = Math.round(value);
|
|
22
|
-
break;
|
|
23
|
-
case 'minute':
|
|
24
|
-
case 'minutes':
|
|
25
|
-
case 'min':
|
|
26
|
-
case 'mins':
|
|
27
|
-
case 'm':
|
|
28
|
-
numericDate = Math.round(value * minute);
|
|
29
|
-
break;
|
|
30
|
-
case 'hour':
|
|
31
|
-
case 'hours':
|
|
32
|
-
case 'hr':
|
|
33
|
-
case 'hrs':
|
|
34
|
-
case 'h':
|
|
35
|
-
numericDate = Math.round(value * hour);
|
|
36
|
-
break;
|
|
37
|
-
case 'day':
|
|
38
|
-
case 'days':
|
|
39
|
-
case 'd':
|
|
40
|
-
numericDate = Math.round(value * day);
|
|
41
|
-
break;
|
|
42
|
-
case 'week':
|
|
43
|
-
case 'weeks':
|
|
44
|
-
case 'w':
|
|
45
|
-
numericDate = Math.round(value * week);
|
|
46
|
-
break;
|
|
47
|
-
default:
|
|
48
|
-
numericDate = Math.round(value * year);
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
if (matched[1] === '-' || matched[4] === 'ago') {
|
|
52
|
-
return -numericDate;
|
|
53
|
-
}
|
|
54
|
-
return numericDate;
|
|
55
|
-
};
|