@degenerate/endpoints 0.0.3 → 0.0.5
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/dist/endpoints/src/cors/authority/audience/get-set-audiences.d.ts +60 -0
- package/dist/endpoints/src/cors/authority/audience/get-set-audiences.d.ts.map +1 -0
- package/dist/endpoints/src/cors/authority/audience/get-set-audiences.js +90 -0
- package/dist/endpoints/src/cors/authority/jwt/validate-jwt-authorities.d.ts +16 -0
- package/dist/endpoints/src/cors/authority/jwt/validate-jwt-authorities.d.ts.map +1 -0
- package/dist/endpoints/src/cors/authority/jwt/validate-jwt-authorities.js +34 -0
- package/dist/endpoints/src/cors/endpoints/authorities/validate-authorities-transaction.d.ts +30 -0
- package/dist/endpoints/src/cors/endpoints/authorities/validate-authorities-transaction.d.ts.map +1 -0
- package/dist/endpoints/src/cors/endpoints/authorities/validate-authorities-transaction.js +155 -0
- package/dist/endpoints/src/cors/endpoints/helpers/validate-request-body.d.ts +11 -0
- package/dist/endpoints/src/cors/endpoints/helpers/validate-request-body.d.ts.map +1 -0
- package/dist/endpoints/src/cors/endpoints/helpers/validate-request-body.js +32 -0
- package/dist/{cors → endpoints/src/cors}/errors/all-error-handler.d.ts +2 -2
- package/dist/endpoints/src/cors/errors/all-error-handler.d.ts.map +1 -0
- package/dist/{cors → endpoints/src/cors}/errors/all-error-handler.js +1 -0
- package/dist/endpoints/src/cors/errors/bad-request-handler.d.ts +12 -0
- package/dist/endpoints/src/cors/errors/bad-request-handler.d.ts.map +1 -0
- package/dist/{cors → endpoints/src/cors}/errors/bad-request-handler.js +1 -0
- package/dist/endpoints/src/cors/errors/unauthorized-handler.d.ts +12 -0
- package/dist/endpoints/src/cors/errors/unauthorized-handler.d.ts.map +1 -0
- package/dist/{cors → endpoints/src/cors}/errors/unauthorized-handler.js +1 -0
- package/dist/endpoints/src/cors/index.d.ts +13 -0
- package/dist/endpoints/src/cors/index.d.ts.map +1 -0
- package/dist/{cors → endpoints/src/cors}/index.js +11 -0
- package/dist/endpoints/src/cors/routes/authorities.routes.d.ts +2 -0
- package/dist/endpoints/src/cors/routes/authorities.routes.d.ts.map +1 -0
- package/dist/endpoints/src/cors/routes/authorities.routes.js +69 -0
- package/dist/endpoints/src/cors/routes/events.routes.d.ts +2 -0
- package/dist/endpoints/src/cors/routes/events.routes.d.ts.map +1 -0
- package/dist/endpoints/src/cors/routes/events.routes.js +56 -0
- package/dist/endpoints/src/cors/routes/functions.routes.d.ts +2 -0
- package/dist/endpoints/src/cors/routes/functions.routes.d.ts.map +1 -0
- package/dist/endpoints/src/cors/routes/functions.routes.js +56 -0
- package/dist/endpoints/src/cors/routes/rules.routes.d.ts +2 -0
- package/dist/endpoints/src/cors/routes/rules.routes.d.ts.map +1 -0
- package/dist/endpoints/src/cors/routes/rules.routes.js +56 -0
- package/dist/endpoints/src/cors/routes/share-data.routes.d.ts +2 -0
- package/dist/endpoints/src/cors/routes/share-data.routes.d.ts.map +1 -0
- package/dist/endpoints/src/cors/routes/share-data.routes.js +56 -0
- package/dist/endpoints/src/examples/express-server/app.d.ts +3 -0
- package/dist/endpoints/src/examples/express-server/app.d.ts.map +1 -0
- package/dist/endpoints/src/examples/express-server/app.js +29 -0
- package/dist/endpoints/src/examples/express-server/server.d.ts +2 -0
- package/dist/endpoints/src/examples/express-server/server.d.ts.map +1 -0
- package/dist/endpoints/src/examples/express-server/server.js +9 -0
- package/dist/{index.d.ts.map → endpoints/src/index.d.ts.map} +1 -1
- package/dist/generic/src/_settings/authorization-settings.d.ts +17 -0
- package/dist/generic/src/_settings/authorization-settings.d.ts.map +1 -0
- package/dist/generic/src/_settings/authorization-settings.js +20 -0
- package/dist/generic/src/authorization/index.d.ts +24 -0
- package/dist/generic/src/authorization/index.d.ts.map +1 -0
- package/dist/generic/src/authorization/index.js +61 -0
- package/dist/generic/src/authorization/jwt/keys/create-public-key-pem.d.ts +9 -0
- package/dist/generic/src/authorization/jwt/keys/create-public-key-pem.d.ts.map +1 -0
- package/dist/generic/src/authorization/jwt/keys/create-public-key-pem.js +25 -0
- package/dist/generic/src/authorization/jwt/keys/create-secret-key-pem.d.ts +9 -0
- package/dist/generic/src/authorization/jwt/keys/create-secret-key-pem.d.ts.map +1 -0
- package/dist/generic/src/authorization/jwt/keys/create-secret-key-pem.js +24 -0
- package/dist/generic/src/authorization/jwt/sign/create-authorization-issuer.d.ts +10 -0
- package/dist/generic/src/authorization/jwt/sign/create-authorization-issuer.d.ts.map +1 -0
- package/dist/generic/src/authorization/jwt/sign/create-authorization-issuer.js +26 -0
- package/dist/generic/src/authorization/jwt/sign/create-authorization-subject.d.ts +12 -0
- package/dist/generic/src/authorization/jwt/sign/create-authorization-subject.d.ts.map +1 -0
- package/dist/generic/src/authorization/jwt/sign/create-authorization-subject.js +19 -0
- package/dist/generic/src/authorization/jwt/sign/create-jwt-options.d.ts +17 -0
- package/dist/generic/src/authorization/jwt/sign/create-jwt-options.d.ts.map +1 -0
- package/dist/generic/src/authorization/jwt/sign/create-jwt-options.js +43 -0
- package/dist/generic/src/authorization/jwt/sign/create-jwt-signed-token.d.ts +13 -0
- package/dist/generic/src/authorization/jwt/sign/create-jwt-signed-token.d.ts.map +1 -0
- package/dist/generic/src/authorization/jwt/sign/create-jwt-signed-token.js +22 -0
- package/dist/generic/src/authorization/jwt/transform/transform-token-payload-to-safe-payload.d.ts +10 -0
- package/dist/generic/src/authorization/jwt/transform/transform-token-payload-to-safe-payload.d.ts.map +1 -0
- package/dist/generic/src/authorization/jwt/transform/transform-token-payload-to-safe-payload.js +31 -0
- package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-header.d.ts +10 -0
- package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-header.d.ts.map +1 -0
- package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-header.js +20 -0
- package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.d.ts +9 -0
- package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.d.ts.map +1 -0
- package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.js +17 -0
- package/dist/generic/src/authorization/jwt/verify/verify-jwt-signed-token.d.ts +12 -0
- package/dist/generic/src/authorization/jwt/verify/verify-jwt-signed-token.d.ts.map +1 -0
- package/dist/generic/src/authorization/jwt/verify/verify-jwt-signed-token.js +34 -0
- package/dist/generic/src/authorization/safe/authorization/authorized-authorities.d.ts +42 -0
- package/dist/generic/src/authorization/safe/authorization/authorized-authorities.d.ts.map +1 -0
- package/dist/generic/src/authorization/safe/authorization/authorized-authorities.js +65 -0
- package/dist/generic/src/authorization/safe/request/decode-bearer-token.d.ts +11 -0
- package/dist/generic/src/authorization/safe/request/decode-bearer-token.d.ts.map +1 -0
- package/dist/generic/src/authorization/safe/request/decode-bearer-token.js +31 -0
- package/dist/generic/src/authorization/safe/request/decode-safe-request.d.ts +11 -0
- package/dist/generic/src/authorization/safe/request/decode-safe-request.d.ts.map +1 -0
- package/dist/generic/src/authorization/safe/request/decode-safe-request.js +30 -0
- package/dist/generic/src/authorization/safe/request/determine-issuer-from-request.d.ts +10 -0
- package/dist/generic/src/authorization/safe/request/determine-issuer-from-request.d.ts.map +1 -0
- package/dist/generic/src/authorization/safe/request/determine-issuer-from-request.js +29 -0
- package/dist/generic/src/authorization/safe/request/issuer/determine-issuer-from-bearer-token.d.ts +12 -0
- package/dist/generic/src/authorization/safe/request/issuer/determine-issuer-from-bearer-token.d.ts.map +1 -0
- package/dist/generic/src/authorization/safe/request/issuer/determine-issuer-from-bearer-token.js +30 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-audience.d.ts +10 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-audience.d.ts.map +1 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-audience.js +24 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.d.ts +8 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.d.ts.map +1 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.js +23 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.d.ts +9 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.d.ts.map +1 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.js +24 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issuer.d.ts +10 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issuer.d.ts.map +1 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issuer.js +25 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.d.ts +8 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.d.ts.map +1 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.js +23 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts +10 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts.map +1 -0
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-subject.js +22 -0
- package/dist/generic/src/authorization/safe/validation/jwt/verify-token-header.d.ts +9 -0
- package/dist/generic/src/authorization/safe/validation/jwt/verify-token-header.d.ts.map +1 -0
- package/dist/generic/src/authorization/safe/validation/jwt/verify-token-header.js +25 -0
- package/dist/generic/src/authorization/safe/validation/jwt/verify-token-payload.d.ts +11 -0
- package/dist/generic/src/authorization/safe/validation/jwt/verify-token-payload.d.ts.map +1 -0
- package/dist/generic/src/authorization/safe/validation/jwt/verify-token-payload.js +30 -0
- package/dist/generic/src/errors/audit-log/audit-log-errors.d.ts +20 -0
- package/dist/generic/src/errors/audit-log/audit-log-errors.d.ts.map +1 -0
- package/dist/generic/src/errors/audit-log/audit-log-errors.js +31 -0
- package/dist/generic/src/errors/authorization/authorization-errors.d.ts +106 -0
- package/dist/generic/src/errors/authorization/authorization-errors.d.ts.map +1 -0
- package/dist/generic/src/errors/authorization/authorization-errors.js +160 -0
- package/dist/generic/src/errors/base-error.d.ts +23 -0
- package/dist/generic/src/errors/base-error.d.ts.map +1 -0
- package/dist/generic/src/errors/base-error.js +34 -0
- package/dist/generic/src/errors/database/database-errors.d.ts +24 -0
- package/dist/generic/src/errors/database/database-errors.d.ts.map +1 -0
- package/dist/generic/src/errors/database/database-errors.js +33 -0
- package/dist/generic/src/errors/generic/generic-errors.d.ts +35 -0
- package/dist/generic/src/errors/generic/generic-errors.d.ts.map +1 -0
- package/dist/generic/src/errors/generic/generic-errors.js +47 -0
- package/dist/generic/src/errors/index.d.ts +10 -0
- package/dist/generic/src/errors/index.d.ts.map +1 -0
- package/dist/generic/src/errors/index.js +26 -0
- package/dist/generic/src/errors/request/request-errors.d.ts +98 -0
- package/dist/generic/src/errors/request/request-errors.d.ts.map +1 -0
- package/dist/generic/src/errors/request/request-errors.js +134 -0
- package/dist/generic/src/errors/safe/safe-rules-errors.d.ts +102 -0
- package/dist/generic/src/errors/safe/safe-rules-errors.d.ts.map +1 -0
- package/dist/generic/src/errors/safe/safe-rules-errors.js +152 -0
- package/dist/generic/src/errors/scheduler/scheduler-errors.d.ts +8 -0
- package/dist/generic/src/errors/scheduler/scheduler-errors.d.ts.map +1 -0
- package/dist/generic/src/errors/scheduler/scheduler-errors.js +14 -0
- package/dist/generic/src/errors/share-data/share-data-errors.d.ts +67 -0
- package/dist/generic/src/errors/share-data/share-data-errors.d.ts.map +1 -0
- package/dist/generic/src/errors/share-data/share-data-errors.js +92 -0
- package/dist/generic/src/helpers/crypto/cryptography-helpers.d.ts +37 -0
- package/dist/generic/src/helpers/crypto/cryptography-helpers.d.ts.map +1 -0
- package/dist/generic/src/helpers/crypto/cryptography-helpers.js +65 -0
- package/dist/generic/src/helpers/object-validation-helpers.d.ts +66 -0
- package/dist/generic/src/helpers/object-validation-helpers.d.ts.map +1 -0
- package/dist/generic/src/helpers/object-validation-helpers.js +254 -0
- package/dist/generic/src/models/application/audit-log/application-audit-log-models.d.ts +87 -0
- package/dist/generic/src/models/application/audit-log/application-audit-log-models.d.ts.map +1 -0
- package/dist/generic/src/models/application/audit-log/application-audit-log-models.js +59 -0
- package/dist/generic/src/models/application/database/firestore-models.d.ts +84 -0
- package/dist/generic/src/models/application/database/firestore-models.d.ts.map +1 -0
- package/dist/generic/src/models/application/database/firestore-models.js +4 -0
- package/dist/generic/src/models/authorization/authorization-models.d.ts +81 -0
- package/dist/generic/src/models/authorization/authorization-models.d.ts.map +1 -0
- package/dist/generic/src/models/authorization/authorization-models.js +33 -0
- package/dist/generic/src/models/crypto/crypto-models.d.ts +5 -0
- package/dist/generic/src/models/crypto/crypto-models.d.ts.map +1 -0
- package/dist/generic/src/models/crypto/crypto-models.js +3 -0
- package/dist/generic/src/models/data/data-models.d.ts +24 -0
- package/dist/generic/src/models/data/data-models.d.ts.map +1 -0
- package/dist/generic/src/models/data/data-models.js +3 -0
- package/dist/generic/src/models/dynamic-execution/dynamic-execution-models.d.ts +9 -0
- package/dist/generic/src/models/dynamic-execution/dynamic-execution-models.d.ts.map +1 -0
- package/dist/generic/src/models/dynamic-execution/dynamic-execution-models.js +2 -0
- package/dist/generic/src/models/events/share-event-models.d.ts +65 -0
- package/dist/generic/src/models/events/share-event-models.d.ts.map +1 -0
- package/dist/generic/src/models/events/share-event-models.js +70 -0
- package/dist/generic/src/models/functions/share-data-function-models.d.ts +86 -0
- package/dist/generic/src/models/functions/share-data-function-models.d.ts.map +1 -0
- package/dist/generic/src/models/functions/share-data-function-models.js +17 -0
- package/dist/generic/src/models/generic/request-response-models.d.ts +8 -0
- package/dist/generic/src/models/generic/request-response-models.d.ts.map +1 -0
- package/dist/generic/src/models/generic/request-response-models.js +2 -0
- package/dist/generic/src/models/index.d.ts +13 -0
- package/dist/generic/src/models/index.d.ts.map +1 -0
- package/dist/generic/src/models/index.js +29 -0
- package/dist/generic/src/models/rules/share-rule-models.d.ts +303 -0
- package/dist/generic/src/models/rules/share-rule-models.d.ts.map +1 -0
- package/dist/generic/src/models/rules/share-rule-models.js +93 -0
- package/dist/generic/src/models/safe/safe-transaction-models.d.ts +81 -0
- package/dist/generic/src/models/safe/safe-transaction-models.d.ts.map +1 -0
- package/dist/generic/src/models/safe/safe-transaction-models.js +26 -0
- package/dist/generic/src/models/share-data/share-data.d.ts +56 -0
- package/dist/generic/src/models/share-data/share-data.d.ts.map +1 -0
- package/dist/generic/src/models/share-data/share-data.js +20 -0
- package/package.json +4 -3
- package/dist/cors/authority/audience/set-audience-authority.d.ts +0 -1
- package/dist/cors/authority/audience/set-audience-authority.d.ts.map +0 -1
- package/dist/cors/authority/audience/set-audience-authority.js +0 -1
- package/dist/cors/authority/jwt/validate-jwt-authority.d.ts +0 -1
- package/dist/cors/authority/jwt/validate-jwt-authority.d.ts.map +0 -1
- package/dist/cors/authority/jwt/validate-jwt-authority.js +0 -1
- package/dist/cors/errors/all-error-handler.d.ts.map +0 -1
- package/dist/cors/errors/bad-request-handler.d.ts +0 -12
- package/dist/cors/errors/bad-request-handler.d.ts.map +0 -1
- package/dist/cors/errors/unauthorized-handler.d.ts +0 -12
- package/dist/cors/errors/unauthorized-handler.d.ts.map +0 -1
- package/dist/cors/index.d.ts +0 -4
- package/dist/cors/index.d.ts.map +0 -1
- /package/dist/{index.d.ts → endpoints/src/index.d.ts} +0 -0
- /package/dist/{index.js → endpoints/src/index.js} +0 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SafeRulePropertyValueWrongType = exports.SafeRuleHasMissingProperty = exports.SafeRuleHasMismatchingProperties = exports.SafeRuleNotObjectError = exports.SafeRuleConditionTypeNotValidError = exports.SafeRuleConditionValueWrongType = exports.SafeRuleConditionPropertyMissingError = exports.SafeRuleConditionQualifierError = exports.SafeRuleConditionHasMismatchingProperties = exports.SafeRuleConditionNotObjectError = exports.SafeRuleConditionNotTypeOfError = exports.SafeRuleRuleSetNoRuleGroupsError = exports.SafeRuleEvaluationSpecialConditionPatternError = exports.SafeRuleEvaluationConditionValueError = exports.SafeRuleEvaluationConditionDataValueError = void 0;
|
|
4
|
+
const base_error_1 = require("../base-error");
|
|
5
|
+
/**
|
|
6
|
+
* This error is thrown when a evaluation condition data value is not valid
|
|
7
|
+
*/
|
|
8
|
+
class SafeRuleEvaluationConditionDataValueError extends base_error_1.BaseError {
|
|
9
|
+
/**
|
|
10
|
+
* This error is thrown when a evaluation condition data value is not valid
|
|
11
|
+
*/
|
|
12
|
+
constructor(dataValue, conditionValue, conditionType) {
|
|
13
|
+
super(`Share Rule condition evaluation for type ${conditionType} failed to execute. dataValue: ${dataValue} is incorrect for conditionValue: ${conditionValue}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.SafeRuleEvaluationConditionDataValueError = SafeRuleEvaluationConditionDataValueError;
|
|
17
|
+
/**
|
|
18
|
+
* This error is thrown when a evaluation condition value is not valid
|
|
19
|
+
*/
|
|
20
|
+
class SafeRuleEvaluationConditionValueError extends base_error_1.BaseError {
|
|
21
|
+
/**
|
|
22
|
+
* This error is thrown when a evaluation condition value is not valid
|
|
23
|
+
*/
|
|
24
|
+
constructor(dataValue, conditionValue, conditionType) {
|
|
25
|
+
super(`Share Rule condition evaluation for type ${conditionType} failed to execute. conditionValue: ${conditionValue} is incorrect for dataValue: ${dataValue}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.SafeRuleEvaluationConditionValueError = SafeRuleEvaluationConditionValueError;
|
|
29
|
+
/**
|
|
30
|
+
* This error is thrown when a speical condition pattern is not valid
|
|
31
|
+
*/
|
|
32
|
+
class SafeRuleEvaluationSpecialConditionPatternError extends base_error_1.BaseError {
|
|
33
|
+
/**
|
|
34
|
+
* This error is thrown when a speical condition pattern is not valid
|
|
35
|
+
*/
|
|
36
|
+
constructor(dataValue, conditionValue) {
|
|
37
|
+
super(`Share Rule special condition pattern evaluation failed to execute. dataValue ${dataValue} and conditionValue: ${conditionValue}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.SafeRuleEvaluationSpecialConditionPatternError = SafeRuleEvaluationSpecialConditionPatternError;
|
|
41
|
+
/**
|
|
42
|
+
* This error is thrown when a rule set has no rule groups
|
|
43
|
+
*/
|
|
44
|
+
class SafeRuleRuleSetNoRuleGroupsError extends base_error_1.BaseError {
|
|
45
|
+
/**
|
|
46
|
+
* This error is thrown when a rule set has no rule groups
|
|
47
|
+
*/
|
|
48
|
+
constructor(name, description) {
|
|
49
|
+
super(`Share Rule set ${name} with description ${description} has no rule groups`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.SafeRuleRuleSetNoRuleGroupsError = SafeRuleRuleSetNoRuleGroupsError;
|
|
53
|
+
//#region Condition Validation Errors
|
|
54
|
+
class SafeRuleConditionNotTypeOfError extends base_error_1.BaseError {
|
|
55
|
+
constructor(conditionType, expectedType) {
|
|
56
|
+
super(`Share Rule condition type ${conditionType} is not of type ${expectedType}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.SafeRuleConditionNotTypeOfError = SafeRuleConditionNotTypeOfError;
|
|
60
|
+
/**
|
|
61
|
+
* This error is thrown when a rule condition is not an object
|
|
62
|
+
*/
|
|
63
|
+
class SafeRuleConditionNotObjectError extends base_error_1.BaseError {
|
|
64
|
+
constructor(incomingObject) {
|
|
65
|
+
super(`Share Rule condition object ${incomingObject} is not an object`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.SafeRuleConditionNotObjectError = SafeRuleConditionNotObjectError;
|
|
69
|
+
/**
|
|
70
|
+
* This error is thrown when a rule condition is missing or has an extra property
|
|
71
|
+
*/
|
|
72
|
+
class SafeRuleConditionHasMismatchingProperties extends base_error_1.BaseError {
|
|
73
|
+
constructor(incomingObject, expectedPropertyCount, actualPropertyCount) {
|
|
74
|
+
super(`Share Rule condition object ${incomingObject} has mismatching properties, expected ${expectedPropertyCount} but got ${actualPropertyCount}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.SafeRuleConditionHasMismatchingProperties = SafeRuleConditionHasMismatchingProperties;
|
|
78
|
+
/**
|
|
79
|
+
* This error is thrown when the safe condition qualifier is not valid
|
|
80
|
+
*/
|
|
81
|
+
class SafeRuleConditionQualifierError extends base_error_1.BaseError {
|
|
82
|
+
constructor(conditionQualifier) {
|
|
83
|
+
super(`Share Rule condition qualifier ${conditionQualifier} is not valid`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.SafeRuleConditionQualifierError = SafeRuleConditionQualifierError;
|
|
87
|
+
/**
|
|
88
|
+
* This error is thrown when a rule condition property is missing
|
|
89
|
+
*/
|
|
90
|
+
class SafeRuleConditionPropertyMissingError extends base_error_1.BaseError {
|
|
91
|
+
constructor(missingProperty) {
|
|
92
|
+
super(`Share Rule condition property ${missingProperty} is missing`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.SafeRuleConditionPropertyMissingError = SafeRuleConditionPropertyMissingError;
|
|
96
|
+
/**
|
|
97
|
+
* This error is thrown when a rule condition value is not valid
|
|
98
|
+
*/
|
|
99
|
+
class SafeRuleConditionValueWrongType extends base_error_1.BaseError {
|
|
100
|
+
constructor(conditionValue, expectedType) {
|
|
101
|
+
super(`Share Rule condition value ${conditionValue} is not of type ${expectedType}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.SafeRuleConditionValueWrongType = SafeRuleConditionValueWrongType;
|
|
105
|
+
/**
|
|
106
|
+
* This error is thrown when a rule condition type is not valid
|
|
107
|
+
*/
|
|
108
|
+
class SafeRuleConditionTypeNotValidError extends base_error_1.BaseError {
|
|
109
|
+
constructor(conditionType) {
|
|
110
|
+
super(`Share Rule condition type ${conditionType} is not valid`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.SafeRuleConditionTypeNotValidError = SafeRuleConditionTypeNotValidError;
|
|
114
|
+
//#endregion Condition Validation Errors
|
|
115
|
+
//#region Rule Validation Errors
|
|
116
|
+
/**
|
|
117
|
+
* This error is thrown when a safe rule is not an object
|
|
118
|
+
*/
|
|
119
|
+
class SafeRuleNotObjectError extends base_error_1.BaseError {
|
|
120
|
+
constructor(incomingObject) {
|
|
121
|
+
super(`Share Rule object ${incomingObject} is not an object`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.SafeRuleNotObjectError = SafeRuleNotObjectError;
|
|
125
|
+
/**
|
|
126
|
+
* This error is thrown when a safe rule is missing or has an extra property
|
|
127
|
+
*/
|
|
128
|
+
class SafeRuleHasMismatchingProperties extends base_error_1.BaseError {
|
|
129
|
+
constructor(incomingObject, expectedPropertyCount, actualPropertyCount) {
|
|
130
|
+
super(`Share Rule object ${incomingObject} has mismatching properties, expected ${expectedPropertyCount} but got ${actualPropertyCount}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.SafeRuleHasMismatchingProperties = SafeRuleHasMismatchingProperties;
|
|
134
|
+
/**
|
|
135
|
+
* This error is thrown when a safe rule is missing property
|
|
136
|
+
*/
|
|
137
|
+
class SafeRuleHasMissingProperty extends base_error_1.BaseError {
|
|
138
|
+
constructor(incomingObject, expectedProperty) {
|
|
139
|
+
super(`Share Rule object ${incomingObject} is missing property ${expectedProperty}`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.SafeRuleHasMissingProperty = SafeRuleHasMissingProperty;
|
|
143
|
+
/**
|
|
144
|
+
* This error is thrown when a safe rule property is not valid
|
|
145
|
+
*/
|
|
146
|
+
class SafeRulePropertyValueWrongType extends base_error_1.BaseError {
|
|
147
|
+
constructor(propertyName, propertyValue, expectedType) {
|
|
148
|
+
super(`Share Rule property ${propertyName} with value ${propertyValue} is not of type ${expectedType}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
exports.SafeRulePropertyValueWrongType = SafeRulePropertyValueWrongType;
|
|
152
|
+
//#endregion Rule Validation Errors
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler-errors.d.ts","sourceRoot":"","sources":["../../../../../../generic/src/errors/scheduler/scheduler-errors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,SAAS;gBAChC,MAAM,EAAE,MAAM;CAG7B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// this file contains all the errors that can be thrown by the scheduler
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TaskNotFoundError = void 0;
|
|
5
|
+
const base_error_1 = require("../base-error");
|
|
6
|
+
/**
|
|
7
|
+
* This error is thrown when a task is not found in the scheduler
|
|
8
|
+
*/
|
|
9
|
+
class TaskNotFoundError extends base_error_1.BaseError {
|
|
10
|
+
constructor(taskId) {
|
|
11
|
+
super(`An error occurred while trying to remove task ${taskId}.`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.TaskNotFoundError = TaskNotFoundError;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { BaseError } from '../base-error';
|
|
2
|
+
import { ShareDataTypes } from '../../models/share-data/share-data';
|
|
3
|
+
import { IShareDataFunction } from '../../models/functions/share-data-function-models';
|
|
4
|
+
/**
|
|
5
|
+
* This error is thrown when a function is tried to be applied to the share data thats state is locked.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ShareDataIsLockedError extends BaseError {
|
|
8
|
+
/**
|
|
9
|
+
* This error is thrown when a function is tried to be applied to the share data thats state is locked.
|
|
10
|
+
*/
|
|
11
|
+
constructor(shareDataId: string, shareDataType: ShareDataTypes);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* This error is thrown when a data proposal matches the current data in the rules evaluation service.
|
|
15
|
+
*/
|
|
16
|
+
export declare class ShareDataCurrentAndProposalDataMatchesError extends BaseError {
|
|
17
|
+
/**
|
|
18
|
+
* This error is thrown when a data proposal matches the current data in the rules evaluation service.
|
|
19
|
+
*/
|
|
20
|
+
constructor(shareDataId: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* This error is thrown when the share data integrity check fails.
|
|
24
|
+
*/
|
|
25
|
+
export declare class ShareDataIntegrityError extends BaseError {
|
|
26
|
+
/**
|
|
27
|
+
* This error is thrown when the share data integrity check fails.
|
|
28
|
+
*/
|
|
29
|
+
constructor(shareDataId: string);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* This error is thrown when the attemping to be applied function does not exist on the share data.
|
|
33
|
+
*/
|
|
34
|
+
export declare class ShareDataFunctionBeingAppliedDoesNotExistOnShareDataError extends BaseError {
|
|
35
|
+
/**
|
|
36
|
+
* This error is thrown when the attemping to be applied function does not exist on the share data.
|
|
37
|
+
*/
|
|
38
|
+
constructor(shareDataId: string, functionName: string, functionId: string);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* This error is thrown when the function hash is not valid.
|
|
42
|
+
*/
|
|
43
|
+
export declare class ShareDataFunctionHashNotValid extends BaseError {
|
|
44
|
+
/**
|
|
45
|
+
* This error is thrown when the function hash is not valid.
|
|
46
|
+
*/
|
|
47
|
+
constructor(shareDataId: string, shareDataFunction: IShareDataFunction, calculatedHash: string);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* This is thrown when a rule doesn't have current conditions present.
|
|
51
|
+
*/
|
|
52
|
+
export declare class ShareRuleCurrentConditionsNotPresentError extends BaseError {
|
|
53
|
+
/**
|
|
54
|
+
* This is thrown when a rule doesn't have a before or after conditions.
|
|
55
|
+
*/
|
|
56
|
+
constructor(ruleId: string);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* This is thrown when a rule doesn't have proposed conditions present.
|
|
60
|
+
*/
|
|
61
|
+
export declare class ShareRuleProposedConditionsNotPresentError extends BaseError {
|
|
62
|
+
/**
|
|
63
|
+
* This is thrown when a rule doesn't have a before or after conditions.
|
|
64
|
+
*/
|
|
65
|
+
constructor(ruleId: string);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=share-data-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share-data-errors.d.ts","sourceRoot":"","sources":["../../../../../../generic/src/errors/share-data/share-data-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAEvF;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,SAAS;IACjD;;OAEG;gBACS,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc;CAGjE;AAED;;GAEG;AACH,qBAAa,2CAA4C,SAAQ,SAAS;IACtE;;OAEG;gBACS,WAAW,EAAE,MAAM;CAGlC;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,SAAS;IAClD;;OAEG;gBACS,WAAW,EAAE,MAAM;CAGlC;AAED;;GAEG;AACH,qBAAa,yDAA0D,SAAQ,SAAS;IACpF;;OAEG;gBACS,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAI5E;AAGD;;GAEG;AACH,qBAAa,6BAA8B,SAAQ,SAAS;IACxD;;OAEG;gBACS,WAAW,EAAE,MAAM,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM;CAIjG;AAKD;;GAEG;AACH,qBAAa,yCAA0C,SAAQ,SAAS;IACpE;;OAEG;gBACS,MAAM,EAAE,MAAM;CAG7B;AAED;;GAEG;AACH,qBAAa,0CAA2C,SAAQ,SAAS;IACrE;;OAEG;gBACS,MAAM,EAAE,MAAM;CAG7B"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ShareRuleProposedConditionsNotPresentError = exports.ShareRuleCurrentConditionsNotPresentError = exports.ShareDataFunctionHashNotValid = exports.ShareDataFunctionBeingAppliedDoesNotExistOnShareDataError = exports.ShareDataIntegrityError = exports.ShareDataCurrentAndProposalDataMatchesError = exports.ShareDataIsLockedError = void 0;
|
|
4
|
+
const base_error_1 = require("../base-error");
|
|
5
|
+
/**
|
|
6
|
+
* This error is thrown when a function is tried to be applied to the share data thats state is locked.
|
|
7
|
+
*/
|
|
8
|
+
class ShareDataIsLockedError extends base_error_1.BaseError {
|
|
9
|
+
/**
|
|
10
|
+
* This error is thrown when a function is tried to be applied to the share data thats state is locked.
|
|
11
|
+
*/
|
|
12
|
+
constructor(shareDataId, shareDataType) {
|
|
13
|
+
super(`Share data with id ${shareDataId} and type ${shareDataType} is locked and cannot be modified.`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.ShareDataIsLockedError = ShareDataIsLockedError;
|
|
17
|
+
/**
|
|
18
|
+
* This error is thrown when a data proposal matches the current data in the rules evaluation service.
|
|
19
|
+
*/
|
|
20
|
+
class ShareDataCurrentAndProposalDataMatchesError extends base_error_1.BaseError {
|
|
21
|
+
/**
|
|
22
|
+
* This error is thrown when a data proposal matches the current data in the rules evaluation service.
|
|
23
|
+
*/
|
|
24
|
+
constructor(shareDataId) {
|
|
25
|
+
super(`Share data with id ${shareDataId} current and proposal data matches.`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.ShareDataCurrentAndProposalDataMatchesError = ShareDataCurrentAndProposalDataMatchesError;
|
|
29
|
+
/**
|
|
30
|
+
* This error is thrown when the share data integrity check fails.
|
|
31
|
+
*/
|
|
32
|
+
class ShareDataIntegrityError extends base_error_1.BaseError {
|
|
33
|
+
/**
|
|
34
|
+
* This error is thrown when the share data integrity check fails.
|
|
35
|
+
*/
|
|
36
|
+
constructor(shareDataId) {
|
|
37
|
+
super(`Share data with id ${shareDataId} failed the integrity check.`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.ShareDataIntegrityError = ShareDataIntegrityError;
|
|
41
|
+
/**
|
|
42
|
+
* This error is thrown when the attemping to be applied function does not exist on the share data.
|
|
43
|
+
*/
|
|
44
|
+
class ShareDataFunctionBeingAppliedDoesNotExistOnShareDataError extends base_error_1.BaseError {
|
|
45
|
+
/**
|
|
46
|
+
* This error is thrown when the attemping to be applied function does not exist on the share data.
|
|
47
|
+
*/
|
|
48
|
+
constructor(shareDataId, functionName, functionId) {
|
|
49
|
+
super(`On share data with id ${shareDataId} the function with id: ${functionId} & name: ${functionName} that is trying to be executed, ` +
|
|
50
|
+
'but does not exist in the authorized functions for the share data.');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.ShareDataFunctionBeingAppliedDoesNotExistOnShareDataError = ShareDataFunctionBeingAppliedDoesNotExistOnShareDataError;
|
|
54
|
+
/**
|
|
55
|
+
* This error is thrown when the function hash is not valid.
|
|
56
|
+
*/
|
|
57
|
+
class ShareDataFunctionHashNotValid extends base_error_1.BaseError {
|
|
58
|
+
/**
|
|
59
|
+
* This error is thrown when the function hash is not valid.
|
|
60
|
+
*/
|
|
61
|
+
constructor(shareDataId, shareDataFunction, calculatedHash) {
|
|
62
|
+
super(`On share data with id ${shareDataId} the function with current hash: ${shareDataFunction.currentHash} & previous hase: ${shareDataFunction.previousHash}` +
|
|
63
|
+
` that is trying to be executed does not meet the generated hash ${calculatedHash}. This makes it an authorized function execution.`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.ShareDataFunctionHashNotValid = ShareDataFunctionHashNotValid;
|
|
67
|
+
//#region Rules
|
|
68
|
+
/**
|
|
69
|
+
* This is thrown when a rule doesn't have current conditions present.
|
|
70
|
+
*/
|
|
71
|
+
class ShareRuleCurrentConditionsNotPresentError extends base_error_1.BaseError {
|
|
72
|
+
/**
|
|
73
|
+
* This is thrown when a rule doesn't have a before or after conditions.
|
|
74
|
+
*/
|
|
75
|
+
constructor(ruleId) {
|
|
76
|
+
super(`Rule with id ${ruleId} does not have any current conditions present.`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.ShareRuleCurrentConditionsNotPresentError = ShareRuleCurrentConditionsNotPresentError;
|
|
80
|
+
/**
|
|
81
|
+
* This is thrown when a rule doesn't have proposed conditions present.
|
|
82
|
+
*/
|
|
83
|
+
class ShareRuleProposedConditionsNotPresentError extends base_error_1.BaseError {
|
|
84
|
+
/**
|
|
85
|
+
* This is thrown when a rule doesn't have a before or after conditions.
|
|
86
|
+
*/
|
|
87
|
+
constructor(ruleId) {
|
|
88
|
+
super(`Rule with id ${ruleId} does not have any proposed conditions present.`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.ShareRuleProposedConditionsNotPresentError = ShareRuleProposedConditionsNotPresentError;
|
|
92
|
+
//#endregion Rules
|
|
@@ -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":["../../../../../../generic/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;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks that an object is an array and that it has the minimum number of items.
|
|
3
|
+
*
|
|
4
|
+
* @param incomingObject the object to check
|
|
5
|
+
* @param minimumLength the minimum number of objects to match (zero by default)
|
|
6
|
+
* @param maximumLength the maximum number of objects to match will default to the array length if not provided
|
|
7
|
+
*
|
|
8
|
+
* @returns whether the criteria matches.
|
|
9
|
+
*/
|
|
10
|
+
declare const validateArray: (incomingObject: unknown, minimumLength?: number, maximumLength?: number) => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* This validates an incoming shape of a boolean type data.
|
|
13
|
+
*
|
|
14
|
+
* @param incomingObject an object to validate as a boolean.
|
|
15
|
+
* @param undefinedValid whether the item can be undefined or not (false by default)
|
|
16
|
+
*
|
|
17
|
+
* @returns whether the shape is valid.
|
|
18
|
+
*/
|
|
19
|
+
declare const validateBoolean: (incomingObject: unknown, undefinedValid?: boolean) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* This validates a date object or a string that can be converted to a date object.
|
|
22
|
+
* @param dateToValidate the date to validate
|
|
23
|
+
* @param undefinedValid whether the item can be undefined or not (false by default)
|
|
24
|
+
* @param allowFutureDated the date can be in the future (false by default)
|
|
25
|
+
* @param ensureAtLeast18YearsAgo whether the date is at least 18 years ago (true by default)
|
|
26
|
+
*
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
declare const validateDate: (dateToValidate: unknown, undefinedValid?: boolean, allowFutureDated?: boolean, ensureAtLeast18YearsAgo?: boolean) => boolean;
|
|
30
|
+
/**
|
|
31
|
+
* This validates that the incoming Object is a number and that it is in the range (if provided)
|
|
32
|
+
*
|
|
33
|
+
* @param incomingObject object to validate to a number
|
|
34
|
+
* @param min (optional) minimum number
|
|
35
|
+
* @param max (optional) maximum number
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
declare const validateNumber: (incomingObject: unknown, min?: number, max?: number) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* This validates an incoming shape of a set of files links to the data.
|
|
41
|
+
*
|
|
42
|
+
* @param incomingObject an object to validate as a string.
|
|
43
|
+
* @param hasNoSpaces whether the item should have no spaces in it (false by default)
|
|
44
|
+
* @param undefinedValid whether the item can be undefined or not (false by default)
|
|
45
|
+
* @param emptyStringValid whether the item can be an empty string or not (false by default)
|
|
46
|
+
*
|
|
47
|
+
* @returns whether the shape is valid.
|
|
48
|
+
*/
|
|
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;
|
|
57
|
+
/**
|
|
58
|
+
* This validates that an incoming object is a valid URL.
|
|
59
|
+
*
|
|
60
|
+
* @param incomingUrl the URL to check
|
|
61
|
+
* @param undefinedValid whether the item can be undefined or not (false by default)
|
|
62
|
+
* @returns wether it is a valid URL or not
|
|
63
|
+
*/
|
|
64
|
+
declare const validateUrl: (incomingUrl: unknown, undefinedValid?: boolean) => boolean;
|
|
65
|
+
export { validateArray, validateBoolean, validateDate, validateNumber, validateString, validateStringHex, validateUrl, };
|
|
66
|
+
//# sourceMappingURL=object-validation-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-validation-helpers.d.ts","sourceRoot":"","sources":["../../../../../generic/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"}
|