@denodeio/seshat 0.0.29 → 0.0.30

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.
@@ -28,6 +28,7 @@ export * from "./signer";
28
28
  type OptionsInput = {
29
29
  fieldName?: string;
30
30
  barongJwtPublicKey?: string;
31
+ jwtPublicKey?: string;
31
32
  issuer?: string;
32
33
  };
33
34
  export declare const sessionVerifier: (options: OptionsInput) => (req: any, res: any, next: any) => void;
@@ -42,6 +42,7 @@ type JwtPayload<T> = {
42
42
  type OptionsInput = {
43
43
  fieldName?: string;
44
44
  barongJwtPublicKey?: string;
45
+ jwtPublicKey?: string;
45
46
  issuer?: string;
46
47
  };
47
48
  declare const sessionVerifier: (options: OptionsInput) => (req: any, res: any, next: any) => void;
@@ -6545,10 +6545,10 @@ signer.signData = signData;
6545
6545
  __exportStar(signer, exports);
6546
6546
  const sessionVerifier = function (options) {
6547
6547
  const { fieldName = "session", ...actualOptions } = options;
6548
- if (!options || !options.barongJwtPublicKey) {
6549
- throw new Error("Barong JWT Public key should be set");
6548
+ if (!options || (!options.barongJwtPublicKey && !options.jwtPublicKey)) {
6549
+ throw new Error("JWT Public key should be set");
6550
6550
  }
6551
- const barongJwtPublicKey = options.barongJwtPublicKey;
6551
+ const jwtPublicKey = options.barongJwtPublicKey || options.jwtPublicKey;
6552
6552
  const defaultOptions = {
6553
6553
  algorithms: ["RS256"],
6554
6554
  issuer: "auth"
@@ -6565,7 +6565,7 @@ signer.signData = signData;
6565
6565
  return;
6566
6566
  }
6567
6567
  try {
6568
- req[fieldName] = jsonwebtoken_1.default.verify(authHeader, barongJwtPublicKey, verificationOptions);
6568
+ req[fieldName] = jsonwebtoken_1.default.verify(authHeader, jwtPublicKey, verificationOptions);
6569
6569
  }
6570
6570
  catch (error) {
6571
6571
  res.status(403);