unjwt 0.5.4 → 0.5.5

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
- export { i as utils } from './shared/unjwt.X5vzu_l_.mjs';
2
- export { j as jwe } from './shared/unjwt.BQI798Cm.mjs';
3
- export { j as jwk } from './shared/unjwt.CdYPxnzf.mjs';
4
- export { j as jws } from './shared/unjwt.DGo0E5fc.mjs';
5
- import './shared/unjwt.2RUlMdtr.mjs';
1
+ export { i as utils } from './shared/unjwt.BHpknTpg.mjs';
2
+ export { j as jwe } from './shared/unjwt.B2olxeGL.mjs';
3
+ export { j as jwk } from './shared/unjwt.DRUXIabl.mjs';
4
+ export { j as jws } from './shared/unjwt.BY2vKT86.mjs';
5
+ import './shared/unjwt.Ca03jPX3.mjs';
package/dist/jwe.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import './shared/unjwt.CdYPxnzf.mjs';
2
- import './shared/unjwt.X5vzu_l_.mjs';
3
- export { d as decrypt, e as encrypt } from './shared/unjwt.BQI798Cm.mjs';
4
- import './shared/unjwt.2RUlMdtr.mjs';
1
+ import './shared/unjwt.DRUXIabl.mjs';
2
+ import './shared/unjwt.BHpknTpg.mjs';
3
+ export { d as decrypt, e as encrypt } from './shared/unjwt.B2olxeGL.mjs';
4
+ import './shared/unjwt.Ca03jPX3.mjs';
package/dist/jwk.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import './shared/unjwt.X5vzu_l_.mjs';
2
- export { p as deriveKeyFromPassword, t as exportJWKToPEM, q as exportKey, o as generateKey, g as getJWKFromSet, s as importJWKFromPEM, i as importKey, m as unwrapKey, r as wrapKey } from './shared/unjwt.CdYPxnzf.mjs';
1
+ import './shared/unjwt.BHpknTpg.mjs';
2
+ export { p as deriveKeyFromPassword, t as exportJWKToPEM, q as exportKey, o as generateKey, g as getJWKFromSet, s as importJWKFromPEM, i as importKey, m as unwrapKey, r as wrapKey } from './shared/unjwt.DRUXIabl.mjs';
package/dist/jws.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import './shared/unjwt.CdYPxnzf.mjs';
2
- import './shared/unjwt.X5vzu_l_.mjs';
3
- import './shared/unjwt.2RUlMdtr.mjs';
4
- export { s as sign, v as verify } from './shared/unjwt.DGo0E5fc.mjs';
1
+ import './shared/unjwt.DRUXIabl.mjs';
2
+ import './shared/unjwt.BHpknTpg.mjs';
3
+ import './shared/unjwt.Ca03jPX3.mjs';
4
+ export { s as sign, v as verify } from './shared/unjwt.BY2vKT86.mjs';
@@ -1,6 +1,6 @@
1
- import { a as checkEncCryptoKey, u as uint32be, b as generateCEK, e as encryptIV, w as wrap, k as keyToJWK, d as bitLengthCEK, f as jwkTokey, i as importKey, h as generateIV, l as encrypt$1, m as unwrapKey, n as decrypt$1 } from './unjwt.CdYPxnzf.mjs';
2
- import { f as concatUint8Arrays, t as textEncoder, g as assertCryptoKey, b as base64UrlEncode, h as isCryptoKey, a as isJWK, d as base64UrlDecode, r as randomBytes, c as textDecoder } from './unjwt.X5vzu_l_.mjs';
3
- import { c as checkKeyLength } from './unjwt.2RUlMdtr.mjs';
1
+ import { a as checkEncCryptoKey, u as uint32be, b as generateCEK, e as encryptIV, w as wrap, k as keyToJWK, d as bitLengthCEK, f as jwkTokey, i as importKey, h as generateIV, l as encrypt$1, m as unwrapKey, n as decrypt$1 } from './unjwt.DRUXIabl.mjs';
2
+ import { f as concatUint8Arrays, t as textEncoder, g as assertCryptoKey, b as base64UrlEncode, h as isCryptoKey, a as isJWK, d as base64UrlDecode, r as randomBytes, c as textDecoder } from './unjwt.BHpknTpg.mjs';
3
+ import { c as checkKeyLength } from './unjwt.Ca03jPX3.mjs';
4
4
 
5
5
  function lengthAndInput(input) {
6
6
  return concatUint8Arrays(uint32be(input.length), input);
@@ -19,10 +19,10 @@ function base64Decode(str, toString) {
19
19
  if (!str) {
20
20
  return decodeToString ? "" : new Uint8Array(0);
21
21
  }
22
- if (Uint8Array.fromBase64) {
23
- return Uint8Array.fromBase64(str);
24
- }
25
- const data = Uint8Array.from(atob(str), (b) => b.codePointAt(0));
22
+ const data = Uint8Array.fromBase64 ? (
23
+ // @ts-expect-error
24
+ Uint8Array.fromBase64(str)
25
+ ) : Uint8Array.from(atob(str), (b) => b.codePointAt(0));
26
26
  return decodeToString ? textDecoder.decode(data) : data;
27
27
  }
28
28
  function base64UrlDecode(str, toString) {
@@ -30,12 +30,14 @@ function base64UrlDecode(str, toString) {
30
30
  if (!str) {
31
31
  return decodeToString ? "" : new Uint8Array(0);
32
32
  }
33
+ let data;
33
34
  if (Uint8Array.fromBase64) {
34
- return Uint8Array.fromBase64(str, { alphabet: "base64url" });
35
+ data = Uint8Array.fromBase64(str, { alphabet: "base64url" });
36
+ } else {
37
+ str = str.replace(/-/g, "+").replace(/_/g, "/");
38
+ while (str.length % 4) str += "=";
39
+ data = Uint8Array.from(atob(str), (b) => b.codePointAt(0));
35
40
  }
36
- str = str.replace(/-/g, "+").replace(/_/g, "/");
37
- while (str.length % 4) str += "=";
38
- const data = Uint8Array.from(atob(str), (b) => b.codePointAt(0));
39
41
  return decodeToString ? textDecoder.decode(data) : data;
40
42
  }
41
43
  function randomBytes(length) {
@@ -1,6 +1,6 @@
1
- import { i as importKey, g as getJWKFromSet } from './unjwt.CdYPxnzf.mjs';
2
- import { a as isJWK, b as base64UrlEncode, t as textEncoder, c as textDecoder, d as base64UrlDecode, e as isJWKSet, m as maybeArray } from './unjwt.X5vzu_l_.mjs';
3
- import { s as sign$1, v as verify$1 } from './unjwt.2RUlMdtr.mjs';
1
+ import { i as importKey, g as getJWKFromSet } from './unjwt.DRUXIabl.mjs';
2
+ import { a as isJWK, b as base64UrlEncode, t as textEncoder, c as textDecoder, d as base64UrlDecode, e as isJWKSet, m as maybeArray } from './unjwt.BHpknTpg.mjs';
3
+ import { s as sign$1, v as verify$1 } from './unjwt.Ca03jPX3.mjs';
4
4
 
5
5
  async function sign(payload, key, options = {}) {
6
6
  const { protectedHeader: additionalProtectedHeader } = options;
@@ -1,4 +1,4 @@
1
- import { c as checkSigCryptoKey } from './unjwt.CdYPxnzf.mjs';
1
+ import { c as checkSigCryptoKey } from './unjwt.DRUXIabl.mjs';
2
2
 
3
3
  /**
4
4
  * This is a fork of Jose library's utility functions.
@@ -1,4 +1,4 @@
1
- import { h as isCryptoKey, f as concatUint8Arrays, b as base64UrlEncode, j as base64Decode, k as base64Encode, t as textEncoder, r as randomBytes, a as isJWK, d as base64UrlDecode, e as isJWKSet } from './unjwt.X5vzu_l_.mjs';
1
+ import { h as isCryptoKey, f as concatUint8Arrays, b as base64UrlEncode, j as base64Decode, k as base64Encode, t as textEncoder, r as randomBytes, a as isJWK, d as base64UrlDecode, e as isJWKSet } from './unjwt.BHpknTpg.mjs';
2
2
 
3
3
  /**
4
4
  * This is a fork of Jose library's utility functions.
package/dist/utils.mjs CHANGED
@@ -1 +1 @@
1
- export { g as assertCryptoKey, j as base64Decode, k as base64Encode, d as base64UrlDecode, b as base64UrlEncode, f as concatUint8Arrays, h as isCryptoKey, l as isCryptoKeyPair, a as isJWK, e as isJWKSet, m as maybeArray, r as randomBytes, c as textDecoder, t as textEncoder } from './shared/unjwt.X5vzu_l_.mjs';
1
+ export { g as assertCryptoKey, j as base64Decode, k as base64Encode, d as base64UrlDecode, b as base64UrlEncode, f as concatUint8Arrays, h as isCryptoKey, l as isCryptoKeyPair, a as isJWK, e as isJWKSet, m as maybeArray, r as randomBytes, c as textDecoder, t as textEncoder } from './shared/unjwt.BHpknTpg.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unjwt",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "Low-level JWT utilities",
5
5
  "repository": "sandros94/unjwt",
6
6
  "license": "MIT",