unjwt 0.2.0 → 0.2.1
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 +2 -2
- package/dist/crypto/node.d.mts +5 -0
- package/dist/crypto/node.d.ts +5 -0
- package/dist/crypto/node.mjs +11 -0
- package/dist/crypto/web.d.mts +5 -0
- package/dist/crypto/web.d.ts +5 -0
- package/dist/crypto/web.mjs +10 -0
- package/dist/index.mjs +1 -1
- package/package.json +21 -4
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@ You may just use [Jose](https://github.com/panva/jose) or one of the other libra
|
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- 📦 Works in Node, browser and workers
|
|
10
|
-
- 💨 Zero dependencies
|
|
9
|
+
- 📦 Works in Node.js, browser and workers
|
|
10
|
+
- 💨 Zero dependencies
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import nodeCrypto from 'node:crypto';
|
|
2
|
+
|
|
3
|
+
const subtle = nodeCrypto.webcrypto?.subtle || {};
|
|
4
|
+
const randomUUID = () => {
|
|
5
|
+
return nodeCrypto.randomUUID();
|
|
6
|
+
};
|
|
7
|
+
const getRandomValues = (array) => {
|
|
8
|
+
return nodeCrypto.webcrypto.getRandomValues(array);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { getRandomValues, randomUUID, subtle };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const webCrypto = globalThis.crypto;
|
|
2
|
+
const subtle = webCrypto.subtle;
|
|
3
|
+
const randomUUID = () => {
|
|
4
|
+
return webCrypto.randomUUID();
|
|
5
|
+
};
|
|
6
|
+
const getRandomValues = (array) => {
|
|
7
|
+
return webCrypto.getRandomValues(array);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { getRandomValues, randomUUID, subtle };
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unjwt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"packageManager": "pnpm@8.6.12",
|
|
6
6
|
"description": "Easy creation and verification of JSON Web Tokens (JWT)",
|
|
7
7
|
"author": "Johann Schopplich <pkg@johannschopplich.com>",
|
|
@@ -26,6 +26,25 @@
|
|
|
26
26
|
".": {
|
|
27
27
|
"types": "./dist/index.d.ts",
|
|
28
28
|
"import": "./dist/index.mjs"
|
|
29
|
+
},
|
|
30
|
+
"./crypto": {
|
|
31
|
+
"browser": "./dist/crypto/web.mjs",
|
|
32
|
+
"bun": "./dist/crypto/web.mjs",
|
|
33
|
+
"deno": "./dist/crypto/web.mjs",
|
|
34
|
+
"edge-light": "./dist/crypto/web.mjs",
|
|
35
|
+
"edge-routine": "./dist/crypto/web.mjs",
|
|
36
|
+
"lagon": "./dist/crypto/web.mjs",
|
|
37
|
+
"netlify": "./dist/crypto/web.mjs",
|
|
38
|
+
"react-native": "./dist/crypto/web.mjs",
|
|
39
|
+
"wintercg": "./dist/crypto/web.mjs",
|
|
40
|
+
"worker": "./dist/crypto/web.mjs",
|
|
41
|
+
"workerd": "./dist/crypto/web.mjs",
|
|
42
|
+
"node": {
|
|
43
|
+
"types": "./dist/crypto/node.d.ts",
|
|
44
|
+
"import": "./dist/crypto/node.mjs"
|
|
45
|
+
},
|
|
46
|
+
"types": "./dist/crypto/web.d.ts",
|
|
47
|
+
"import": "./dist/crypto/web.mjs"
|
|
29
48
|
}
|
|
30
49
|
},
|
|
31
50
|
"types": "./dist/index.d.ts",
|
|
@@ -40,11 +59,9 @@
|
|
|
40
59
|
"release": "bumpp --commit --push --tag",
|
|
41
60
|
"test:types": "tsc --noEmit"
|
|
42
61
|
},
|
|
43
|
-
"dependencies": {
|
|
44
|
-
"uncrypto": "^0.1.3"
|
|
45
|
-
},
|
|
46
62
|
"devDependencies": {
|
|
47
63
|
"@antfu/eslint-config": "^0.40.2",
|
|
64
|
+
"@types/node": "^20.5.0",
|
|
48
65
|
"bumpp": "^9.1.1",
|
|
49
66
|
"eslint": "^8.47.0",
|
|
50
67
|
"typescript": "^5.1.6",
|