@denodeio/seshat 0.0.32 → 0.0.33

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.
@@ -1,4 +1,4 @@
1
- /// <reference types="node" />
1
+ import { PublicKey, Secret } from "jsonwebtoken";
2
2
  type JwsSignature = {
3
3
  protected: string;
4
4
  header: {
@@ -10,9 +10,9 @@ type JwsPayload = {
10
10
  payload: string;
11
11
  signatures: JwsSignature[];
12
12
  };
13
- type Keychain = {
13
+ export type Keychain = {
14
14
  algorithm: string;
15
- value: Buffer;
15
+ value: Secret | PublicKey;
16
16
  };
17
17
  type JwtPayload<T> = {
18
18
  iss: string;
@@ -1,4 +1,5 @@
1
- /// <reference types="node" />
1
+ import { Secret, PublicKey } from 'jsonwebtoken';
2
+
2
3
  type SignJwsResponse = {
3
4
  payload: string;
4
5
  signatures: {
@@ -26,7 +27,7 @@ type JwsPayload = {
26
27
  };
27
28
  type Keychain = {
28
29
  algorithm: string;
29
- value: Buffer;
30
+ value: Secret | PublicKey;
30
31
  };
31
32
  type JwtPayload<T> = {
32
33
  iss: string;
@@ -49,4 +50,4 @@ declare const sessionVerifier: (options: OptionsInput) => (req: any, res: any, n
49
50
  declare const managementSigner: (options: any) => (req: any, res: any, next: any) => void;
50
51
  declare const validateJws: <T>(key: Keychain, input: JwsPayload) => JwtPayload<T> | undefined;
51
52
 
52
- export { managementSigner, sessionVerifier, signData, signJws, signPayload, validateJws };
53
+ export { type Keychain, managementSigner, sessionVerifier, signData, signJws, signPayload, validateJws };
@@ -6564,6 +6564,9 @@ signer.signData = signData;
6564
6564
  res.send("Signature verification raised: Authorization header is missing or malformed");
6565
6565
  return;
6566
6566
  }
6567
+ if (!jwtPublicKey) {
6568
+ throw new Error("JWT Public key should be set");
6569
+ }
6567
6570
  try {
6568
6571
  req[fieldName] = jsonwebtoken_1.default.verify(authHeader, jwtPublicKey, verificationOptions);
6569
6572
  }