@degenerate/generic 0.1.3 → 0.1.4

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.
Files changed (127) hide show
  1. package/dist/_settings/authorization-settings.d.ts +17 -0
  2. package/dist/_settings/authorization-settings.d.ts.map +1 -0
  3. package/dist/_settings/authorization-settings.js +20 -0
  4. package/dist/_settings/cryptography-settings.d.ts +15 -3
  5. package/dist/_settings/cryptography-settings.d.ts.map +1 -1
  6. package/dist/_settings/cryptography-settings.js +16 -2
  7. package/dist/authorization/index.d.ts +24 -0
  8. package/dist/authorization/index.d.ts.map +1 -0
  9. package/dist/authorization/index.js +61 -0
  10. package/dist/authorization/jwt/keys/create-public-key-pem.d.ts +9 -0
  11. package/dist/authorization/jwt/keys/create-public-key-pem.d.ts.map +1 -0
  12. package/dist/authorization/jwt/keys/create-public-key-pem.js +25 -0
  13. package/dist/authorization/jwt/keys/create-secret-key-pem.d.ts +9 -0
  14. package/dist/authorization/jwt/keys/create-secret-key-pem.d.ts.map +1 -0
  15. package/dist/authorization/jwt/keys/create-secret-key-pem.js +24 -0
  16. package/dist/authorization/jwt/sign/create-authorization-issuer.d.ts +10 -0
  17. package/dist/authorization/jwt/sign/create-authorization-issuer.d.ts.map +1 -0
  18. package/dist/authorization/jwt/sign/create-authorization-issuer.js +26 -0
  19. package/dist/authorization/jwt/sign/create-authorization-subject.d.ts +12 -0
  20. package/dist/authorization/jwt/sign/create-authorization-subject.d.ts.map +1 -0
  21. package/dist/authorization/jwt/sign/create-authorization-subject.js +19 -0
  22. package/dist/authorization/jwt/sign/create-jwt-options.d.ts +17 -0
  23. package/dist/authorization/jwt/sign/create-jwt-options.d.ts.map +1 -0
  24. package/dist/authorization/jwt/sign/create-jwt-options.js +43 -0
  25. package/dist/authorization/jwt/sign/create-jwt-signed-token.d.ts +13 -0
  26. package/dist/authorization/jwt/sign/create-jwt-signed-token.d.ts.map +1 -0
  27. package/dist/authorization/jwt/sign/create-jwt-signed-token.js +22 -0
  28. package/dist/authorization/jwt/transform/transform-token-payload-to-safe-payload.d.ts +10 -0
  29. package/dist/authorization/jwt/transform/transform-token-payload-to-safe-payload.d.ts.map +1 -0
  30. package/dist/authorization/jwt/transform/transform-token-payload-to-safe-payload.js +31 -0
  31. package/dist/authorization/jwt/verify/get-decoded-jwt-header.d.ts +10 -0
  32. package/dist/authorization/jwt/verify/get-decoded-jwt-header.d.ts.map +1 -0
  33. package/dist/authorization/jwt/verify/get-decoded-jwt-header.js +20 -0
  34. package/dist/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.d.ts +9 -0
  35. package/dist/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.d.ts.map +1 -0
  36. package/dist/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.js +17 -0
  37. package/dist/authorization/jwt/verify/verify-jwt-signed-token.d.ts +12 -0
  38. package/dist/authorization/jwt/verify/verify-jwt-signed-token.d.ts.map +1 -0
  39. package/dist/authorization/jwt/verify/verify-jwt-signed-token.js +34 -0
  40. package/dist/authorization/safe/authorization/authorized-authorities.d.ts +39 -0
  41. package/dist/authorization/safe/authorization/authorized-authorities.d.ts.map +1 -0
  42. package/dist/authorization/safe/authorization/authorized-authorities.js +56 -0
  43. package/dist/authorization/safe/request/decode-bearer-token.d.ts +11 -0
  44. package/dist/authorization/safe/request/decode-bearer-token.d.ts.map +1 -0
  45. package/dist/authorization/safe/request/decode-bearer-token.js +31 -0
  46. package/dist/authorization/safe/request/decode-safe-request.d.ts +11 -0
  47. package/dist/authorization/safe/request/decode-safe-request.d.ts.map +1 -0
  48. package/dist/authorization/safe/request/decode-safe-request.js +30 -0
  49. package/dist/authorization/safe/request/determine-issuer-from-request.d.ts +10 -0
  50. package/dist/authorization/safe/request/determine-issuer-from-request.d.ts.map +1 -0
  51. package/dist/authorization/safe/request/determine-issuer-from-request.js +29 -0
  52. package/dist/authorization/safe/request/issuer/determine-issuer-from-bearer-token.d.ts +12 -0
  53. package/dist/authorization/safe/request/issuer/determine-issuer-from-bearer-token.d.ts.map +1 -0
  54. package/dist/authorization/safe/request/issuer/determine-issuer-from-bearer-token.js +30 -0
  55. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-audience.d.ts +10 -0
  56. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-audience.d.ts.map +1 -0
  57. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-audience.js +24 -0
  58. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.d.ts +8 -0
  59. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.d.ts.map +1 -0
  60. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.js +23 -0
  61. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.d.ts +9 -0
  62. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.d.ts.map +1 -0
  63. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.js +24 -0
  64. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issuer.d.ts +10 -0
  65. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issuer.d.ts.map +1 -0
  66. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issuer.js +25 -0
  67. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.d.ts +8 -0
  68. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.d.ts.map +1 -0
  69. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.js +23 -0
  70. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts +10 -0
  71. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts.map +1 -0
  72. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-subject.js +22 -0
  73. package/dist/authorization/safe/validation/jwt/verify-token-header.d.ts +9 -0
  74. package/dist/authorization/safe/validation/jwt/verify-token-header.d.ts.map +1 -0
  75. package/dist/authorization/safe/validation/jwt/verify-token-header.js +25 -0
  76. package/dist/authorization/safe/validation/jwt/verify-token-payload.d.ts +11 -0
  77. package/dist/authorization/safe/validation/jwt/verify-token-payload.d.ts.map +1 -0
  78. package/dist/authorization/safe/validation/jwt/verify-token-payload.js +30 -0
  79. package/dist/crypto/index.d.ts +1 -0
  80. package/dist/crypto/index.d.ts.map +1 -1
  81. package/dist/crypto/index.js +1 -0
  82. package/dist/crypto/private-public-keys/create-key-pair-from-private-key.d.ts.map +1 -1
  83. package/dist/crypto/private-public-keys/generation/create-256-private-key-from-mnemonic.d.ts +1 -1
  84. package/dist/crypto/private-public-keys/generation/create-256-private-key-from-mnemonic.js +1 -1
  85. package/dist/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.d.ts +1 -1
  86. package/dist/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.d.ts.map +1 -1
  87. package/dist/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.js +3 -2
  88. package/dist/crypto/private-public-keys/generation/create-random-512-key-pair.d.ts +9 -0
  89. package/dist/crypto/private-public-keys/generation/create-random-512-key-pair.d.ts.map +1 -0
  90. package/dist/crypto/private-public-keys/generation/create-random-512-key-pair.js +46 -0
  91. package/dist/errors/authorization/authorization-errors.d.ts +106 -0
  92. package/dist/errors/authorization/authorization-errors.d.ts.map +1 -0
  93. package/dist/errors/authorization/authorization-errors.js +160 -0
  94. package/dist/errors/index.d.ts +1 -0
  95. package/dist/errors/index.d.ts.map +1 -1
  96. package/dist/errors/index.js +1 -0
  97. package/dist/helpers/crypto/cryptography-helpers.d.ts +37 -0
  98. package/dist/helpers/crypto/cryptography-helpers.d.ts.map +1 -0
  99. package/dist/helpers/crypto/cryptography-helpers.js +65 -0
  100. package/dist/helpers/index.d.ts +1 -0
  101. package/dist/helpers/index.d.ts.map +1 -1
  102. package/dist/helpers/index.js +1 -0
  103. package/dist/helpers/object-validation-helpers.d.ts +8 -1
  104. package/dist/helpers/object-validation-helpers.d.ts.map +1 -1
  105. package/dist/helpers/object-validation-helpers.js +22 -1
  106. package/dist/index.d.ts +2 -0
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +5 -0
  109. package/dist/models/authorization/authorization-models.d.ts +81 -0
  110. package/dist/models/authorization/authorization-models.d.ts.map +1 -0
  111. package/dist/models/authorization/authorization-models.js +33 -0
  112. package/dist/models/crypto/crypto-models.d.ts +5 -0
  113. package/dist/models/crypto/crypto-models.d.ts.map +1 -0
  114. package/dist/models/crypto/crypto-models.js +3 -0
  115. package/dist/models/index.d.ts +5 -0
  116. package/dist/models/index.d.ts.map +1 -1
  117. package/dist/models/index.js +5 -0
  118. package/dist/models/safe/safe-transactions.d.ts +81 -0
  119. package/dist/models/safe/safe-transactions.d.ts.map +1 -0
  120. package/dist/models/safe/safe-transactions.js +26 -0
  121. package/dist/models/share-data/share-data.d.ts +1 -0
  122. package/dist/models/share-data/share-data.d.ts.map +1 -1
  123. package/dist/models/share-data/share-data.js +1 -0
  124. package/package.json +4 -3
  125. package/dist/crypto/seal/seal.d.ts +0 -1
  126. package/dist/crypto/seal/seal.d.ts.map +0 -1
  127. package/dist/crypto/seal/seal.js +0 -51
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This contains the settings for the authorization functions.
3
+ */
4
+ export declare const AuthorizationSettings: {
5
+ JWT: {
6
+ Algorithm: string;
7
+ ExpiresInDefault: string;
8
+ NotBeforeDefault: number;
9
+ EncodingDefault: string;
10
+ MutatePayload: boolean;
11
+ NoTimestamp: boolean;
12
+ AllowInsecureKeySizes: boolean;
13
+ AllowInvalidAsymmetricKeyTypes: boolean;
14
+ HeaderType: string;
15
+ };
16
+ };
17
+ //# sourceMappingURL=authorization-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization-settings.d.ts","sourceRoot":"","sources":["../../src/_settings/authorization-settings.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;CAYjC,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ // This file contains the settings needed for authorization in the application.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AuthorizationSettings = void 0;
5
+ /**
6
+ * This contains the settings for the authorization functions.
7
+ */
8
+ exports.AuthorizationSettings = {
9
+ JWT: {
10
+ Algorithm: 'ES512', // ECDSA using P-521 curve and SHA-512 hash algorithm
11
+ ExpiresInDefault: '1h', // the expiration time of the jwt token
12
+ NotBeforeDefault: 0, // the not before time of the jwt token
13
+ EncodingDefault: 'utf8', // the encoding to use when converting the payload to a string
14
+ MutatePayload: true, // If true, the payload object will be mutated with the standard claims (iat, exp, etc.). Default is false.
15
+ NoTimestamp: false, // If true, the iat (issued at) claim will not be included in the token.
16
+ AllowInsecureKeySizes: false, // If true, allows the use of insecure key sizes.
17
+ AllowInvalidAsymmetricKeyTypes: false, // If true, allows the use of invalid asymmetric key types
18
+ HeaderType: 'JWT', // the type of the token in the header
19
+ }
20
+ };
@@ -6,22 +6,34 @@ import * as crypto from 'crypto';
6
6
  * This contains the settings for the cryptography. settings
7
7
  */
8
8
  export declare const CryptoSettings: {
9
- TextEncoding: crypto.Encoding;
10
9
  Hash: {
11
10
  Algorithm: string;
11
+ Algorithm512: string;
12
12
  Digest: crypto.BinaryToTextEncoding;
13
13
  };
14
+ Format: {
15
+ hex: string;
16
+ base64: string;
17
+ };
18
+ TextEncoding: crypto.Encoding;
14
19
  };
20
+ export declare const base64Encoding: BufferEncoding;
21
+ export declare const hexEncoding: BufferEncoding;
22
+ export declare const sec1KeyExportType = "sec1";
23
+ export declare const spkiKeyExportType = "spki";
24
+ export declare const keyExportFormatDer = "der";
15
25
  /**
16
26
  * This contains the values for the elliptical curvers for encryption
17
27
  */
18
28
  export declare enum EllipticalCurvesEncryption {
19
- Curve25519 = "curve25519"
29
+ Curve25519 = "curve25519",
30
+ P521 = "p521"
20
31
  }
21
32
  /**
22
33
  * This contains the values for the elliptical curvers for signing
23
34
  */
24
35
  export declare enum EllipticalCurvesSigning {
25
- Curve25519 = "ed25519"
36
+ Curve25519 = "ed25519",
37
+ P521 = "p521"
26
38
  }
27
39
  //# sourceMappingURL=cryptography-settings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cryptography-settings.d.ts","sourceRoot":"","sources":["../../src/_settings/cryptography-settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,cAAc;kBACC,MAAM,CAAC,QAAQ;;;gBAGlB,MAAM,CAAC,oBAAoB;;CAEnD,CAAC;AAEF;;GAEG;AACH,oBAAY,0BAA0B;IAClC,UAAU,eAAe;CAC5B;AAED;;GAEG;AACH,oBAAY,uBAAuB;IAC/B,UAAU,YAAY;CACzB"}
1
+ {"version":3,"file":"cryptography-settings.d.ts","sourceRoot":"","sources":["../../src/_settings/cryptography-settings.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,cAAc;;;;gBAIF,MAAM,CAAC,oBAAoB;;;;;;kBAMxB,MAAM,CAAC,QAAQ;CAC1C,CAAC;AAGF,eAAO,MAAM,cAAc,EAAe,cAAc,CAAC;AACzD,eAAO,MAAM,WAAW,EAAY,cAAc,CAAC;AAGnD,eAAO,MAAM,iBAAiB,SAAS,CAAC;AACxC,eAAO,MAAM,iBAAiB,SAAS,CAAC;AACxC,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AAExC;;GAEG;AACH,oBAAY,0BAA0B;IAClC,UAAU,eAAe;IACzB,IAAI,SAAS;CAChB;AAED;;GAEG;AACH,oBAAY,uBAAuB;IAC/B,UAAU,YAAY;IACtB,IAAI,SAAS;CAChB"}
@@ -1,22 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EllipticalCurvesSigning = exports.EllipticalCurvesEncryption = exports.CryptoSettings = void 0;
3
+ exports.EllipticalCurvesSigning = exports.EllipticalCurvesEncryption = exports.keyExportFormatDer = exports.spkiKeyExportType = exports.sec1KeyExportType = exports.hexEncoding = exports.base64Encoding = exports.CryptoSettings = void 0;
4
4
  /**
5
5
  * This contains the settings for the cryptography. settings
6
6
  */
7
7
  exports.CryptoSettings = {
8
- TextEncoding: 'utf8', // "utf8" | "ascii" | "latin1"
9
8
  Hash: {
10
9
  Algorithm: 'sha256',
10
+ Algorithm512: 'sha512',
11
11
  Digest: 'hex', // "hex" | "base64" | "base64url" | "binary"
12
12
  },
13
+ Format: {
14
+ hex: 'hex',
15
+ base64: 'base64',
16
+ },
17
+ TextEncoding: 'utf8', // "utf8" | "ascii" | "latin1"
13
18
  };
19
+ // export the types fo buffer encodings
20
+ exports.base64Encoding = 'base64';
21
+ exports.hexEncoding = 'hex';
22
+ // export the keyformats
23
+ exports.sec1KeyExportType = 'sec1';
24
+ exports.spkiKeyExportType = 'spki';
25
+ exports.keyExportFormatDer = 'der';
14
26
  /**
15
27
  * This contains the values for the elliptical curvers for encryption
16
28
  */
17
29
  var EllipticalCurvesEncryption;
18
30
  (function (EllipticalCurvesEncryption) {
19
31
  EllipticalCurvesEncryption["Curve25519"] = "curve25519";
32
+ EllipticalCurvesEncryption["P521"] = "p521";
20
33
  })(EllipticalCurvesEncryption || (exports.EllipticalCurvesEncryption = EllipticalCurvesEncryption = {}));
21
34
  /**
22
35
  * This contains the values for the elliptical curvers for signing
@@ -24,4 +37,5 @@ var EllipticalCurvesEncryption;
24
37
  var EllipticalCurvesSigning;
25
38
  (function (EllipticalCurvesSigning) {
26
39
  EllipticalCurvesSigning["Curve25519"] = "ed25519";
40
+ EllipticalCurvesSigning["P521"] = "p521";
27
41
  })(EllipticalCurvesSigning || (exports.EllipticalCurvesSigning = EllipticalCurvesSigning = {}));
@@ -0,0 +1,24 @@
1
+ export * from './jwt/keys/create-secret-key-pem';
2
+ export * from './jwt/keys/create-public-key-pem';
3
+ export * from './jwt/sign/create-authorization-issuer';
4
+ export * from './jwt/sign/create-authorization-subject';
5
+ export * from './jwt/sign/create-jwt-options';
6
+ export * from './jwt/sign/create-jwt-signed-token';
7
+ export * from './jwt/transform/transform-token-payload-to-safe-payload';
8
+ export * from './jwt/verify/get-decoded-jwt-header';
9
+ export * from './jwt/verify/get-decoded-jwt-signed-token-payload';
10
+ export * from './jwt/verify/verify-jwt-signed-token';
11
+ export * from './safe/authorization/authorized-authorities';
12
+ export * from './safe/request/decode-bearer-token';
13
+ export * from './safe/request/decode-safe-request';
14
+ export * from './safe/request/determine-issuer-from-request';
15
+ export * from './safe/request/issuer/determine-issuer-from-bearer-token';
16
+ export * from './safe/validation/jwt/payload/verify-authorization-audience';
17
+ export * from './safe/validation/jwt/payload/verify-authorization-expiration-time';
18
+ export * from './safe/validation/jwt/payload/verify-authorization-issued-at-time';
19
+ export * from './safe/validation/jwt/payload/verify-authorization-issuer';
20
+ export * from './safe/validation/jwt/payload/verify-authorization-not-before-time';
21
+ export * from './safe/validation/jwt/payload/verify-authorization-subject';
22
+ export * from './safe/validation/jwt/verify-token-header';
23
+ export * from './safe/validation/jwt/verify-token-payload';
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AACA,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AAIjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oCAAoC,CAAC;AAInD,cAAc,yDAAyD,CAAC;AAIxE,cAAc,qCAAqC,CAAC;AACpD,cAAc,mDAAmD,CAAC;AAClE,cAAc,sCAAsC,CAAC;AAMrD,cAAc,6CAA6C,CAAC;AAI5D,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,8CAA8C,CAAC;AAG7D,cAAc,0DAA0D,CAAC;AAWzE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,oEAAoE,CAAC;AACnF,cAAc,mEAAmE,CAAC;AAClF,cAAc,2DAA2D,CAAC;AAC1E,cAAc,oEAAoE,CAAC;AACnF,cAAc,4DAA4D,CAAC;AAI3E,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ //#region JWT Key functions
18
+ __exportStar(require("./jwt/keys/create-secret-key-pem"), exports);
19
+ __exportStar(require("./jwt/keys/create-public-key-pem"), exports);
20
+ //#endregion JWT Key functions
21
+ //#region JWT sign
22
+ __exportStar(require("./jwt/sign/create-authorization-issuer"), exports);
23
+ __exportStar(require("./jwt/sign/create-authorization-subject"), exports);
24
+ __exportStar(require("./jwt/sign/create-jwt-options"), exports);
25
+ __exportStar(require("./jwt/sign/create-jwt-signed-token"), exports);
26
+ //#endregion JWT sign
27
+ //#region JWT Transform
28
+ __exportStar(require("./jwt/transform/transform-token-payload-to-safe-payload"), exports);
29
+ //#endregion JWT Transform
30
+ //#region JWT verify
31
+ __exportStar(require("./jwt/verify/get-decoded-jwt-header"), exports);
32
+ __exportStar(require("./jwt/verify/get-decoded-jwt-signed-token-payload"), exports);
33
+ __exportStar(require("./jwt/verify/verify-jwt-signed-token"), exports);
34
+ //#endregion JWT verify
35
+ //#region Safe
36
+ //#region Authorization
37
+ __exportStar(require("./safe/authorization/authorized-authorities"), exports);
38
+ //#endregion Authorization
39
+ //#region Request
40
+ __exportStar(require("./safe/request/decode-bearer-token"), exports);
41
+ __exportStar(require("./safe/request/decode-safe-request"), exports);
42
+ __exportStar(require("./safe/request/determine-issuer-from-request"), exports);
43
+ //#region Issuer
44
+ __exportStar(require("./safe/request/issuer/determine-issuer-from-bearer-token"), exports);
45
+ //#endregion Issuer
46
+ //#endregion Request
47
+ //#region Validation
48
+ //#region JWT
49
+ //#region JWT Payload
50
+ __exportStar(require("./safe/validation/jwt/payload/verify-authorization-audience"), exports);
51
+ __exportStar(require("./safe/validation/jwt/payload/verify-authorization-expiration-time"), exports);
52
+ __exportStar(require("./safe/validation/jwt/payload/verify-authorization-issued-at-time"), exports);
53
+ __exportStar(require("./safe/validation/jwt/payload/verify-authorization-issuer"), exports);
54
+ __exportStar(require("./safe/validation/jwt/payload/verify-authorization-not-before-time"), exports);
55
+ __exportStar(require("./safe/validation/jwt/payload/verify-authorization-subject"), exports);
56
+ //#endregion JWT Payload
57
+ __exportStar(require("./safe/validation/jwt/verify-token-header"), exports);
58
+ __exportStar(require("./safe/validation/jwt/verify-token-payload"), exports);
59
+ //#endregion JWT
60
+ //#endregion Validation
61
+ //#endregion Safe
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This takes a public key in hex or Base64 format and creates a PEM key from it.
3
+ *
4
+ * @param publicKey the public key to create the PEM key from.
5
+ * @returns
6
+ */
7
+ declare const createPublicKeyPem: (publicKey: string) => string;
8
+ export { createPublicKeyPem };
9
+ //# sourceMappingURL=create-public-key-pem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-public-key-pem.d.ts","sourceRoot":"","sources":["../../../../src/authorization/jwt/keys/create-public-key-pem.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,QAAA,MAAM,kBAAkB,cAAe,MAAM,KAAG,MAW/C,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPublicKeyPem = void 0;
4
+ const cryptography_helpers_1 = require("../../../helpers/crypto/cryptography-helpers");
5
+ const object_validation_helpers_1 = require("../../../helpers/object-validation-helpers");
6
+ /**
7
+ * This takes a public key in hex or Base64 format and creates a PEM key from it.
8
+ *
9
+ * @param publicKey the public key to create the PEM key from.
10
+ * @returns
11
+ */
12
+ const createPublicKeyPem = (publicKey) => {
13
+ let jwtKey; // the key to return
14
+ const isValidHexString = (0, object_validation_helpers_1.validateStringHex)(publicKey);
15
+ if (isValidHexString) { // check if this is a hex encoded secret key.
16
+ const derKey = (0, cryptography_helpers_1.hexToBase64)(publicKey); // convert the hex to base 64
17
+ jwtKey = (0, cryptography_helpers_1.base64ToPublicPEM)(derKey);
18
+ }
19
+ else {
20
+ // add in the
21
+ jwtKey = (0, cryptography_helpers_1.base64ToPublicPEM)(publicKey);
22
+ }
23
+ return jwtKey;
24
+ };
25
+ exports.createPublicKeyPem = createPublicKeyPem;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This takes a secret key in hex or Base64 format and creates a PEM key from it.
3
+ *
4
+ * @param secretKey the secret key to create the PEM key from.
5
+ * @returns
6
+ */
7
+ declare const createSecretKeyPem: (secretKey: string) => string;
8
+ export { createSecretKeyPem };
9
+ //# sourceMappingURL=create-secret-key-pem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-secret-key-pem.d.ts","sourceRoot":"","sources":["../../../../src/authorization/jwt/keys/create-secret-key-pem.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,QAAA,MAAM,kBAAkB,cAAe,MAAM,KAAG,MAU/C,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSecretKeyPem = void 0;
4
+ const cryptography_helpers_1 = require("../../../helpers/crypto/cryptography-helpers");
5
+ const object_validation_helpers_1 = require("../../../helpers/object-validation-helpers");
6
+ /**
7
+ * This takes a secret key in hex or Base64 format and creates a PEM key from it.
8
+ *
9
+ * @param secretKey the secret key to create the PEM key from.
10
+ * @returns
11
+ */
12
+ const createSecretKeyPem = (secretKey) => {
13
+ let jwtKey;
14
+ if ((0, object_validation_helpers_1.validateStringHex)(secretKey)) { // check if this is a hex encoded secret key.
15
+ const derKey = (0, cryptography_helpers_1.hexToBase64)(secretKey); // convert the hex to base 64
16
+ jwtKey = (0, cryptography_helpers_1.base64ToPrivateECPEM)(derKey);
17
+ }
18
+ else {
19
+ // add in the
20
+ jwtKey = (0, cryptography_helpers_1.base64ToPrivateECPEM)(secretKey);
21
+ }
22
+ return jwtKey;
23
+ };
24
+ exports.createSecretKeyPem = createSecretKeyPem;
@@ -0,0 +1,10 @@
1
+ import { IAuthorizationIssuer } from '../../../models/authorization/authorization-models';
2
+ /**
3
+ * This function creates an authorization issuer.
4
+ * @param issuerName the name of the issuer (this should be letters and numbers only)
5
+ * @param publicKey the public key of the issuer (this should be a hex string)
6
+ * @returns
7
+ */
8
+ declare const createAuthorizationIssuer: (issuerName: string, publicKey: string) => IAuthorizationIssuer;
9
+ export { createAuthorizationIssuer };
10
+ //# sourceMappingURL=create-authorization-issuer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-authorization-issuer.d.ts","sourceRoot":"","sources":["../../../../src/authorization/jwt/sign/create-authorization-issuer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAE1F;;;;;GAKG;AACH,QAAA,MAAM,yBAAyB,eAAgB,MAAM,aAAa,MAAM,KAAG,oBAe1E,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createAuthorizationIssuer = void 0;
4
+ const authorization_errors_1 = require("../../../errors/authorization/authorization-errors");
5
+ const object_validation_helpers_1 = require("../../../helpers/object-validation-helpers");
6
+ /**
7
+ * This function creates an authorization issuer.
8
+ * @param issuerName the name of the issuer (this should be letters and numbers only)
9
+ * @param publicKey the public key of the issuer (this should be a hex string)
10
+ * @returns
11
+ */
12
+ const createAuthorizationIssuer = (issuerName, publicKey) => {
13
+ // make sure the incoming public key is a hex format
14
+ const publicKeyIsHex = (0, object_validation_helpers_1.validateStringHex)(publicKey);
15
+ if (!publicKeyIsHex) { // if the public key is not a valid hex string
16
+ throw new authorization_errors_1.SafeAuthorizationIssuerPublicKeyNotValidError(issuerName, publicKey);
17
+ }
18
+ if (publicKey.length < 8) { // if the public key is less than 8 characters
19
+ throw new authorization_errors_1.SafeAuthorizationIssuerPublicKeyNotValidError(issuerName, publicKey);
20
+ }
21
+ // get the last 8 characters of the public key
22
+ const publicKeyParse = publicKey.slice(-8);
23
+ const authorizationIssuer = `${issuerName}-${publicKeyParse}`;
24
+ return authorizationIssuer;
25
+ };
26
+ exports.createAuthorizationIssuer = createAuthorizationIssuer;
@@ -0,0 +1,12 @@
1
+ import { AuthorizationSubjectStart, IAuthorizationSubject } from '../../../models/authorization/authorization-models';
2
+ /**
3
+ * This creates an authorization subject.
4
+ *
5
+ * @param subjectType the type of the subject
6
+ * @param subjectId the id of the subject (userid, safenetworkid etc.)
7
+ *
8
+ * @returns
9
+ */
10
+ declare const createAuthorizationSubject: (subjectType: AuthorizationSubjectStart, subjectId: string) => IAuthorizationSubject;
11
+ export { createAuthorizationSubject };
12
+ //# sourceMappingURL=create-authorization-subject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-authorization-subject.d.ts","sourceRoot":"","sources":["../../../../src/authorization/jwt/sign/create-authorization-subject.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAEtH;;;;;;;GAOG;AACH,QAAA,MAAM,0BAA0B,gBACf,yBAAyB,aAC3B,MAAM,KAClB,qBAKF,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createAuthorizationSubject = void 0;
4
+ const authorization_errors_1 = require("../../../errors/authorization/authorization-errors");
5
+ /**
6
+ * This creates an authorization subject.
7
+ *
8
+ * @param subjectType the type of the subject
9
+ * @param subjectId the id of the subject (userid, safenetworkid etc.)
10
+ *
11
+ * @returns
12
+ */
13
+ const createAuthorizationSubject = (subjectType, subjectId) => {
14
+ if (!subjectId) {
15
+ throw new authorization_errors_1.SafeAuthorizationSubjectNotValidError(subjectType, subjectId);
16
+ }
17
+ return `${subjectType}:${subjectId}`;
18
+ };
19
+ exports.createAuthorizationSubject = createAuthorizationSubject;
@@ -0,0 +1,17 @@
1
+ import jwt from 'jsonwebtoken';
2
+ import { AuthorizationAudience, IAuthorizationSubject } from '../../../models/authorization/authorization-models';
3
+ /**
4
+ * This function creates the options for the jwt token issuance
5
+ *
6
+ * @param subject the subject of the token
7
+ * @param audience the audience of the token (default is sharedata)
8
+ * @param algorithm the algorithm to use (default is ES512)
9
+ * @param expiresIn the expiration time of the token (default is 1 hour)
10
+ * @param notBefore the not before time of the token (default is 0)
11
+ * @param keyid A unique identifier for the key used to sign the token. This can be used to prevent replay attacks. (optional)
12
+ * @param header An object containing additional header properties to include in the token. (optional)
13
+ * @returns
14
+ */
15
+ declare const createJwtOptions: (subject: IAuthorizationSubject, audience?: AuthorizationAudience | AuthorizationAudience[], algorithm?: jwt.Algorithm, expiresIn?: string | number, notBefore?: string | number, keyid?: string, header?: jwt.JwtHeader) => jwt.SignOptions;
16
+ export { createJwtOptions };
17
+ //# sourceMappingURL=create-jwt-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-jwt-options.d.ts","sourceRoot":"","sources":["../../../../src/authorization/jwt/sign/create-jwt-options.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAGlH;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,gBAAgB,YACT,qBAAqB,aACpB,qBAAqB,GAAG,qBAAqB,EAAE,cAC9C,GAAG,CAAC,SAAS,cACb,MAAM,GAAG,MAAM,cACf,MAAM,GAAG,MAAM,UAClB,MAAM,WACL,GAAG,CAAC,SAAS,KACvB,GAAG,CAAC,WAkBN,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createJwtOptions = void 0;
4
+ const authorization_models_1 = require("../../../models/authorization/authorization-models");
5
+ const authorization_settings_1 = require("../../../_settings/authorization-settings");
6
+ /**
7
+ * This function creates the options for the jwt token issuance
8
+ *
9
+ * @param subject the subject of the token
10
+ * @param audience the audience of the token (default is sharedata)
11
+ * @param algorithm the algorithm to use (default is ES512)
12
+ * @param expiresIn the expiration time of the token (default is 1 hour)
13
+ * @param notBefore the not before time of the token (default is 0)
14
+ * @param keyid A unique identifier for the key used to sign the token. This can be used to prevent replay attacks. (optional)
15
+ * @param header An object containing additional header properties to include in the token. (optional)
16
+ * @returns
17
+ */
18
+ const createJwtOptions = (subject, // the subject of the token
19
+ audience = authorization_models_1.AuthorizationAudience.SHAREDATA, // audience
20
+ algorithm = authorization_settings_1.AuthorizationSettings.JWT.Algorithm, // ECDSA using P-521 curve and SHA-512 hash algorithm
21
+ expiresIn = authorization_settings_1.AuthorizationSettings.JWT.ExpiresInDefault, // Default expiration time
22
+ notBefore = authorization_settings_1.AuthorizationSettings.JWT.NotBeforeDefault, // Default not before time
23
+ keyid, // A unique identifier for the key used to sign the token. This can be used to prevent replay attacks.
24
+ header) => {
25
+ const jwtOptions = {
26
+ subject,
27
+ audience,
28
+ algorithm,
29
+ expiresIn,
30
+ notBefore,
31
+ mutatePayload: authorization_settings_1.AuthorizationSettings.JWT.MutatePayload, // If true, the payload object will be mutated with the standard claims (iat, exp, etc.). Default is false.
32
+ noTimestamp: authorization_settings_1.AuthorizationSettings.JWT.NoTimestamp, // If true, the iat (issued at) claim will not be included in the token.
33
+ encoding: authorization_settings_1.AuthorizationSettings.JWT.EncodingDefault, // The encoding to use when converting the payload to a string.
34
+ allowInsecureKeySizes: authorization_settings_1.AuthorizationSettings.JWT.AllowInsecureKeySizes, // If true, allows the use of insecure key sizes.
35
+ allowInvalidAsymmetricKeyTypes: authorization_settings_1.AuthorizationSettings.JWT.AllowInvalidAsymmetricKeyTypes, // If true, allows the use of invalid asymmetric key types.
36
+ };
37
+ if (keyid)
38
+ jwtOptions.keyid = keyid;
39
+ if (header)
40
+ jwtOptions.header = header;
41
+ return jwtOptions;
42
+ };
43
+ exports.createJwtOptions = createJwtOptions;
@@ -0,0 +1,13 @@
1
+ import { IAuthorizationPayload } from '../../../models/authorization/authorization-models';
2
+ import jwt from 'jsonwebtoken';
3
+ /**
4
+ * This creates a signed JWT token with the given payload and secret key.
5
+ *
6
+ * @param payload the payload to sign
7
+ * @param secretKey the secret key to sign the token with
8
+ * @param options the options for the signed jwt token
9
+ * @returns
10
+ */
11
+ declare const createJWTSignedToken: (payload: IAuthorizationPayload, secretKey: string, options: jwt.SignOptions) => string;
12
+ export { createJWTSignedToken };
13
+ //# sourceMappingURL=create-jwt-signed-token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-jwt-signed-token.d.ts","sourceRoot":"","sources":["../../../../src/authorization/jwt/sign/create-jwt-signed-token.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EACxB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,GAAG,MAAM,cAAc,CAAC;AAG/B;;;;;;;GAOG;AACH,QAAA,MAAM,oBAAoB,YACb,qBAAqB,aACnB,MAAM,WACR,GAAG,CAAC,WAAW,KACzB,MAIF,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createJWTSignedToken = void 0;
7
+ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
8
+ const create_secret_key_pem_1 = require("../keys/create-secret-key-pem");
9
+ /**
10
+ * This creates a signed JWT token with the given payload and secret key.
11
+ *
12
+ * @param payload the payload to sign
13
+ * @param secretKey the secret key to sign the token with
14
+ * @param options the options for the signed jwt token
15
+ * @returns
16
+ */
17
+ const createJWTSignedToken = (payload, secretKey, options) => {
18
+ const jwtKey = (0, create_secret_key_pem_1.createSecretKeyPem)(secretKey);
19
+ const jwtToken = jsonwebtoken_1.default.sign(payload, jwtKey, options);
20
+ return jwtToken;
21
+ };
22
+ exports.createJWTSignedToken = createJWTSignedToken;
@@ -0,0 +1,10 @@
1
+ import { IDecodedJwtToken, IValidSafeTokenPayload } from '../../../models/authorization/authorization-models';
2
+ /**
3
+ * This function transforms the token payload to a safe payload with custom claims (if any).
4
+ *
5
+ * @param payload the payload to transform
6
+ * @returns the safe payload
7
+ */
8
+ declare const transformTokenPayloadToSafePayload: (payload: IValidSafeTokenPayload) => IDecodedJwtToken;
9
+ export { transformTokenPayloadToSafePayload };
10
+ //# sourceMappingURL=transform-token-payload-to-safe-payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-token-payload-to-safe-payload.d.ts","sourceRoot":"","sources":["../../../../src/authorization/jwt/transform/transform-token-payload-to-safe-payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAE9G;;;;;GAKG;AACH,QAAA,MAAM,kCAAkC,YAAa,sBAAsB,KAAG,gBAuB7E,CAAC;AAEF,OAAO,EAAE,kCAAkC,EAAE,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformTokenPayloadToSafePayload = void 0;
4
+ /**
5
+ * This function transforms the token payload to a safe payload with custom claims (if any).
6
+ *
7
+ * @param payload the payload to transform
8
+ * @returns the safe payload
9
+ */
10
+ const transformTokenPayloadToSafePayload = (payload) => {
11
+ // get any other properties from the payload other than the default ones
12
+ const otherProperties = Object.keys(payload).reduce((acc, key) => {
13
+ if (!['iat', 'nbf', 'exp', 'sub', 'aud', 'iss'].includes(key)) {
14
+ acc[key] = payload[key];
15
+ }
16
+ return acc;
17
+ }, {});
18
+ const safePayload = {
19
+ iat: payload.iat,
20
+ nbf: payload.nbf,
21
+ exp: payload.exp,
22
+ sub: payload.sub,
23
+ aud: payload.aud,
24
+ iss: payload.iss,
25
+ };
26
+ if (Object.keys(otherProperties).length > 0) {
27
+ safePayload.customClaims = otherProperties;
28
+ }
29
+ return safePayload;
30
+ };
31
+ exports.transformTokenPayloadToSafePayload = transformTokenPayloadToSafePayload;
@@ -0,0 +1,10 @@
1
+ import { IAuthorizationHeader } from '../../../models/authorization/authorization-models';
2
+ /**
3
+ * This function gets the decoded jwt header from the token.
4
+ *
5
+ * @param token the token to get the header from.
6
+ * @returns
7
+ */
8
+ declare const getDecodedJwtHeader: (token: string) => IAuthorizationHeader;
9
+ export { getDecodedJwtHeader };
10
+ //# sourceMappingURL=get-decoded-jwt-header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-decoded-jwt-header.d.ts","sourceRoot":"","sources":["../../../../src/authorization/jwt/verify/get-decoded-jwt-header.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAE1F;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,UAAW,MAAM,KAAG,oBAU5C,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDecodedJwtHeader = void 0;
4
+ const authorization_errors_1 = require("../../../errors/authorization/authorization-errors");
5
+ /**
6
+ * This function gets the decoded jwt header from the token.
7
+ *
8
+ * @param token the token to get the header from.
9
+ * @returns
10
+ */
11
+ const getDecodedJwtHeader = (token) => {
12
+ // break the token apart
13
+ const jwtTokenParts = token.split('.');
14
+ if (jwtTokenParts.length !== 3) {
15
+ throw new authorization_errors_1.SafeAuthorizationTokenNotBase64Error();
16
+ }
17
+ const header = JSON.parse(Buffer.from(jwtTokenParts[0], 'base64').toString('utf-8'));
18
+ return header;
19
+ };
20
+ exports.getDecodedJwtHeader = getDecodedJwtHeader;
@@ -0,0 +1,9 @@
1
+ import { JwtPayload } from 'jsonwebtoken';
2
+ /**
3
+ * This function gets the decoded payload from a signed JWT token.
4
+ *
5
+ * @param token the token to get the payload from
6
+ */
7
+ declare const getDecodedJwtSignedTokenPayload: (token: string) => JwtPayload | null | string;
8
+ export { getDecodedJwtSignedTokenPayload };
9
+ //# sourceMappingURL=get-decoded-jwt-signed-token-payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-decoded-jwt-signed-token-payload.d.ts","sourceRoot":"","sources":["../../../../src/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.ts"],"names":[],"mappings":"AAAA,OAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;;;GAIG;AACH,QAAA,MAAM,+BAA+B,UAAW,MAAM,KAAG,UAAU,GAAG,IAAI,GAAG,MAG5E,CAAC;AAEF,OAAO,EAAE,+BAA+B,EAAE,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getDecodedJwtSignedTokenPayload = void 0;
7
+ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
8
+ /**
9
+ * This function gets the decoded payload from a signed JWT token.
10
+ *
11
+ * @param token the token to get the payload from
12
+ */
13
+ const getDecodedJwtSignedTokenPayload = (token) => {
14
+ const payload = jsonwebtoken_1.default.decode(token);
15
+ return payload;
16
+ };
17
+ exports.getDecodedJwtSignedTokenPayload = getDecodedJwtSignedTokenPayload;
@@ -0,0 +1,12 @@
1
+ import jwt from 'jsonwebtoken';
2
+ /**
3
+ * This verifies a JWT signed token with the given secret key or public key.
4
+ *
5
+ * @param tokenToVerify the jwt token to verify
6
+ * @param secretKey the secret key to verify the token with
7
+ * @param publicKey the public key to verify the token with
8
+ * @returns
9
+ */
10
+ declare const verifyJwtSignedToken: (tokenToVerify: string, secretKey?: string, publicKey?: string) => string | jwt.JwtPayload;
11
+ export { verifyJwtSignedToken };
12
+ //# sourceMappingURL=verify-jwt-signed-token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-jwt-signed-token.d.ts","sourceRoot":"","sources":["../../../../src/authorization/jwt/verify/verify-jwt-signed-token.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,cAAc,CAAC;AAQ/B;;;;;;;GAOG;AACH,QAAA,MAAM,oBAAoB,kBACP,MAAM,cACT,MAAM,cACN,MAAM,KACnB,MAAM,GAAG,GAAG,CAAC,UAgBf,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}