@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,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.verifyTokenPayload = void 0;
4
+ const authorization_errors_1 = require("../../../../errors/authorization/authorization-errors");
5
+ const verify_authorization_issuer_1 = require("./payload/verify-authorization-issuer");
6
+ const verify_authorization_subject_1 = require("./payload/verify-authorization-subject");
7
+ const verify_authorization_audience_1 = require("./payload/verify-authorization-audience");
8
+ const verify_authorization_not_before_time_1 = require("./payload/verify-authorization-not-before-time");
9
+ const verify_authorization_expiration_time_1 = require("./payload/verify-authorization-expiration-time");
10
+ const verify_authorization_issued_at_time_1 = require("./payload/verify-authorization-issued-at-time");
11
+ /**
12
+ * This function verifies the payload of the token to have the minimum token information from the decoded token payload.
13
+ *
14
+ * @param payload the payload to verify
15
+ * @returns void (throws an error if the payload is not valid)
16
+ */
17
+ const verifyTokenPayload = (payload) => {
18
+ if (!payload || typeof payload !== 'object') {
19
+ throw new authorization_errors_1.SafeAuthorizationPayloadNotValidError();
20
+ }
21
+ // make sure the issued at time is a valid
22
+ (0, verify_authorization_issued_at_time_1.verifyAuthorizationIssuedAtTime)(payload.iat);
23
+ (0, verify_authorization_not_before_time_1.verifyAuthorizationNotBeforeTime)(payload.nbf);
24
+ (0, verify_authorization_expiration_time_1.verifyAuthorizationExpirationTime)(payload.exp);
25
+ (0, verify_authorization_subject_1.verifyAuthorizationSubject)(payload.sub);
26
+ (0, verify_authorization_audience_1.verifyAuthorizationAudience)(payload.aud);
27
+ (0, verify_authorization_issuer_1.verifyAuthorizationIssuer)(payload.iss);
28
+ return true;
29
+ };
30
+ exports.verifyTokenPayload = verifyTokenPayload;
@@ -3,6 +3,7 @@ export * from './calculate-combined-hash';
3
3
  export * from './private-public-keys/generation/create-256-private-key-from-mnemonic';
4
4
  export * from './private-public-keys/generation/create-entropy-for-elliptical-curve';
5
5
  export * from './private-public-keys/generation/create-random-256-private-key';
6
+ export * from './private-public-keys/generation/create-random-512-key-pair';
6
7
  export * from './private-public-keys/generation/generate-key-pair';
7
8
  export * from './private-public-keys/generation/get-private-public-key-from-keypair';
8
9
  export * from './private-public-keys/create-key-pair-from-private-key';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/crypto/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAK1C,cAAc,uEAAuE,CAAC;AACtF,cAAc,sEAAsE,CAAC;AACrF,cAAc,gEAAgE,CAAC;AAC/E,cAAc,oDAAoD,CAAC;AACnE,cAAc,sEAAsE,CAAC;AAGrF,cAAc,wDAAwD,CAAC;AACvE,cAAc,qDAAqD,CAAC;AAMpE,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6CAA6C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/crypto/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAK1C,cAAc,uEAAuE,CAAC;AACtF,cAAc,sEAAsE,CAAC;AACrF,cAAc,gEAAgE,CAAC;AAC/E,cAAc,6DAA6D,CAAC;AAC5E,cAAc,oDAAoD,CAAC;AACnE,cAAc,sEAAsE,CAAC;AAGrF,cAAc,wDAAwD,CAAC;AACvE,cAAc,qDAAqD,CAAC;AAMpE,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6CAA6C,CAAC"}
@@ -21,6 +21,7 @@ __exportStar(require("./calculate-combined-hash"), exports);
21
21
  __exportStar(require("./private-public-keys/generation/create-256-private-key-from-mnemonic"), exports);
22
22
  __exportStar(require("./private-public-keys/generation/create-entropy-for-elliptical-curve"), exports);
23
23
  __exportStar(require("./private-public-keys/generation/create-random-256-private-key"), exports);
24
+ __exportStar(require("./private-public-keys/generation/create-random-512-key-pair"), exports);
24
25
  __exportStar(require("./private-public-keys/generation/generate-key-pair"), exports);
25
26
  __exportStar(require("./private-public-keys/generation/get-private-public-key-from-keypair"), exports);
26
27
  //#endregion folder generation
@@ -1 +1 @@
1
- {"version":3,"file":"create-key-pair-from-private-key.d.ts","sourceRoot":"","sources":["../../../src/crypto/private-public-keys/create-key-pair-from-private-key.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAE5G;;;;;GAKG;AACH,QAAA,MAAM,2BAA2B,UAAW,uBAAuB,GAAG,0BAA0B,cAChF,MAAM,KAAG,QAAQ,CAAC,EAAE,CAAC,OAMpC,CAAC;AAEF,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
1
+ {"version":3,"file":"create-key-pair-from-private-key.d.ts","sourceRoot":"","sources":["../../../src/crypto/private-public-keys/create-key-pair-from-private-key.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAE5G;;;;;GAKG;AACH,QAAA,MAAM,2BAA2B,UAAW,uBAAuB,GAAG,0BAA0B,cAChF,MAAM,KAAG,QAAQ,CAAC,EAAE,CAAC,OAKpC,CAAC;AAEF,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Generates a random private key from the mnemonic phrase.
2
+ * This function generates a random mnemonic phrase and creates a private key from it. (256 Bits)
3
3
  *
4
4
  * @returns A random private key as a hexadecimal string.
5
5
  */
@@ -28,7 +28,7 @@ const crypto = __importStar(require("crypto"));
28
28
  const bip39 = __importStar(require("bip39"));
29
29
  const cryptography_settings_1 = require("../../../_settings/cryptography-settings");
30
30
  /**
31
- * Generates a random private key from the mnemonic phrase.
31
+ * This function generates a random mnemonic phrase and creates a private key from it. (256 Bits)
32
32
  *
33
33
  * @returns A random private key as a hexadecimal string.
34
34
  */
@@ -3,7 +3,7 @@ import { EllipticalCurvesEncryption, EllipticalCurvesSigning } from '../../../_s
3
3
  * Creates entropy for an elliptical curve.
4
4
  *
5
5
  * @param signingCurve - The elliptical curve to create entropy for.
6
- * @returns The entropy for the elliptical curve.
6
+ * @returns The entropy for the elliptical curve. string in hexadecimal format.
7
7
  */
8
8
  declare const createEntropyForEllipitalCurve: (curve: EllipticalCurvesSigning | EllipticalCurvesEncryption) => string;
9
9
  export { createEntropyForEllipitalCurve };
@@ -1 +1 @@
1
- {"version":3,"file":"create-entropy-for-elliptical-curve.d.ts","sourceRoot":"","sources":["../../../../src/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAG/G;;;;;GAKG;AACH,QAAA,MAAM,8BAA8B,UAAW,uBAAuB,GAAG,0BAA0B,KAAG,MAOrG,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
1
+ {"version":3,"file":"create-entropy-for-elliptical-curve.d.ts","sourceRoot":"","sources":["../../../../src/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAG/G;;;;;GAKG;AACH,QAAA,MAAM,8BAA8B,UAAW,uBAAuB,GAAG,0BAA0B,KAAG,MAQrG,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
@@ -29,12 +29,13 @@ const Elliptic = __importStar(require("elliptic"));
29
29
  * Creates entropy for an elliptical curve.
30
30
  *
31
31
  * @param signingCurve - The elliptical curve to create entropy for.
32
- * @returns The entropy for the elliptical curve.
32
+ * @returns The entropy for the elliptical curve. string in hexadecimal format.
33
33
  */
34
34
  const createEntropyForEllipitalCurve = (curve) => {
35
35
  const ecKey = new Elliptic.ec(curve);
36
36
  const hashStrength = ecKey.hash.hmacStrength;
37
37
  const entropy = Elliptic.rand(hashStrength);
38
- return entropy;
38
+ const entropyHex = entropy.toString('hex');
39
+ return entropyHex;
39
40
  };
40
41
  exports.createEntropyForEllipitalCurve = createEntropyForEllipitalCurve;
@@ -0,0 +1,9 @@
1
+ import { IPublicPrivateKeyDerPair } from '../../../models/crypto/crypto-models';
2
+ /**
3
+ * This function creates a random key pair using the crypto library for the P521 curve.
4
+ *
5
+ * @returns the private and public key in DER format.
6
+ */
7
+ declare const createRandom512KeyPair: () => IPublicPrivateKeyDerPair;
8
+ export { createRandom512KeyPair };
9
+ //# sourceMappingURL=create-random-512-key-pair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-random-512-key-pair.d.ts","sourceRoot":"","sources":["../../../../src/crypto/private-public-keys/generation/create-random-512-key-pair.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAGhF;;;;GAIG;AACH,QAAA,MAAM,sBAAsB,QAAO,wBAelC,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
@@ -0,0 +1,46 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.createRandom512KeyPair = void 0;
27
+ const crypto = __importStar(require("crypto"));
28
+ const cryptography_settings_1 = require("../../../_settings/cryptography-settings");
29
+ /**
30
+ * This function creates a random key pair using the crypto library for the P521 curve.
31
+ *
32
+ * @returns the private and public key in DER format.
33
+ */
34
+ const createRandom512KeyPair = () => {
35
+ const curve = 'secp521r1'; // P521 curve
36
+ const { publicKey, privateKey } = crypto.generateKeyPairSync('ec', { namedCurve: curve }); // Generate the key pair
37
+ const privateKeyDer = privateKey.export({ format: cryptography_settings_1.keyExportFormatDer, type: cryptography_settings_1.sec1KeyExportType })
38
+ .toString(cryptography_settings_1.base64Encoding); // Export the private key to base64
39
+ const publicKeyDer = publicKey.export({ format: cryptography_settings_1.keyExportFormatDer, type: cryptography_settings_1.spkiKeyExportType })
40
+ .toString(cryptography_settings_1.base64Encoding); // Export the public key to base64
41
+ return {
42
+ privateKeyDer,
43
+ publicKeyDer,
44
+ };
45
+ };
46
+ exports.createRandom512KeyPair = createRandom512KeyPair;
@@ -0,0 +1,106 @@
1
+ import { AuthorityValidationType } from '../../models/authorization/authorization-models';
2
+ import { BaseError } from '../base-error';
3
+ /**
4
+ * This is thrown when the removal of a IJWTAuthority fails because it does not exist.
5
+ */
6
+ export declare class SafeAuthorizationIssuerDoesNotExistError extends BaseError {
7
+ constructor(issuer: string);
8
+ }
9
+ /**
10
+ * This is thrown when a authority validation request is received the type of validation requested is unknown.
11
+ * (this should not happen).
12
+ */
13
+ export declare class SafeAuthorizationAuthorityValidationTypeNotValidError extends BaseError {
14
+ constructor(validationType: AuthorityValidationType);
15
+ }
16
+ /**
17
+ * This is throw when a database records is not found.
18
+ */
19
+ export declare class SafeAuthorizationSubjectNotValidError extends BaseError {
20
+ constructor(subjectType: string, subjectId: string);
21
+ }
22
+ /**
23
+ * This is thrown when the public key given for the issuer is not valid.
24
+ */
25
+ export declare class SafeAuthorizationIssuerPublicKeyNotValidError extends BaseError {
26
+ constructor(issuerName: string, publicKey: string);
27
+ }
28
+ /**
29
+ * This is thrown when the issuer is not valid.
30
+ */
31
+ export declare class SafeAuthorizationIssuerNotValidError extends BaseError {
32
+ constructor(issuer: string);
33
+ }
34
+ /**
35
+ * This is thrown when the JWT token is not the corrent base64 encoding
36
+ */
37
+ export declare class SafeAuthorizationTokenNotBase64Error extends BaseError {
38
+ constructor();
39
+ }
40
+ /**
41
+ * This is thrown when the secret key or public key is not included for token verification.
42
+ */
43
+ export declare class SafeAuthorizationKeyNotIncludedForVerificationError extends BaseError {
44
+ constructor();
45
+ }
46
+ /**
47
+ * This is thrown when the authorization payload is not valid.
48
+ */
49
+ export declare class SafeAuthorizationPayloadNotValidError extends BaseError {
50
+ constructor();
51
+ }
52
+ /**
53
+ * This is thrown when the type of data in a token is not valid
54
+ */
55
+ export declare class SafeAuthorizationTokenPropertyDataTypeNotValidError extends BaseError {
56
+ constructor(property: string, propertyValue: any, expectedDataType: string);
57
+ }
58
+ /**
59
+ * This is thrown when the authorization payload is missing a property
60
+ */
61
+ export declare class SafeAuthorizationMissingPropertyError extends BaseError {
62
+ constructor(property: string);
63
+ }
64
+ /**
65
+ * This is thrown when the issued at time is before the current time
66
+ */
67
+ export declare class SafeAuthorizationTokenIssuedAtTimeNotValidError extends BaseError {
68
+ constructor();
69
+ }
70
+ /**
71
+ * This is thrown not authorization exists on the request.
72
+ */
73
+ export declare class SafeAuthorizationNotExistsError extends BaseError {
74
+ constructor();
75
+ }
76
+ /**
77
+ * This is thrown when the bearer token is not found
78
+ */
79
+ export declare class SafeAuthorizationBearerTokenNotFound extends BaseError {
80
+ constructor();
81
+ }
82
+ /**
83
+ * This is thrown when the authorization request headers are not found.
84
+ */
85
+ export declare class SafeRequestAuthorizationHeadersNotFound extends BaseError {
86
+ constructor();
87
+ }
88
+ /**
89
+ * This is thrown when the authorization is not found in the request headers.
90
+ */
91
+ export declare class SafeRequestAuthorizationHeaderNotFound extends BaseError {
92
+ constructor();
93
+ }
94
+ /**
95
+ * This is thrown when the Issuer does not match the expected issuer.
96
+ */
97
+ export declare class SafeAuthorizationIssuerNotMatchingExpectedError extends BaseError {
98
+ constructor(expectedIssuer: string, actualIssuer: string);
99
+ }
100
+ /**
101
+ * This is thrown when the decoded token null or a string (not an object)
102
+ */
103
+ export declare class SafeAuthorizationTokenNotObjectError extends BaseError {
104
+ constructor();
105
+ }
106
+ //# sourceMappingURL=authorization-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization-errors.d.ts","sourceRoot":"","sources":["../../../src/errors/authorization/authorization-errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;GAEG;AACH,qBAAa,wCAAyC,SAAQ,SAAS;gBACvD,MAAM,EAAE,MAAM;CAG7B;AAED;;;GAGG;AACH,qBAAa,qDAAsD,SAAQ,SAAS;gBACpE,cAAc,EAAE,uBAAuB;CAGtD;AAED;;GAEG;AACH,qBAAa,qCAAsC,SAAQ,SAAS;gBACpD,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAGrD;AAED;;GAEG;AACH,qBAAa,6CAA8C,SAAQ,SAAS;gBAC5D,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAGpD;AAED;;GAEG;AACH,qBAAa,oCAAqC,SAAQ,SAAS;gBACnD,MAAM,EAAE,MAAM;CAG7B;AAED;;GAEG;AACH,qBAAa,oCAAqC,SAAQ,SAAS;;CAIlE;AAED;;GAEG;AACH,qBAAa,mDAAoD,SAAQ,SAAS;;CAIjF;AAED;;GAEG;AACH,qBAAa,qCAAsC,SAAQ,SAAS;;CAInE;AAED;;GAEG;AACH,qBAAa,mDAAoD,SAAQ,SAAS;gBAClE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM;CAG7E;AAED;;GAEG;AACH,qBAAa,qCAAsC,SAAQ,SAAS;gBACpD,QAAQ,EAAE,MAAM;CAG/B;AAED;;GAEG;AACH,qBAAa,+CAAgD,SAAQ,SAAS;;CAI7E;AAED;;GAEG;AACH,qBAAa,+BAAgC,SAAQ,SAAS;;CAI7D;AAED;;GAEG;AACH,qBAAa,oCAAqC,SAAQ,SAAS;;CAIlE;AAKD;;GAEG;AACH,qBAAa,uCAAwC,SAAQ,SAAS;;CAIrE;AAED;;GAEG;AACH,qBAAa,sCAAuC,SAAQ,SAAS;;CAIpE;AAED;;GAEG;AACH,qBAAa,+CAAgD,SAAQ,SAAS;gBAC9D,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;CAG3D;AAED;;GAEG;AACH,qBAAa,oCAAqC,SAAQ,SAAS;;CAIlE"}
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SafeAuthorizationTokenNotObjectError = exports.SafeAuthorizationIssuerNotMatchingExpectedError = exports.SafeRequestAuthorizationHeaderNotFound = exports.SafeRequestAuthorizationHeadersNotFound = exports.SafeAuthorizationBearerTokenNotFound = exports.SafeAuthorizationNotExistsError = exports.SafeAuthorizationTokenIssuedAtTimeNotValidError = exports.SafeAuthorizationMissingPropertyError = exports.SafeAuthorizationTokenPropertyDataTypeNotValidError = exports.SafeAuthorizationPayloadNotValidError = exports.SafeAuthorizationKeyNotIncludedForVerificationError = exports.SafeAuthorizationTokenNotBase64Error = exports.SafeAuthorizationIssuerNotValidError = exports.SafeAuthorizationIssuerPublicKeyNotValidError = exports.SafeAuthorizationSubjectNotValidError = exports.SafeAuthorizationAuthorityValidationTypeNotValidError = exports.SafeAuthorizationIssuerDoesNotExistError = void 0;
4
+ const base_error_1 = require("../base-error");
5
+ /**
6
+ * This is thrown when the removal of a IJWTAuthority fails because it does not exist.
7
+ */
8
+ class SafeAuthorizationIssuerDoesNotExistError extends base_error_1.BaseError {
9
+ constructor(issuer) {
10
+ super(`The authorization issuer ${issuer} does not exist`);
11
+ }
12
+ }
13
+ exports.SafeAuthorizationIssuerDoesNotExistError = SafeAuthorizationIssuerDoesNotExistError;
14
+ /**
15
+ * This is thrown when a authority validation request is received the type of validation requested is unknown.
16
+ * (this should not happen).
17
+ */
18
+ class SafeAuthorizationAuthorityValidationTypeNotValidError extends base_error_1.BaseError {
19
+ constructor(validationType) {
20
+ super(`The authority validation type is not valid, the type is ${validationType}`);
21
+ }
22
+ }
23
+ exports.SafeAuthorizationAuthorityValidationTypeNotValidError = SafeAuthorizationAuthorityValidationTypeNotValidError;
24
+ /**
25
+ * This is throw when a database records is not found.
26
+ */
27
+ class SafeAuthorizationSubjectNotValidError extends base_error_1.BaseError {
28
+ constructor(subjectType, subjectId) {
29
+ super(`The authorization subject ${subjectType} with id ${subjectId} is not valid`);
30
+ }
31
+ }
32
+ exports.SafeAuthorizationSubjectNotValidError = SafeAuthorizationSubjectNotValidError;
33
+ /**
34
+ * This is thrown when the public key given for the issuer is not valid.
35
+ */
36
+ class SafeAuthorizationIssuerPublicKeyNotValidError extends base_error_1.BaseError {
37
+ constructor(issuerName, publicKey) {
38
+ super(`The authorization issuer ${issuerName} with public key ${publicKey} is not valid`);
39
+ }
40
+ }
41
+ exports.SafeAuthorizationIssuerPublicKeyNotValidError = SafeAuthorizationIssuerPublicKeyNotValidError;
42
+ /**
43
+ * This is thrown when the issuer is not valid.
44
+ */
45
+ class SafeAuthorizationIssuerNotValidError extends base_error_1.BaseError {
46
+ constructor(issuer) {
47
+ super(`The authorization issuer ${issuer} is not valid`);
48
+ }
49
+ }
50
+ exports.SafeAuthorizationIssuerNotValidError = SafeAuthorizationIssuerNotValidError;
51
+ /**
52
+ * This is thrown when the JWT token is not the corrent base64 encoding
53
+ */
54
+ class SafeAuthorizationTokenNotBase64Error extends base_error_1.BaseError {
55
+ constructor() {
56
+ super('The authorization token is not a valid base64 encoding');
57
+ }
58
+ }
59
+ exports.SafeAuthorizationTokenNotBase64Error = SafeAuthorizationTokenNotBase64Error;
60
+ /**
61
+ * This is thrown when the secret key or public key is not included for token verification.
62
+ */
63
+ class SafeAuthorizationKeyNotIncludedForVerificationError extends base_error_1.BaseError {
64
+ constructor() {
65
+ super('The secret of public key is not included for token verification');
66
+ }
67
+ }
68
+ exports.SafeAuthorizationKeyNotIncludedForVerificationError = SafeAuthorizationKeyNotIncludedForVerificationError;
69
+ /**
70
+ * This is thrown when the authorization payload is not valid.
71
+ */
72
+ class SafeAuthorizationPayloadNotValidError extends base_error_1.BaseError {
73
+ constructor() {
74
+ super('The authorization payload is not valid');
75
+ }
76
+ }
77
+ exports.SafeAuthorizationPayloadNotValidError = SafeAuthorizationPayloadNotValidError;
78
+ /**
79
+ * This is thrown when the type of data in a token is not valid
80
+ */
81
+ class SafeAuthorizationTokenPropertyDataTypeNotValidError extends base_error_1.BaseError {
82
+ constructor(property, propertyValue, expectedDataType) {
83
+ super(`The property ${property} with value ${propertyValue} is not a valid ${expectedDataType}`);
84
+ }
85
+ }
86
+ exports.SafeAuthorizationTokenPropertyDataTypeNotValidError = SafeAuthorizationTokenPropertyDataTypeNotValidError;
87
+ /**
88
+ * This is thrown when the authorization payload is missing a property
89
+ */
90
+ class SafeAuthorizationMissingPropertyError extends base_error_1.BaseError {
91
+ constructor(property) {
92
+ super(`The authorization payload is missing the property ${property}`);
93
+ }
94
+ }
95
+ exports.SafeAuthorizationMissingPropertyError = SafeAuthorizationMissingPropertyError;
96
+ /**
97
+ * This is thrown when the issued at time is before the current time
98
+ */
99
+ class SafeAuthorizationTokenIssuedAtTimeNotValidError extends base_error_1.BaseError {
100
+ constructor() {
101
+ super('The issued at time of the token is not valid: ');
102
+ }
103
+ }
104
+ exports.SafeAuthorizationTokenIssuedAtTimeNotValidError = SafeAuthorizationTokenIssuedAtTimeNotValidError;
105
+ /**
106
+ * This is thrown not authorization exists on the request.
107
+ */
108
+ class SafeAuthorizationNotExistsError extends base_error_1.BaseError {
109
+ constructor() {
110
+ super('The authorization does not exist');
111
+ }
112
+ }
113
+ exports.SafeAuthorizationNotExistsError = SafeAuthorizationNotExistsError;
114
+ /**
115
+ * This is thrown when the bearer token is not found
116
+ */
117
+ class SafeAuthorizationBearerTokenNotFound extends base_error_1.BaseError {
118
+ constructor() {
119
+ super('The bearer token is not found');
120
+ }
121
+ }
122
+ exports.SafeAuthorizationBearerTokenNotFound = SafeAuthorizationBearerTokenNotFound;
123
+ //#region Safe Request Authorization Errors
124
+ /**
125
+ * This is thrown when the authorization request headers are not found.
126
+ */
127
+ class SafeRequestAuthorizationHeadersNotFound extends base_error_1.BaseError {
128
+ constructor() {
129
+ super('The authorization request headers are not found');
130
+ }
131
+ }
132
+ exports.SafeRequestAuthorizationHeadersNotFound = SafeRequestAuthorizationHeadersNotFound;
133
+ /**
134
+ * This is thrown when the authorization is not found in the request headers.
135
+ */
136
+ class SafeRequestAuthorizationHeaderNotFound extends base_error_1.BaseError {
137
+ constructor() {
138
+ super('The authorization header is not found');
139
+ }
140
+ }
141
+ exports.SafeRequestAuthorizationHeaderNotFound = SafeRequestAuthorizationHeaderNotFound;
142
+ /**
143
+ * This is thrown when the Issuer does not match the expected issuer.
144
+ */
145
+ class SafeAuthorizationIssuerNotMatchingExpectedError extends base_error_1.BaseError {
146
+ constructor(expectedIssuer, actualIssuer) {
147
+ super(`The expected issuer ${expectedIssuer} does not match the actual issuer ${actualIssuer}`);
148
+ }
149
+ }
150
+ exports.SafeAuthorizationIssuerNotMatchingExpectedError = SafeAuthorizationIssuerNotMatchingExpectedError;
151
+ /**
152
+ * This is thrown when the decoded token null or a string (not an object)
153
+ */
154
+ class SafeAuthorizationTokenNotObjectError extends base_error_1.BaseError {
155
+ constructor() {
156
+ super('The decoded token is not an object');
157
+ }
158
+ }
159
+ exports.SafeAuthorizationTokenNotObjectError = SafeAuthorizationTokenNotObjectError;
160
+ //#endregion Safe Request Authorization Errors
@@ -1,4 +1,5 @@
1
1
  export * from './audit-log/audit-log-errors';
2
+ export * from './authorization/authorization-errors';
2
3
  export * from './database/database-errors';
3
4
  export * from './generic/generic-errors';
4
5
  export * from './request/request-errors';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAG/C,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAG/C,cAAc,cAAc,CAAC"}
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./audit-log/audit-log-errors"), exports);
18
+ __exportStar(require("./authorization/authorization-errors"), exports);
18
19
  __exportStar(require("./database/database-errors"), exports);
19
20
  __exportStar(require("./generic/generic-errors"), exports);
20
21
  __exportStar(require("./request/request-errors"), exports);
@@ -0,0 +1,37 @@
1
+ /**
2
+ * this function converts a hex string to a base64 string.
3
+ *
4
+ * @param hex the hex string to convert to base64
5
+ * @returns
6
+ */
7
+ declare const hexToBase64: (hexString: string) => string;
8
+ /**
9
+ * this function converts a base64 string to a hex string.
10
+ *
11
+ * @param base64 the base64 string to convert to hex
12
+ * @returns
13
+ */
14
+ declare const base64ToHex: (base64String: string) => string;
15
+ /**
16
+ * this function converts a base64 string to a PEM string for a public key.
17
+ *
18
+ * @param base64 the base64 string to convert to PEM format.
19
+ * @returns
20
+ */
21
+ declare const base64ToPublicPEM: (base64: string) => string;
22
+ /**
23
+ * this function converts a base64 string to a PEM string for an elliptical curve private key.
24
+ *
25
+ * @param base64 the base64 string to convert to PEM format.
26
+ * @returns
27
+ */
28
+ declare const base64ToPrivateECPEM: (base64: string) => string;
29
+ /**
30
+ * this function converts a base64 string to a PEM string for a private key.
31
+ *
32
+ * @param base64 the base64 string to convert to PEM format.
33
+ * @returns
34
+ */
35
+ declare const base64ToPrivatePEM: (base64: string) => string;
36
+ export { base64ToHex, base64ToPublicPEM, base64ToPrivateECPEM, base64ToPrivatePEM, hexToBase64, };
37
+ //# sourceMappingURL=cryptography-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cryptography-helpers.d.ts","sourceRoot":"","sources":["../../../src/helpers/crypto/cryptography-helpers.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,QAAA,MAAM,WAAW,cAAe,MAAM,KAAG,MAExC,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,WAAW,iBAAkB,MAAM,KAAG,MAE3C,CAAC;AAIF;;;;;GAKG;AACH,QAAA,MAAM,iBAAiB,WAAY,MAAM,KAAG,MAK3C,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,oBAAoB,WAAY,MAAM,KAAG,MAK9C,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,kBAAkB,WAAY,MAAM,KAAG,MAK5C,CAAC;AAIF,OAAO,EACH,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,WAAW,GACd,CAAC"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ // This file contains the helper functions for cryptography in the application.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.hexToBase64 = exports.base64ToPrivatePEM = exports.base64ToPrivateECPEM = exports.base64ToPublicPEM = exports.base64ToHex = void 0;
5
+ //#region hex to base 64 functions
6
+ /**
7
+ * this function converts a hex string to a base64 string.
8
+ *
9
+ * @param hex the hex string to convert to base64
10
+ * @returns
11
+ */
12
+ const hexToBase64 = (hexString) => {
13
+ return Buffer.from(hexString, 'hex').toString('base64');
14
+ };
15
+ exports.hexToBase64 = hexToBase64;
16
+ /**
17
+ * this function converts a base64 string to a hex string.
18
+ *
19
+ * @param base64 the base64 string to convert to hex
20
+ * @returns
21
+ */
22
+ const base64ToHex = (base64String) => {
23
+ return Buffer.from(base64String, 'base64').toString('hex');
24
+ };
25
+ exports.base64ToHex = base64ToHex;
26
+ //#region base 64 to PEM functions
27
+ /**
28
+ * this function converts a base64 string to a PEM string for a public key.
29
+ *
30
+ * @param base64 the base64 string to convert to PEM format.
31
+ * @returns
32
+ */
33
+ const base64ToPublicPEM = (base64) => {
34
+ // split the base64 into 64 character chunks
35
+ const regex = /.{64}/g;
36
+ const formattedBase64 = base64.replace(regex, '$&\n');
37
+ return `-----BEGIN PUBLIC KEY-----\n${formattedBase64}\n-----END PUBLIC KEY-----`;
38
+ };
39
+ exports.base64ToPublicPEM = base64ToPublicPEM;
40
+ /**
41
+ * this function converts a base64 string to a PEM string for an elliptical curve private key.
42
+ *
43
+ * @param base64 the base64 string to convert to PEM format.
44
+ * @returns
45
+ */
46
+ const base64ToPrivateECPEM = (base64) => {
47
+ // split the base64 into 64 character chunks
48
+ const regex = /.{64}/g;
49
+ const formattedBase64 = base64.replace(regex, '$&\n');
50
+ return `-----BEGIN EC PRIVATE KEY-----\n${formattedBase64}\n-----END EC PRIVATE KEY-----`;
51
+ };
52
+ exports.base64ToPrivateECPEM = base64ToPrivateECPEM;
53
+ /**
54
+ * this function converts a base64 string to a PEM string for a private key.
55
+ *
56
+ * @param base64 the base64 string to convert to PEM format.
57
+ * @returns
58
+ */
59
+ const base64ToPrivatePEM = (base64) => {
60
+ // split the base64 into 64 character chunks
61
+ const regex = /.{64}/g;
62
+ const formattedBase64 = base64.replace(regex, '$&\n');
63
+ return `-----BEGIN PRIVATE KEY-----\n${formattedBase64}\n-----END PRIVATE KEY-----`;
64
+ };
65
+ exports.base64ToPrivatePEM = base64ToPrivatePEM;
@@ -5,6 +5,7 @@ export * from './request/params-object-helpers';
5
5
  export * from './request/query-object-helpers';
6
6
  export * from './request/request-object-helpers';
7
7
  export * from './array/array-helpers';
8
+ export * from './crypto/cryptography-helpers';
8
9
  export * from './data/data-helpers';
9
10
  export * from './file/file-helpers';
10
11
  export * from './lodash/lodash-helpers';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAM5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AAKjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAM5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AAKjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC"}
@@ -26,6 +26,7 @@ __exportStar(require("./request/request-object-helpers"), exports);
26
26
  //#endregion request exports
27
27
  // additional
28
28
  __exportStar(require("./array/array-helpers"), exports);
29
+ __exportStar(require("./crypto/cryptography-helpers"), exports);
29
30
  __exportStar(require("./data/data-helpers"), exports);
30
31
  __exportStar(require("./file/file-helpers"), exports);
31
32
  __exportStar(require("./lodash/lodash-helpers"), exports);
@@ -47,6 +47,13 @@ declare const validateNumber: (incomingObject: unknown, min?: number, max?: numb
47
47
  * @returns whether the shape is valid.
48
48
  */
49
49
  declare const validateString: (incomingObject: unknown, hasNoSpaces?: boolean, undefinedValid?: boolean, emptyStringValid?: boolean) => boolean;
50
+ /**
51
+ * This validates that an incoming object is a valid hex string without spaces.
52
+ *
53
+ * @param incomingObject the object to validate
54
+ * @returns
55
+ */
56
+ declare const validateStringHex: (incomingObject: unknown) => boolean;
50
57
  /**
51
58
  * This validates that an incoming object is a valid URL.
52
59
  *
@@ -55,5 +62,5 @@ declare const validateString: (incomingObject: unknown, hasNoSpaces?: boolean, u
55
62
  * @returns wether it is a valid URL or not
56
63
  */
57
64
  declare const validateUrl: (incomingUrl: unknown, undefinedValid?: boolean) => boolean;
58
- export { validateArray, validateBoolean, validateDate, validateNumber, validateString, validateUrl, };
65
+ export { validateArray, validateBoolean, validateDate, validateNumber, validateString, validateStringHex, validateUrl, };
59
66
  //# sourceMappingURL=object-validation-helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"object-validation-helpers.d.ts","sourceRoot":"","sources":["../../src/helpers/object-validation-helpers.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,QAAA,MAAM,aAAa,mBAAoB,OAAO,0CAAqC,MAAM,KAAG,OAc3F,CAAC;AAEF;;;;;;;GAOG;AACH,QAAA,MAAM,eAAe,mBAAoB,OAAO,+BAA2B,OAS1E,CAAC;AAEF;;;;;;;;GAQG;AACH,QAAA,MAAM,YAAY,mBAAoB,OAAO,8FACP,OAoCrC,CAAC;AAEF;;;;;;;GAOG;AACH,QAAA,MAAM,cAAc,mBAAoB,OAAO,QAAQ,MAAM,QAAQ,MAAM,KAAG,OAU7E,CAAC;AAEF;;;;;;;;;GASG;AACH,QAAA,MAAM,cAAc,mBAAoB,OAAO,kFAA0E,OAiCxH,CAAC;AAEF;;;;;;GAMG;AACH,QAAA,MAAM,WAAW,gBAAiB,OAAO,+BAA2B,OAqBnE,CAAC;AA+CF,OAAO,EACH,aAAa,EACb,eAAe,EACf,YAAY,EACZ,cAAc,EACd,cAAc,EACd,WAAW,GACd,CAAC"}
1
+ {"version":3,"file":"object-validation-helpers.d.ts","sourceRoot":"","sources":["../../src/helpers/object-validation-helpers.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,QAAA,MAAM,aAAa,mBAAoB,OAAO,0CAAqC,MAAM,KAAG,OAc3F,CAAC;AAEF;;;;;;;GAOG;AACH,QAAA,MAAM,eAAe,mBAAoB,OAAO,+BAA2B,OAS1E,CAAC;AAEF;;;;;;;;GAQG;AACH,QAAA,MAAM,YAAY,mBAAoB,OAAO,8FACP,OAoCrC,CAAC;AAEF;;;;;;;GAOG;AACH,QAAA,MAAM,cAAc,mBAAoB,OAAO,QAAQ,MAAM,QAAQ,MAAM,KAAG,OAU7E,CAAC;AAEF;;;;;;;;;GASG;AACH,QAAA,MAAM,cAAc,mBAAoB,OAAO,kFAA0E,OAiCxH,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,iBAAiB,mBAAoB,OAAO,KAAG,OAepD,CAAC;AAEF;;;;;;GAMG;AACH,QAAA,MAAM,WAAW,gBAAiB,OAAO,+BAA2B,OAqBnE,CAAC;AA+CF,OAAO,EACH,aAAa,EACb,eAAe,EACf,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,WAAW,GACd,CAAC"}