@celljs/oauth2-jose 3.8.0 → 3.9.0
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/esm/node/index.d.ts +3 -0
- package/esm/node/index.js +4 -0
- package/esm/node/index.js.map +1 -0
- package/esm/node/jwk/index.d.ts +2 -0
- package/esm/node/jwk/index.js +3 -0
- package/esm/node/jwk/index.js.map +1 -0
- package/esm/node/jwk/jwk-protocol.d.ts +4 -0
- package/esm/node/jwk/jwk-protocol.js +2 -0
- package/esm/node/jwk/jwk-protocol.js.map +1 -0
- package/esm/node/jwk/jwk-set-manager.d.ts +8 -0
- package/esm/node/jwk/jwk-set-manager.js +38 -0
- package/esm/node/jwk/jwk-set-manager.js.map +1 -0
- package/esm/node/jws/index.d.ts +1 -0
- package/esm/node/jws/index.js +2 -0
- package/esm/node/jws/index.js.map +1 -0
- package/esm/node/jws/jws-protocol.d.ts +50 -0
- package/esm/node/jws/jws-protocol.js +52 -0
- package/esm/node/jws/jws-protocol.js.map +1 -0
- package/esm/node/jwt/index.d.ts +1 -0
- package/esm/node/jwt/index.js +2 -0
- package/esm/node/jwt/index.js.map +1 -0
- package/esm/node/jwt/jwt-protocol.d.ts +15 -0
- package/esm/node/jwt/jwt-protocol.js +2 -0
- package/esm/node/jwt/jwt-protocol.js.map +1 -0
- package/esm/node/module.d.ts +3 -0
- package/esm/node/module.js +4 -0
- package/esm/node/module.js.map +1 -0
- package/esm/package.json +3 -0
- package/package.json +46 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/jwk/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwk-protocol.js","sourceRoot":"","sources":["../../../src/node/jwk/jwk-protocol.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { KeyLike } from 'jose';
|
|
2
|
+
import { JwkSetManager } from './jwk-protocol.js';
|
|
3
|
+
import { RestOperations } from '@celljs/http';
|
|
4
|
+
export declare class DefaultJwkSetManager implements JwkSetManager<KeyLike | Uint8Array> {
|
|
5
|
+
protected readonly cacheMap: Map<string, KeyLike | Uint8Array<ArrayBufferLike>>;
|
|
6
|
+
protected readonly restOperations: RestOperations;
|
|
7
|
+
get(jwksUri: string): Promise<KeyLike | Uint8Array>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { createRemoteJWKSet } from 'jose';
|
|
11
|
+
import { JwkSetManager } from './jwk-protocol.js';
|
|
12
|
+
import { Component, Autowired } from '@celljs/core';
|
|
13
|
+
import { RestOperations } from '@celljs/http';
|
|
14
|
+
let DefaultJwkSetManager = class DefaultJwkSetManager {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.cacheMap = new Map();
|
|
17
|
+
}
|
|
18
|
+
async get(jwksUri) {
|
|
19
|
+
let keyStore = this.cacheMap.get(jwksUri);
|
|
20
|
+
if (!keyStore) {
|
|
21
|
+
const { data } = await this.restOperations.get(jwksUri);
|
|
22
|
+
const { alg, kid } = data.keys[0];
|
|
23
|
+
const jwks = createRemoteJWKSet(new URL(jwksUri));
|
|
24
|
+
keyStore = await jwks({ alg, kid }, {});
|
|
25
|
+
this.cacheMap.set(jwksUri, keyStore);
|
|
26
|
+
}
|
|
27
|
+
return keyStore;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
__decorate([
|
|
31
|
+
Autowired(RestOperations),
|
|
32
|
+
__metadata("design:type", Function)
|
|
33
|
+
], DefaultJwkSetManager.prototype, "restOperations", void 0);
|
|
34
|
+
DefaultJwkSetManager = __decorate([
|
|
35
|
+
Component(JwkSetManager)
|
|
36
|
+
], DefaultJwkSetManager);
|
|
37
|
+
export { DefaultJwkSetManager };
|
|
38
|
+
//# sourceMappingURL=jwk-set-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwk-set-manager.js","sourceRoot":"","sources":["../../../src/node/jwk/jwk-set-manager.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAA8B,MAAM,MAAM,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGvC,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAA1B;QAEgB,aAAQ,GAAG,IAAI,GAAG,EAAgC,CAAC;IAgB1E,CAAC;IAXG,KAAK,CAAC,GAAG,CAAC,OAAe;QACrB,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACxD,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClC,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;YAClD,QAAQ,GAAG,MAAM,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,EAAqB,EAAE,CAAC,CAAC;YAC3D,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ,CAAA;AAbsB;IADlB,SAAS,CAAC,cAAc,CAAC;;4DACwB;AALzC,oBAAoB;IADhC,SAAS,CAAC,aAAa,CAAC;GACZ,oBAAoB,CAkBhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './jws-protocol.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/jws/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare namespace JwsAlgorithms {
|
|
2
|
+
/**
|
|
3
|
+
* HMAC using SHA-256 (Required)
|
|
4
|
+
*/
|
|
5
|
+
const HS256 = "HS256";
|
|
6
|
+
/**
|
|
7
|
+
* HMAC using SHA-384 (Optional)
|
|
8
|
+
*/
|
|
9
|
+
const HS384 = "HS384";
|
|
10
|
+
/**
|
|
11
|
+
* HMAC using SHA-512 (Optional)
|
|
12
|
+
*/
|
|
13
|
+
const HS512 = "HS512";
|
|
14
|
+
/**
|
|
15
|
+
* RSASSA-PKCS1-v1_5 using SHA-256 (Recommended)
|
|
16
|
+
*/
|
|
17
|
+
const RS256 = "RS256";
|
|
18
|
+
/**
|
|
19
|
+
* RSASSA-PKCS1-v1_5 using SHA-384 (Optional)
|
|
20
|
+
*/
|
|
21
|
+
const RS384 = "RS384";
|
|
22
|
+
/**
|
|
23
|
+
* RSASSA-PKCS1-v1_5 using SHA-512 (Optional)
|
|
24
|
+
*/
|
|
25
|
+
const RS512 = "RS512";
|
|
26
|
+
/**
|
|
27
|
+
* ECDSA using P-256 and SHA-256 (Recommended+)
|
|
28
|
+
*/
|
|
29
|
+
const ES256 = "ES256";
|
|
30
|
+
/**
|
|
31
|
+
* ECDSA using P-384 and SHA-384 (Optional)
|
|
32
|
+
*/
|
|
33
|
+
const ES384 = "ES384";
|
|
34
|
+
/**
|
|
35
|
+
* ECDSA using P-521 and SHA-512 (Optional)
|
|
36
|
+
*/
|
|
37
|
+
const ES512 = "ES512";
|
|
38
|
+
/**
|
|
39
|
+
* RSASSA-PSS using SHA-256 and MGF1 with SHA-256 (Optional)
|
|
40
|
+
*/
|
|
41
|
+
const PS256 = "PS256";
|
|
42
|
+
/**
|
|
43
|
+
* RSASSA-PSS using SHA-384 and MGF1 with SHA-384 (Optional)
|
|
44
|
+
*/
|
|
45
|
+
const PS384 = "PS384";
|
|
46
|
+
/**
|
|
47
|
+
* RSASSA-PSS using SHA-512 and MGF1 with SHA-512 (Optional)
|
|
48
|
+
*/
|
|
49
|
+
const PS512 = "PS512";
|
|
50
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export var JwsAlgorithms;
|
|
2
|
+
(function (JwsAlgorithms) {
|
|
3
|
+
/**
|
|
4
|
+
* HMAC using SHA-256 (Required)
|
|
5
|
+
*/
|
|
6
|
+
JwsAlgorithms.HS256 = 'HS256';
|
|
7
|
+
/**
|
|
8
|
+
* HMAC using SHA-384 (Optional)
|
|
9
|
+
*/
|
|
10
|
+
JwsAlgorithms.HS384 = 'HS384';
|
|
11
|
+
/**
|
|
12
|
+
* HMAC using SHA-512 (Optional)
|
|
13
|
+
*/
|
|
14
|
+
JwsAlgorithms.HS512 = 'HS512';
|
|
15
|
+
/**
|
|
16
|
+
* RSASSA-PKCS1-v1_5 using SHA-256 (Recommended)
|
|
17
|
+
*/
|
|
18
|
+
JwsAlgorithms.RS256 = 'RS256';
|
|
19
|
+
/**
|
|
20
|
+
* RSASSA-PKCS1-v1_5 using SHA-384 (Optional)
|
|
21
|
+
*/
|
|
22
|
+
JwsAlgorithms.RS384 = 'RS384';
|
|
23
|
+
/**
|
|
24
|
+
* RSASSA-PKCS1-v1_5 using SHA-512 (Optional)
|
|
25
|
+
*/
|
|
26
|
+
JwsAlgorithms.RS512 = 'RS512';
|
|
27
|
+
/**
|
|
28
|
+
* ECDSA using P-256 and SHA-256 (Recommended+)
|
|
29
|
+
*/
|
|
30
|
+
JwsAlgorithms.ES256 = 'ES256';
|
|
31
|
+
/**
|
|
32
|
+
* ECDSA using P-384 and SHA-384 (Optional)
|
|
33
|
+
*/
|
|
34
|
+
JwsAlgorithms.ES384 = 'ES384';
|
|
35
|
+
/**
|
|
36
|
+
* ECDSA using P-521 and SHA-512 (Optional)
|
|
37
|
+
*/
|
|
38
|
+
JwsAlgorithms.ES512 = 'ES512';
|
|
39
|
+
/**
|
|
40
|
+
* RSASSA-PSS using SHA-256 and MGF1 with SHA-256 (Optional)
|
|
41
|
+
*/
|
|
42
|
+
JwsAlgorithms.PS256 = 'PS256';
|
|
43
|
+
/**
|
|
44
|
+
* RSASSA-PSS using SHA-384 and MGF1 with SHA-384 (Optional)
|
|
45
|
+
*/
|
|
46
|
+
JwsAlgorithms.PS384 = 'PS384';
|
|
47
|
+
/**
|
|
48
|
+
* RSASSA-PSS using SHA-512 and MGF1 with SHA-512 (Optional)
|
|
49
|
+
*/
|
|
50
|
+
JwsAlgorithms.PS512 = 'PS512';
|
|
51
|
+
})(JwsAlgorithms || (JwsAlgorithms = {}));
|
|
52
|
+
//# sourceMappingURL=jws-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jws-protocol.js","sourceRoot":"","sources":["../../../src/node/jws/jws-protocol.ts"],"names":[],"mappings":"AAAA,MAAM,KAAW,aAAa,CA6D7B;AA7DD,WAAiB,aAAa;IAC1B;;OAEG;IACU,mBAAK,GAAG,OAAO,CAAC;IAE7B;;OAEG;IACU,mBAAK,GAAG,OAAO,CAAC;IAE7B;;OAEG;IACU,mBAAK,GAAG,OAAO,CAAC;IAE7B;;OAEG;IACU,mBAAK,GAAG,OAAO,CAAC;IAE7B;;OAEG;IACU,mBAAK,GAAG,OAAO,CAAC;IAE7B;;OAEG;IACU,mBAAK,GAAG,OAAO,CAAC;IAE7B;;OAEG;IACU,mBAAK,GAAG,OAAO,CAAC;IAE7B;;OAEG;IACU,mBAAK,GAAG,OAAO,CAAC;IAE7B;;OAEG;IACU,mBAAK,GAAG,OAAO,CAAC;IAE7B;;OAEG;IACU,mBAAK,GAAG,OAAO,CAAC;IAE7B;;OAEG;IACU,mBAAK,GAAG,OAAO,CAAC;IAE7B;;OAEG;IACU,mBAAK,GAAG,OAAO,CAAC;AAEjC,CAAC,EA7DgB,aAAa,KAAb,aAAa,QA6D7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './jwt-protocol.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/jwt/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface Jwt {
|
|
2
|
+
header: {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
};
|
|
5
|
+
payload: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
token: string;
|
|
9
|
+
}
|
|
10
|
+
export interface JwtDecoder {
|
|
11
|
+
decode(token: string): Promise<Jwt>;
|
|
12
|
+
}
|
|
13
|
+
export interface JwtDecoderFactory<T> {
|
|
14
|
+
create(context: T): Promise<JwtDecoder>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt-protocol.js","sourceRoot":"","sources":["../../../src/node/jwt/jwt-protocol.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,SAAS,CAAC;AAEjB,eAAe,QAAQ,EAAE,CAAC"}
|
package/esm/package.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/oauth2-jose",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cell-component"
|
|
@@ -18,23 +18,63 @@
|
|
|
18
18
|
"typings": "lib/node/index.d.ts",
|
|
19
19
|
"files": [
|
|
20
20
|
"lib",
|
|
21
|
+
"esm",
|
|
21
22
|
"src",
|
|
22
23
|
"cell.yml"
|
|
23
24
|
],
|
|
24
25
|
"scripts": {
|
|
25
|
-
"build": "tsc -b",
|
|
26
|
-
"clean": "rm -rf lib *.tsbuildinfo",
|
|
26
|
+
"build": "tsc -b && bun ../../scripts/build-esm.ts",
|
|
27
|
+
"clean": "rm -rf lib esm *.tsbuildinfo",
|
|
27
28
|
"test": "bun test --preload reflect-metadata ./lib",
|
|
28
29
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@celljs/core": "3.
|
|
32
|
-
"@celljs/http": "3.
|
|
33
|
-
"@celljs/web": "3.
|
|
32
|
+
"@celljs/core": "3.9.0",
|
|
33
|
+
"@celljs/http": "3.9.0",
|
|
34
|
+
"@celljs/web": "3.9.0",
|
|
34
35
|
"jose": "^4.9.3",
|
|
35
36
|
"tslib": "^2.8.0"
|
|
36
37
|
},
|
|
37
38
|
"publishConfig": {
|
|
38
39
|
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"exports": {
|
|
42
|
+
".": {
|
|
43
|
+
"webpack": "./lib/node/index.js",
|
|
44
|
+
"import": "./esm/node/index.js",
|
|
45
|
+
"default": "./lib/node/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./package.json": "./package.json",
|
|
48
|
+
"./lib/node": {
|
|
49
|
+
"webpack": "./lib/node/index.js",
|
|
50
|
+
"import": "./esm/node/index.js",
|
|
51
|
+
"default": "./lib/node/index.js"
|
|
52
|
+
},
|
|
53
|
+
"./lib/node/jwk": {
|
|
54
|
+
"webpack": "./lib/node/jwk/index.js",
|
|
55
|
+
"import": "./esm/node/jwk/index.js",
|
|
56
|
+
"default": "./lib/node/jwk/index.js"
|
|
57
|
+
},
|
|
58
|
+
"./lib/node/jws": {
|
|
59
|
+
"webpack": "./lib/node/jws/index.js",
|
|
60
|
+
"import": "./esm/node/jws/index.js",
|
|
61
|
+
"default": "./lib/node/jws/index.js"
|
|
62
|
+
},
|
|
63
|
+
"./lib/node/jwt": {
|
|
64
|
+
"webpack": "./lib/node/jwt/index.js",
|
|
65
|
+
"import": "./esm/node/jwt/index.js",
|
|
66
|
+
"default": "./lib/node/jwt/index.js"
|
|
67
|
+
},
|
|
68
|
+
"./lib/*.js": {
|
|
69
|
+
"webpack": "./lib/*.js",
|
|
70
|
+
"import": "./esm/*.js",
|
|
71
|
+
"default": "./lib/*.js"
|
|
72
|
+
},
|
|
73
|
+
"./lib/*": {
|
|
74
|
+
"webpack": "./lib/*.js",
|
|
75
|
+
"import": "./esm/*.js",
|
|
76
|
+
"default": "./lib/*.js"
|
|
77
|
+
},
|
|
78
|
+
"./*": "./*"
|
|
39
79
|
}
|
|
40
80
|
}
|