@denodeio/seshat 0.0.20 → 0.0.22
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/build/cjs/index.d.js +46 -0
- package/build/{index.js → cjs/index.js} +129 -94
- package/build/cjs/index.js.map +1 -0
- package/build/mjs/dist/mjs/src/index.d.ts +30 -0
- package/build/mjs/dist/mjs/src/signer.d.ts +14 -0
- package/build/mjs/index.d.ts +46 -0
- package/build/{index.d.ts → mjs/index.js} +1 -1
- package/package.json +20 -12
- package/build/index.js.map +0 -1
- package/readme.md +0 -1
- /package/build/{dist → cjs/dist/mjs}/src/index.d.ts +0 -0
- /package/build/{dist → cjs/dist/mjs}/src/signer.d.ts +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
type JwsSignature = {
|
|
3
|
+
protected: string;
|
|
4
|
+
header: {
|
|
5
|
+
kid: string;
|
|
6
|
+
};
|
|
7
|
+
signature: string;
|
|
8
|
+
};
|
|
9
|
+
type JwsPayload = {
|
|
10
|
+
payload: string;
|
|
11
|
+
signatures: JwsSignature[];
|
|
12
|
+
};
|
|
13
|
+
type Keychain = {
|
|
14
|
+
algorithm: string;
|
|
15
|
+
value: Buffer;
|
|
16
|
+
};
|
|
17
|
+
type JwtPayload<T> = {
|
|
18
|
+
iss: string;
|
|
19
|
+
exp: number;
|
|
20
|
+
jti: string;
|
|
21
|
+
event: {
|
|
22
|
+
name: string;
|
|
23
|
+
record: T;
|
|
24
|
+
};
|
|
25
|
+
iat: number;
|
|
26
|
+
};
|
|
27
|
+
export * from "./signer";
|
|
28
|
+
export declare const sessionVerifier: (options: any) => (req: any, res: any, next: any) => void;
|
|
29
|
+
export declare const managementSigner: (options: any) => (req: any, res: any, next: any) => void;
|
|
30
|
+
export declare const validateJws: <T>(key: Keychain, input: JwsPayload) => JwtPayload<T> | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type SignJwsResponse = {
|
|
2
|
+
payload: string;
|
|
3
|
+
signatures: {
|
|
4
|
+
protected: string;
|
|
5
|
+
header: {
|
|
6
|
+
kid: string;
|
|
7
|
+
};
|
|
8
|
+
signature: string;
|
|
9
|
+
}[];
|
|
10
|
+
};
|
|
11
|
+
export declare function signJws(payload: string, options: any): SignJwsResponse;
|
|
12
|
+
export declare function signPayload(payload: any, options: any): string;
|
|
13
|
+
export declare function signData(payload: object, options: any): SignJwsResponse;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
type SignJwsResponse = {
|
|
3
|
+
payload: string;
|
|
4
|
+
signatures: {
|
|
5
|
+
protected: string;
|
|
6
|
+
header: {
|
|
7
|
+
kid: string;
|
|
8
|
+
};
|
|
9
|
+
signature: string;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
declare function signJws(payload: string, options: any): SignJwsResponse;
|
|
13
|
+
declare function signPayload(payload: any, options: any): string;
|
|
14
|
+
declare function signData(payload: object, options: any): SignJwsResponse;
|
|
15
|
+
|
|
16
|
+
type JwsSignature = {
|
|
17
|
+
protected: string;
|
|
18
|
+
header: {
|
|
19
|
+
kid: string;
|
|
20
|
+
};
|
|
21
|
+
signature: string;
|
|
22
|
+
};
|
|
23
|
+
type JwsPayload = {
|
|
24
|
+
payload: string;
|
|
25
|
+
signatures: JwsSignature[];
|
|
26
|
+
};
|
|
27
|
+
type Keychain = {
|
|
28
|
+
algorithm: string;
|
|
29
|
+
value: Buffer;
|
|
30
|
+
};
|
|
31
|
+
type JwtPayload<T> = {
|
|
32
|
+
iss: string;
|
|
33
|
+
exp: number;
|
|
34
|
+
jti: string;
|
|
35
|
+
event: {
|
|
36
|
+
name: string;
|
|
37
|
+
record: T;
|
|
38
|
+
};
|
|
39
|
+
iat: number;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
declare const sessionVerifier: (options: any) => (req: any, res: any, next: any) => void;
|
|
43
|
+
declare const managementSigner: (options: any) => (req: any, res: any, next: any) => void;
|
|
44
|
+
declare const validateJws: <T>(key: Keychain, input: JwsPayload) => JwtPayload<T> | undefined;
|
|
45
|
+
|
|
46
|
+
export { managementSigner, sessionVerifier, signData, signJws, signPayload, validateJws };
|
|
@@ -6492,7 +6492,7 @@ function signPayload(payload, options) {
|
|
|
6492
6492
|
...defaultOptions,
|
|
6493
6493
|
...options
|
|
6494
6494
|
};
|
|
6495
|
-
const token =
|
|
6495
|
+
const token = jsonwebtoken.sign({
|
|
6496
6496
|
iss: options.issuer,
|
|
6497
6497
|
exp: Math.round(Date.now() / 1000) + mergedOptions.jwtExpireSeconds,
|
|
6498
6498
|
jti: randomUUID(),
|
package/package.json
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@denodeio/seshat",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"description": "
|
|
6
|
-
"main": "build/index.js",
|
|
4
|
+
"version": "0.0.22",
|
|
5
|
+
"description": "Functions' Library for Denode Ecosystem.",
|
|
6
|
+
"main": "build/cjs/index.js",
|
|
7
|
+
"module": "build/mjs/index.js",
|
|
8
|
+
"types": "build/mjs/index.d.ts",
|
|
7
9
|
"files": [
|
|
8
10
|
"./build/"
|
|
9
11
|
],
|
|
12
|
+
"exports":{
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./build/mjs/index.js",
|
|
15
|
+
"require": "./build/cjs/index.js",
|
|
16
|
+
"types": "./build/mjs/index.d.ts"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -p tsconfig.json && tsc -p tsconfig-cjs.json && ./customExportFix",
|
|
21
|
+
"removes": "rm -fr dist/* && rm -fr build/*",
|
|
22
|
+
"rollup-build": "rollup -c --bundleConfigAsCjs",
|
|
23
|
+
"lint": "eslint . --ext .ts",
|
|
24
|
+
"lintfix": "eslint --fix --ignore-path .gitignore --ext .ts ."
|
|
25
|
+
},
|
|
10
26
|
"keywords": [],
|
|
11
27
|
"author": "",
|
|
12
28
|
"license": "UNLICENSED",
|
|
@@ -31,13 +47,5 @@
|
|
|
31
47
|
},
|
|
32
48
|
"peerDependencies": {
|
|
33
49
|
"jsonwebtoken": "^9.0.2"
|
|
34
|
-
},
|
|
35
|
-
"scripts": {
|
|
36
|
-
"build": "tsc && rollup -c --bundleConfigAsCjs",
|
|
37
|
-
"_clear": "rm -r build",
|
|
38
|
-
"ts-build": "tsc",
|
|
39
|
-
"rollup-build": "rollup -c",
|
|
40
|
-
"lint": "eslint . --ext .ts",
|
|
41
|
-
"lintfix": "eslint --fix --ignore-path .gitignore --ext .ts ."
|
|
42
50
|
}
|
|
43
|
-
}
|
|
51
|
+
}
|