@twin.org/web 0.0.1-next.9 → 0.0.2-next.3
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/cjs/index.cjs +298 -94
- package/dist/esm/index.mjs +299 -96
- package/dist/types/index.d.ts +3 -1
- package/dist/types/models/IJwk.d.ts +2 -58
- package/dist/types/models/IJwtHeader.d.ts +2 -18
- package/dist/types/models/IJwtPayload.d.ts +2 -33
- package/dist/types/models/jwkCryptoKey.d.ts +4 -0
- package/dist/types/models/mimeTypes.d.ts +8 -0
- package/dist/types/utils/fetchHelper.d.ts +7 -0
- package/dist/types/utils/jwk.d.ts +41 -0
- package/dist/types/utils/jws.d.ts +22 -0
- package/dist/types/utils/jwt.d.ts +67 -29
- package/docs/changelog.md +480 -1
- package/docs/reference/classes/FetchError.md +16 -8
- package/docs/reference/classes/FetchHelper.md +104 -28
- package/docs/reference/classes/Jwk.md +129 -0
- package/docs/reference/classes/Jws.md +81 -0
- package/docs/reference/classes/Jwt.md +261 -105
- package/docs/reference/classes/MimeTypeHelper.md +9 -5
- package/docs/reference/index.md +3 -2
- package/docs/reference/interfaces/IHttpHeaders.md +1 -1
- package/docs/reference/interfaces/IJwk.md +2 -106
- package/docs/reference/interfaces/IJwtHeader.md +5 -23
- package/docs/reference/interfaces/IJwtPayload.md +5 -55
- package/docs/reference/type-aliases/HeaderTypes.md +1 -1
- package/docs/reference/type-aliases/HttpMethod.md +1 -1
- package/docs/reference/type-aliases/HttpStatusCode.md +1 -1
- package/docs/reference/type-aliases/JwkCryptoKey.md +5 -0
- package/docs/reference/type-aliases/MimeTypes.md +1 -1
- package/docs/reference/variables/MimeTypes.md +12 -0
- package/locales/en.json +11 -1
- package/package.json +7 -6
- package/dist/types/models/jwtAlgorithms.d.ts +0 -17
- package/docs/reference/type-aliases/JwtAlgorithms.md +0 -5
- package/docs/reference/variables/JwtAlgorithms.md +0 -19
|
@@ -2,110 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
The fields in a JSON Web Key.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Extends
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Properties
|
|
10
|
-
|
|
11
|
-
### alg?
|
|
12
|
-
|
|
13
|
-
> `optional` **alg**: [`JwtAlgorithms`](../type-aliases/JwtAlgorithms.md)
|
|
14
|
-
|
|
15
|
-
The cryptographic algorithm for the key.
|
|
16
|
-
|
|
17
|
-
***
|
|
18
|
-
|
|
19
|
-
### use?
|
|
20
|
-
|
|
21
|
-
> `optional` **use**: `string`
|
|
22
|
-
|
|
23
|
-
The intended use for the key.
|
|
24
|
-
|
|
25
|
-
***
|
|
26
|
-
|
|
27
|
-
### key\_ops?
|
|
28
|
-
|
|
29
|
-
> `optional` **key\_ops**: `string`[]
|
|
30
|
-
|
|
31
|
-
The operation(s) that the key is intended to be used for.
|
|
32
|
-
|
|
33
|
-
***
|
|
34
|
-
|
|
35
|
-
### kty
|
|
36
|
-
|
|
37
|
-
> **kty**: `string`
|
|
38
|
-
|
|
39
|
-
The key type parameter.
|
|
40
|
-
|
|
41
|
-
***
|
|
42
|
-
|
|
43
|
-
### n?
|
|
44
|
-
|
|
45
|
-
> `optional` **n**: `string`
|
|
46
|
-
|
|
47
|
-
The public key parameters.
|
|
48
|
-
|
|
49
|
-
***
|
|
50
|
-
|
|
51
|
-
### e?
|
|
52
|
-
|
|
53
|
-
> `optional` **e**: `string`
|
|
54
|
-
|
|
55
|
-
Exponent parameter.
|
|
56
|
-
|
|
57
|
-
***
|
|
58
|
-
|
|
59
|
-
### d?
|
|
60
|
-
|
|
61
|
-
> `optional` **d**: `string`
|
|
62
|
-
|
|
63
|
-
The private key parameters.
|
|
64
|
-
|
|
65
|
-
***
|
|
66
|
-
|
|
67
|
-
### p?
|
|
68
|
-
|
|
69
|
-
> `optional` **p**: `string`
|
|
70
|
-
|
|
71
|
-
The private key parameters.
|
|
72
|
-
|
|
73
|
-
***
|
|
74
|
-
|
|
75
|
-
### q?
|
|
76
|
-
|
|
77
|
-
> `optional` **q**: `string`
|
|
78
|
-
|
|
79
|
-
The private key parameters.
|
|
80
|
-
|
|
81
|
-
***
|
|
82
|
-
|
|
83
|
-
### dp?
|
|
84
|
-
|
|
85
|
-
> `optional` **dp**: `string`
|
|
86
|
-
|
|
87
|
-
The private key parameters.
|
|
88
|
-
|
|
89
|
-
***
|
|
90
|
-
|
|
91
|
-
### dq?
|
|
92
|
-
|
|
93
|
-
> `optional` **dq**: `string`
|
|
94
|
-
|
|
95
|
-
The private key parameters.
|
|
96
|
-
|
|
97
|
-
***
|
|
98
|
-
|
|
99
|
-
### qi?
|
|
100
|
-
|
|
101
|
-
> `optional` **qi**: `string`
|
|
102
|
-
|
|
103
|
-
The private key parameters.
|
|
104
|
-
|
|
105
|
-
***
|
|
106
|
-
|
|
107
|
-
### kid?
|
|
108
|
-
|
|
109
|
-
> `optional` **kid**: `string`
|
|
110
|
-
|
|
111
|
-
The key ID.
|
|
7
|
+
- `JWK`
|
|
@@ -2,30 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
The fields in a JSON Web Token header.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
\[`key`: `string`\]: `unknown`
|
|
8
|
-
|
|
9
|
-
## Properties
|
|
10
|
-
|
|
11
|
-
### typ?
|
|
12
|
-
|
|
13
|
-
> `optional` **typ**: `string`
|
|
14
|
-
|
|
15
|
-
The type of the token.
|
|
5
|
+
## Extends
|
|
16
6
|
|
|
17
|
-
|
|
7
|
+
- `JWTHeaderParameters`
|
|
18
8
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
> **alg**: [`JwtAlgorithms`](../type-aliases/JwtAlgorithms.md)
|
|
22
|
-
|
|
23
|
-
The algorithm used to sign the token.
|
|
24
|
-
|
|
25
|
-
***
|
|
26
|
-
|
|
27
|
-
### kid?
|
|
9
|
+
## Indexable
|
|
28
10
|
|
|
29
|
-
|
|
11
|
+
\[`propName`: `string`\]: `unknown`
|
|
30
12
|
|
|
31
|
-
|
|
13
|
+
Any other JWS Header member.
|
|
@@ -2,62 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
The fields in a JSON Web Token payload.
|
|
4
4
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
\[`key`: `string`\]: `unknown`
|
|
8
|
-
|
|
9
|
-
## Properties
|
|
10
|
-
|
|
11
|
-
### iss?
|
|
12
|
-
|
|
13
|
-
> `optional` **iss**: `string`
|
|
14
|
-
|
|
15
|
-
The issuer of the token.
|
|
16
|
-
|
|
17
|
-
***
|
|
18
|
-
|
|
19
|
-
### sub?
|
|
20
|
-
|
|
21
|
-
> `optional` **sub**: `string`
|
|
22
|
-
|
|
23
|
-
The subject of the token.
|
|
24
|
-
|
|
25
|
-
***
|
|
26
|
-
|
|
27
|
-
### aud?
|
|
28
|
-
|
|
29
|
-
> `optional` **aud**: `string`
|
|
30
|
-
|
|
31
|
-
The audience of the token.
|
|
5
|
+
## Extends
|
|
32
6
|
|
|
33
|
-
|
|
7
|
+
- `JWTPayload`
|
|
34
8
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
> `optional` **exp**: `number`
|
|
38
|
-
|
|
39
|
-
The expiration time of the token.
|
|
40
|
-
|
|
41
|
-
***
|
|
42
|
-
|
|
43
|
-
### nbf?
|
|
44
|
-
|
|
45
|
-
> `optional` **nbf**: `number`
|
|
46
|
-
|
|
47
|
-
The not before time of the token.
|
|
48
|
-
|
|
49
|
-
***
|
|
50
|
-
|
|
51
|
-
### iat?
|
|
52
|
-
|
|
53
|
-
> `optional` **iat**: `number`
|
|
54
|
-
|
|
55
|
-
The issued at time of the token.
|
|
56
|
-
|
|
57
|
-
***
|
|
58
|
-
|
|
59
|
-
### jti?
|
|
9
|
+
## Indexable
|
|
60
10
|
|
|
61
|
-
|
|
11
|
+
\[`propName`: `string`\]: `unknown`
|
|
62
12
|
|
|
63
|
-
|
|
13
|
+
Any other JWT Claim Set member.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Type Alias: HeaderTypes
|
|
2
2
|
|
|
3
|
-
> **HeaderTypes
|
|
3
|
+
> **HeaderTypes** = *typeof* [`HeaderTypes`](../variables/HeaderTypes.md)\[keyof *typeof* [`HeaderTypes`](../variables/HeaderTypes.md)\]
|
|
4
4
|
|
|
5
5
|
Common http header types.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Type Alias: HttpMethod
|
|
2
2
|
|
|
3
|
-
> **HttpMethod
|
|
3
|
+
> **HttpMethod** = *typeof* [`HttpMethod`](../variables/HttpMethod.md)\[keyof *typeof* [`HttpMethod`](../variables/HttpMethod.md)\]
|
|
4
4
|
|
|
5
5
|
The HTTP Methods.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Type Alias: HttpStatusCode
|
|
2
2
|
|
|
3
|
-
> **HttpStatusCode
|
|
3
|
+
> **HttpStatusCode** = *typeof* [`HttpStatusCode`](../variables/HttpStatusCode.md)\[keyof *typeof* [`HttpStatusCode`](../variables/HttpStatusCode.md)\]
|
|
4
4
|
|
|
5
5
|
Standard HTTP status codes.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Type Alias: MimeTypes
|
|
2
2
|
|
|
3
|
-
> **MimeTypes
|
|
3
|
+
> **MimeTypes** = *typeof* [`MimeTypes`](../variables/MimeTypes.md)\[keyof *typeof* [`MimeTypes`](../variables/MimeTypes.md)\]
|
|
4
4
|
|
|
5
5
|
Common mime types.
|
|
@@ -36,6 +36,12 @@ JSON - application/json
|
|
|
36
36
|
|
|
37
37
|
JSON-LD - application/ld+json
|
|
38
38
|
|
|
39
|
+
### Jwt
|
|
40
|
+
|
|
41
|
+
> `readonly` **Jwt**: `"application/jwt"` = `"application/jwt"`
|
|
42
|
+
|
|
43
|
+
JWT - application/jwt
|
|
44
|
+
|
|
39
45
|
### Xml
|
|
40
46
|
|
|
41
47
|
> `readonly` **Xml**: `"application/xml"` = `"application/xml"`
|
|
@@ -54,6 +60,12 @@ Application Octet Stream, arbitrary binary - application/octet-stream
|
|
|
54
60
|
|
|
55
61
|
Application GZIP - application/gzip
|
|
56
62
|
|
|
63
|
+
### Zlib
|
|
64
|
+
|
|
65
|
+
> `readonly` **Zlib**: `"application/zlib"` = `"application/zlib"`
|
|
66
|
+
|
|
67
|
+
Application deflate - application/zlib
|
|
68
|
+
|
|
57
69
|
### Bzip2
|
|
58
70
|
|
|
59
71
|
> `readonly` **Bzip2**: `"application/x-bzip2"` = `"application/x-bzip2"`
|
package/locales/en.json
CHANGED
|
@@ -9,7 +9,17 @@
|
|
|
9
9
|
},
|
|
10
10
|
"jwt": {
|
|
11
11
|
"noKeyOrSigner": "No key or signer was provided for JWT creation",
|
|
12
|
-
"noKeyOrVerifier": "No key or verifier was provided for JWT creation"
|
|
12
|
+
"noKeyOrVerifier": "No key or verifier was provided for JWT creation",
|
|
13
|
+
"verifyFailed": "Failed to verify JWT",
|
|
14
|
+
"invalidTokenParts": "The JSON Web Token could not be parsed, it should contain three parts separated by dots",
|
|
15
|
+
"invalidSigningBytes": "The signing bytes are invalid, it should contain two parts separated by a dot"
|
|
16
|
+
},
|
|
17
|
+
"jwk": {
|
|
18
|
+
"jwkImportFailed": "Failed to import JWK"
|
|
19
|
+
},
|
|
20
|
+
"jws": {
|
|
21
|
+
"createFailed": "Failed to create JWS",
|
|
22
|
+
"verifyFailed": "Failed to verify JWS"
|
|
13
23
|
}
|
|
14
24
|
},
|
|
15
25
|
"errorMessages": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2-next.3",
|
|
4
4
|
"description": "Contains classes for use with web operations",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,18 +14,19 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/core": "0.0.
|
|
18
|
-
"@twin.org/crypto": "0.0.
|
|
19
|
-
"@twin.org/nameof": "next"
|
|
17
|
+
"@twin.org/core": "0.0.2-next.3",
|
|
18
|
+
"@twin.org/crypto": "0.0.2-next.3",
|
|
19
|
+
"@twin.org/nameof": "0.0.2-next.3",
|
|
20
|
+
"jose": "6.0.11"
|
|
20
21
|
},
|
|
21
22
|
"main": "./dist/cjs/index.cjs",
|
|
22
23
|
"module": "./dist/esm/index.mjs",
|
|
23
24
|
"types": "./dist/types/index.d.ts",
|
|
24
25
|
"exports": {
|
|
25
26
|
".": {
|
|
27
|
+
"types": "./dist/types/index.d.ts",
|
|
26
28
|
"require": "./dist/cjs/index.cjs",
|
|
27
|
-
"import": "./dist/esm/index.mjs"
|
|
28
|
-
"types": "./dist/types/index.d.ts"
|
|
29
|
+
"import": "./dist/esm/index.mjs"
|
|
29
30
|
}
|
|
30
31
|
},
|
|
31
32
|
"files": [
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The cryptographic algorithms supported for JSON Web Tokens and JSON Web Keys.
|
|
3
|
-
*/
|
|
4
|
-
export declare const JwtAlgorithms: {
|
|
5
|
-
/**
|
|
6
|
-
* HMAC using SHA-256.
|
|
7
|
-
*/
|
|
8
|
-
readonly HS256: "HS256";
|
|
9
|
-
/**
|
|
10
|
-
* EdDSA using Ed25519.
|
|
11
|
-
*/
|
|
12
|
-
readonly EdDSA: "EdDSA";
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* The cryptographic algorithms supported for JSON Web Tokens and JSON Web Keys.
|
|
16
|
-
*/
|
|
17
|
-
export type JwtAlgorithms = (typeof JwtAlgorithms)[keyof typeof JwtAlgorithms];
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Variable: JwtAlgorithms
|
|
2
|
-
|
|
3
|
-
> `const` **JwtAlgorithms**: `object`
|
|
4
|
-
|
|
5
|
-
The cryptographic algorithms supported for JSON Web Tokens and JSON Web Keys.
|
|
6
|
-
|
|
7
|
-
## Type declaration
|
|
8
|
-
|
|
9
|
-
### HS256
|
|
10
|
-
|
|
11
|
-
> `readonly` **HS256**: `"HS256"` = `"HS256"`
|
|
12
|
-
|
|
13
|
-
HMAC using SHA-256.
|
|
14
|
-
|
|
15
|
-
### EdDSA
|
|
16
|
-
|
|
17
|
-
> `readonly` **EdDSA**: `"EdDSA"` = `"EdDSA"`
|
|
18
|
-
|
|
19
|
-
EdDSA using Ed25519.
|