@denodeio/seshat 0.0.25 → 0.0.27
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.js → 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 +4 -2
- package/build/mjs/index.js.map +1 -0
- package/package.json +3 -3
|
@@ -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/mjs/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/mjs/index.js
CHANGED
|
@@ -6508,6 +6508,7 @@ function signData(payload, options) {
|
|
|
6508
6508
|
}
|
|
6509
6509
|
|
|
6510
6510
|
const sessionVerifier = function (options) {
|
|
6511
|
+
const { sessionName = "session", ...actualOptions } = options;
|
|
6511
6512
|
if (!options || !options.barongJwtPublicKey) {
|
|
6512
6513
|
throw new Error("Barong JWT Public key should be set");
|
|
6513
6514
|
}
|
|
@@ -6516,7 +6517,7 @@ const sessionVerifier = function (options) {
|
|
|
6516
6517
|
algorithms: ["RS256"],
|
|
6517
6518
|
issuer: "auth"
|
|
6518
6519
|
};
|
|
6519
|
-
const verificationOptions = { ...defaultOptions, ...
|
|
6520
|
+
const verificationOptions = { ...defaultOptions, ...actualOptions };
|
|
6520
6521
|
const middleware = function (req, res, next) {
|
|
6521
6522
|
let authHeader;
|
|
6522
6523
|
try {
|
|
@@ -6528,7 +6529,7 @@ const sessionVerifier = function (options) {
|
|
|
6528
6529
|
return;
|
|
6529
6530
|
}
|
|
6530
6531
|
try {
|
|
6531
|
-
req
|
|
6532
|
+
req[sessionName] = jwt.verify(authHeader, barongJwtPublicKey, verificationOptions);
|
|
6532
6533
|
}
|
|
6533
6534
|
catch (error) {
|
|
6534
6535
|
res.status(403);
|
|
@@ -6594,3 +6595,4 @@ const validateJws = (key, input) => {
|
|
|
6594
6595
|
};
|
|
6595
6596
|
|
|
6596
6597
|
export { managementSigner, sessionVerifier, signData, signJws, signPayload, validateJws };
|
|
6598
|
+
//# sourceMappingURL=index.js.map
|