@denodeio/seshat 0.0.26 → 0.0.28
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 +23 -4
- package/build/cjs/dist/mjs/src/index.d.ts +6 -1
- package/build/cjs/index.d.ts +6 -1
- package/build/cjs/index.js +3 -2
- package/build/cjs/index.js.map +1 -1
- package/build/mjs/dist/mjs/src/index.d.ts +6 -1
- package/build/mjs/index.d.ts +6 -1
- package/build/mjs/index.js +3 -2
- package/build/mjs/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,36 +1,55 @@
|
|
|
1
1
|
<h1 align="center">@denode/seshat</h1>
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
|
+
|
|
4
5
|
<b>seshat</b> is a library that offers a collection of functions commonly used in Denode backend services.
|
|
5
6
|
|
|
6
7
|
## Install
|
|
8
|
+
|
|
7
9
|
To use functions in other services, download seshat as a package:
|
|
10
|
+
|
|
8
11
|
```bash
|
|
9
12
|
npm i @denodeio/seshat
|
|
10
13
|
```
|
|
11
14
|
|
|
12
15
|
## Local Build And Deploy
|
|
16
|
+
|
|
13
17
|
To build the project locally and deploy, follow these steps:
|
|
18
|
+
|
|
14
19
|
### 1. Build The Project
|
|
15
|
-
|
|
20
|
+
|
|
21
|
+
Run the following command to build the project using Rollup.js, which compiles and generates a bundled version of the project:
|
|
22
|
+
|
|
16
23
|
```bash
|
|
17
24
|
pnpm build
|
|
18
|
-
```
|
|
25
|
+
```
|
|
26
|
+
|
|
19
27
|
This command outputs the compiled code to the "dist" folder, which is used for deployment.
|
|
28
|
+
|
|
20
29
|
### 2. Update Package Version:
|
|
21
|
-
|
|
30
|
+
|
|
31
|
+
Open the [package.json](package.json) file and update the version field. For example:
|
|
32
|
+
|
|
22
33
|
```
|
|
23
34
|
"version": "0.0.12"
|
|
24
35
|
```
|
|
36
|
+
|
|
25
37
|
Ensure that you increment the version number appropriately.
|
|
38
|
+
|
|
26
39
|
### 3. Login to NPM Registry:
|
|
40
|
+
|
|
27
41
|
Use the following command to log in to the [npm registry](https://www.npmjs.com):
|
|
42
|
+
|
|
28
43
|
```bash
|
|
29
44
|
npm login
|
|
30
45
|
```
|
|
46
|
+
|
|
31
47
|
This command will redirect you to the [npm registry](https://www.npmjs.com). Follow the login process on the browser
|
|
48
|
+
|
|
32
49
|
### 4. Publish the New Version:
|
|
50
|
+
|
|
33
51
|
After successful login, you can publish the new version to NPM with the following command:
|
|
52
|
+
|
|
34
53
|
```bash
|
|
35
54
|
npm publish
|
|
36
|
-
```
|
|
55
|
+
```
|
|
@@ -25,6 +25,11 @@ type JwtPayload<T> = {
|
|
|
25
25
|
iat: number;
|
|
26
26
|
};
|
|
27
27
|
export * from "./signer";
|
|
28
|
-
|
|
28
|
+
type OptionsInput = {
|
|
29
|
+
sessionName?: string;
|
|
30
|
+
barongJwtPublicKey?: string;
|
|
31
|
+
issuer?: string;
|
|
32
|
+
};
|
|
33
|
+
export declare const sessionVerifier: (options: OptionsInput) => (req: any, res: any, next: any) => void;
|
|
29
34
|
export declare const managementSigner: (options: any) => (req: any, res: any, next: any) => void;
|
|
30
35
|
export declare const validateJws: <T>(key: Keychain, input: JwsPayload) => JwtPayload<T> | undefined;
|
package/build/cjs/index.d.ts
CHANGED
|
@@ -39,7 +39,12 @@ type JwtPayload<T> = {
|
|
|
39
39
|
iat: number;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
type OptionsInput = {
|
|
43
|
+
sessionName?: string;
|
|
44
|
+
barongJwtPublicKey?: string;
|
|
45
|
+
issuer?: string;
|
|
46
|
+
};
|
|
47
|
+
declare const sessionVerifier: (options: OptionsInput) => (req: any, res: any, next: any) => void;
|
|
43
48
|
declare const managementSigner: (options: any) => (req: any, res: any, next: any) => void;
|
|
44
49
|
declare const validateJws: <T>(key: Keychain, input: JwsPayload) => JwtPayload<T> | undefined;
|
|
45
50
|
|
package/build/cjs/index.js
CHANGED
|
@@ -6544,6 +6544,7 @@ signer.signData = signData;
|
|
|
6544
6544
|
const signer_1 = signer;
|
|
6545
6545
|
__exportStar(signer, exports);
|
|
6546
6546
|
const sessionVerifier = function (options) {
|
|
6547
|
+
const { sessionName = "session", ...actualOptions } = options;
|
|
6547
6548
|
if (!options || !options.barongJwtPublicKey) {
|
|
6548
6549
|
throw new Error("Barong JWT Public key should be set");
|
|
6549
6550
|
}
|
|
@@ -6552,7 +6553,7 @@ signer.signData = signData;
|
|
|
6552
6553
|
algorithms: ["RS256"],
|
|
6553
6554
|
issuer: "auth"
|
|
6554
6555
|
};
|
|
6555
|
-
const verificationOptions = { ...defaultOptions, ...
|
|
6556
|
+
const verificationOptions = { ...defaultOptions, ...actualOptions };
|
|
6556
6557
|
const middleware = function (req, res, next) {
|
|
6557
6558
|
let authHeader;
|
|
6558
6559
|
try {
|
|
@@ -6564,7 +6565,7 @@ signer.signData = signData;
|
|
|
6564
6565
|
return;
|
|
6565
6566
|
}
|
|
6566
6567
|
try {
|
|
6567
|
-
req
|
|
6568
|
+
req[sessionName] = jsonwebtoken_1.default.verify(authHeader, barongJwtPublicKey, verificationOptions);
|
|
6568
6569
|
}
|
|
6569
6570
|
catch (error) {
|
|
6570
6571
|
res.status(403);
|