@degenerate/generic 0.2.7 → 0.4.0
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/_settings/database-settings.d.ts +3 -0
- package/dist/_settings/database-settings.d.ts.map +1 -1
- package/dist/_settings/database-settings.js +3 -0
- package/dist/application/audit-log/additional-ids/create-audit-log-additional-ids-with-query.d.ts.map +1 -1
- package/dist/application/audit-log/additional-ids/create-multiple-path-alai.d.ts.map +1 -1
- package/dist/application/audit-log/additional-ids/create-query-audit-log-for-alai.d.ts.map +1 -1
- package/dist/application/audit-log/create-application-audit-log.d.ts.map +1 -1
- package/dist/application/audit-log/create-application-audit-log.js +1 -1
- package/dist/application/database/firestore/generics/add-items-to-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/add-items-to-database.js +2 -2
- package/dist/application/database/firestore/generics/add-or-update-items-to-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/add-or-update-items-to-database.js +3 -3
- package/dist/application/database/firestore/generics/create-database-change-information.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/delete-items-on-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/delete-items-on-database.js +2 -2
- package/dist/application/database/firestore/generics/get-item-from-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/get-item-from-database.js +2 -2
- package/dist/application/database/firestore/generics/get-items-different-path-on-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/get-items-different-path-on-database.js +2 -2
- package/dist/application/database/firestore/generics/get-items-from-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/get-items-from-database.js +1 -1
- package/dist/application/database/firestore/generics/update-items-on-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/update-items-on-database.js +2 -2
- package/dist/application/database/firestore/generics/update-items-properties-on-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/update-items-properties-on-database.js +2 -2
- package/dist/authorization/index.d.ts +1 -0
- package/dist/authorization/index.d.ts.map +1 -1
- package/dist/authorization/index.js +1 -0
- package/dist/authorization/jwt/keys/create-public-key-pem.d.ts.map +1 -1
- package/dist/authorization/jwt/keys/create-secret-key-pem.d.ts.map +1 -1
- package/dist/authorization/jwt/sign/create-authorization-issuer.d.ts.map +1 -1
- package/dist/authorization/jwt/sign/create-authorization-subject.d.ts.map +1 -1
- package/dist/authorization/jwt/sign/create-jwt-options.d.ts +7 -1
- package/dist/authorization/jwt/sign/create-jwt-options.d.ts.map +1 -1
- package/dist/authorization/jwt/sign/create-jwt-signed-token.d.ts.map +1 -1
- package/dist/authorization/jwt/transform/transform-token-payload-to-safe-payload.d.ts.map +1 -1
- package/dist/authorization/jwt/verify/get-decoded-jwt-header.d.ts.map +1 -1
- package/dist/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.d.ts.map +1 -1
- package/dist/authorization/jwt/verify/verify-jwt-signed-token.d.ts.map +1 -1
- package/dist/authorization/safe/request/decode-bearer-token.d.ts.map +1 -1
- package/dist/authorization/safe/request/decode-safe-request.d.ts.map +1 -1
- package/dist/authorization/safe/request/determine-issuer-from-request.d.ts.map +1 -1
- package/dist/authorization/safe/request/issuer/determine-issuer-from-bearer-token.d.ts.map +1 -1
- package/dist/authorization/safe/request/verify-jwt-bearer-token-for-audience.d.ts +31 -0
- package/dist/authorization/safe/request/verify-jwt-bearer-token-for-audience.d.ts.map +1 -0
- package/dist/authorization/safe/request/verify-jwt-bearer-token-for-audience.js +50 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-audience.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issuer.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/verify-token-header.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/verify-token-payload.d.ts.map +1 -1
- package/dist/crypto/calculate-combined-hash.d.ts.map +1 -1
- package/dist/crypto/calculate-hash.d.ts +1 -1
- package/dist/crypto/calculate-hash.d.ts.map +1 -1
- package/dist/crypto/calculate-hash.js +1 -1
- package/dist/crypto/index.d.ts +1 -0
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/crypto/index.js +1 -0
- package/dist/crypto/private-public-keys/create-key-pair-from-mnemonic.d.ts.map +1 -1
- package/dist/crypto/private-public-keys/create-key-pair-from-private-key.d.ts.map +1 -1
- package/dist/crypto/private-public-keys/create-key-pair-from-private-key.js +1 -1
- package/dist/crypto/private-public-keys/create-key-pair-from-public-key.d.ts +11 -0
- package/dist/crypto/private-public-keys/create-key-pair-from-public-key.d.ts.map +1 -0
- package/dist/crypto/private-public-keys/create-key-pair-from-public-key.js +51 -0
- package/dist/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.d.ts.map +1 -1
- package/dist/crypto/private-public-keys/generation/generate-key-pair.d.ts.map +1 -1
- package/dist/crypto/private-public-keys/generation/get-private-public-key-from-keypair.d.ts.map +1 -1
- package/dist/crypto/signature/create-crypto-signature.d.ts +11 -0
- package/dist/crypto/signature/create-crypto-signature.d.ts.map +1 -1
- package/dist/crypto/signature/create-crypto-signature.js +14 -1
- package/dist/crypto/signature/verify-crypto-signature-by-data.d.ts +4 -0
- package/dist/crypto/signature/verify-crypto-signature-by-data.d.ts.map +1 -1
- package/dist/crypto/signature/verify-crypto-signature-by-data.js +8 -2
- package/dist/crypto/signature/verify-crypto-signature-by-hash.d.ts +4 -0
- package/dist/crypto/signature/verify-crypto-signature-by-hash.d.ts.map +1 -1
- package/dist/crypto/signature/verify-crypto-signature-by-hash.js +7 -1
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +2 -0
- package/dist/errors/share-data/share-data-errors.d.ts +105 -1
- package/dist/errors/share-data/share-data-errors.d.ts.map +1 -1
- package/dist/errors/share-data/share-data-errors.js +148 -1
- package/dist/errors/shareblock/shareblock-errors.d.ts +40 -0
- package/dist/errors/shareblock/shareblock-errors.d.ts.map +1 -0
- package/dist/errors/shareblock/shareblock-errors.js +50 -0
- package/dist/errors/validation/crypto-validation-errors.d.ts +8 -0
- package/dist/errors/validation/crypto-validation-errors.d.ts.map +1 -0
- package/dist/errors/validation/crypto-validation-errors.js +15 -0
- package/dist/helpers/array/array-helpers.d.ts.map +1 -1
- package/dist/helpers/crypto/cryptography-helpers.d.ts.map +1 -1
- package/dist/helpers/data/data-helpers.d.ts.map +1 -1
- package/dist/helpers/file/file-helpers.d.ts.map +1 -1
- package/dist/helpers/id-helpers.d.ts.map +1 -1
- package/dist/helpers/lodash/lodash-helpers.d.ts.map +1 -1
- package/dist/helpers/object-helpers.d.ts.map +1 -1
- package/dist/helpers/object-validation-helpers.d.ts.map +1 -1
- package/dist/helpers/request/params-object-helpers.d.ts +6 -13
- package/dist/helpers/request/params-object-helpers.d.ts.map +1 -1
- package/dist/helpers/request/params-object-helpers.js +11 -21
- package/dist/helpers/request/query-object-helpers.d.ts.map +1 -1
- package/dist/helpers/request/request-object-helpers.d.ts.map +1 -1
- package/dist/models/application/audit-log/application-audit-log-models.d.ts +82 -92
- package/dist/models/application/audit-log/application-audit-log-models.d.ts.map +1 -1
- package/dist/models/application/database/firestore-models.d.ts +158 -307
- package/dist/models/application/database/firestore-models.d.ts.map +1 -1
- package/dist/models/authorization/authorization-models.d.ts +34 -44
- package/dist/models/authorization/authorization-models.d.ts.map +1 -1
- package/dist/models/authorization/authorization-models.js +2 -2
- package/dist/models/crypto/crypto-models.d.ts +1 -7
- package/dist/models/crypto/crypto-models.d.ts.map +1 -1
- package/dist/models/data/data-models.d.ts +27 -13
- package/dist/models/data/data-models.d.ts.map +1 -1
- package/dist/models/data/data-models.js +23 -2
- package/dist/models/dynamic-execution/dynamic-execution-models.d.ts +1 -9
- package/dist/models/dynamic-execution/dynamic-execution-models.d.ts.map +1 -1
- package/dist/models/events/share-event-models.d.ts +91 -120
- package/dist/models/events/share-event-models.d.ts.map +1 -1
- package/dist/models/events/share-event-models.js +35 -4
- package/dist/models/functions/share-data-function-models.d.ts +23 -193
- package/dist/models/functions/share-data-function-models.d.ts.map +1 -1
- package/dist/models/functions/share-data-function-models.js +1 -1
- package/dist/models/generic/request-response-models.d.ts +1 -7
- package/dist/models/generic/request-response-models.d.ts.map +1 -1
- package/dist/models/index.d.ts +4 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +4 -1
- package/dist/models/rules/share-rule-models.d.ts +759 -1116
- package/dist/models/rules/share-rule-models.d.ts.map +1 -1
- package/dist/models/rules/share-rule-models.js +6 -6
- package/dist/models/safe/safe-transaction-models.d.ts +28 -30
- package/dist/models/safe/safe-transaction-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/authorities-transactions-models.d.ts +77 -419
- package/dist/models/safe/transactions/authorities-transactions-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/authorities-transactions-models.js +3 -3
- package/dist/models/safe/transactions/events-transactions-models.d.ts +22 -372
- package/dist/models/safe/transactions/events-transactions-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/events-transactions-models.js +1 -1
- package/dist/models/safe/transactions/functions-transactions-models.d.ts +22 -372
- package/dist/models/safe/transactions/functions-transactions-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/functions-transactions-models.js +1 -1
- package/dist/models/safe/transactions/rules-transactions-models.d.ts +59 -603
- package/dist/models/safe/transactions/rules-transactions-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/sharedata-transactions-models.d.ts +256 -388
- package/dist/models/safe/transactions/sharedata-transactions-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/sharedata-transactions-models.js +30 -4
- package/dist/models/share-data/share-data-crypto-models.d.ts +344 -0
- package/dist/models/share-data/share-data-crypto-models.d.ts.map +1 -0
- package/dist/models/share-data/share-data-crypto-models.js +131 -0
- package/dist/models/share-data/share-data-models.d.ts +114 -0
- package/dist/models/share-data/share-data-models.d.ts.map +1 -0
- package/dist/models/share-data/{share-data.js → share-data-models.js} +1 -1
- package/dist/models/share-data/share-data-persistence-models.d.ts +165 -0
- package/dist/models/share-data/share-data-persistence-models.d.ts.map +1 -0
- package/dist/models/share-data/share-data-persistence-models.js +101 -0
- package/dist/models/shareblock/shareblock-models.d.ts +489 -0
- package/dist/models/shareblock/shareblock-models.d.ts.map +1 -0
- package/dist/models/shareblock/shareblock-models.js +395 -0
- package/dist/transactions/authority/create-safe-transaction-authority-data.d.ts.map +1 -1
- package/dist/transactions/authority/create-safe-transaction-authority.d.ts.map +1 -1
- package/package.json +30 -22
- package/dist/models/share-data/share-data.d.ts +0 -181
- package/dist/models/share-data/share-data.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database-settings.d.ts","sourceRoot":"","sources":["../../src/_settings/database-settings.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"database-settings.d.ts","sourceRoot":"","sources":["../../src/_settings/database-settings.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;CAmBrC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-audit-log-additional-ids-with-query.d.ts","sourceRoot":"","sources":["../../../../src/application/audit-log/additional-ids/create-audit-log-additional-ids-with-query.ts"],"names":[],"mappings":"AACA,OAAO,EACH,iCAAiC,EACjC,+BAA+B,EAClC,MAAM,oEAAoE,CAAC;AAG5E;;;;;;;GAOG;AACH,QAAA,MAAM,oCAAoC,
|
|
1
|
+
{"version":3,"file":"create-audit-log-additional-ids-with-query.d.ts","sourceRoot":"","sources":["../../../../src/application/audit-log/additional-ids/create-audit-log-additional-ids-with-query.ts"],"names":[],"mappings":"AACA,OAAO,EACH,iCAAiC,EACjC,+BAA+B,EAClC,MAAM,oEAAoE,CAAC;AAG5E;;;;;;;GAOG;AACH,QAAA,MAAM,oCAAoC,GACtC,SAAS,OAAO,EAChB,kCAAkC,iCAAiC,EAAE,EACrE,iBAAgB,+BAA+B,EAAO,KACvD,iCAAiC,EAiBnC,CAAC;AAEF,OAAO,EAAE,oCAAoC,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-multiple-path-alai.d.ts","sourceRoot":"","sources":["../../../../src/application/audit-log/additional-ids/create-multiple-path-alai.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAE,MAAM,oEAAoE,CAAC;AAEvH;;;;;GAKG;AACH,QAAA,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"create-multiple-path-alai.d.ts","sourceRoot":"","sources":["../../../../src/application/audit-log/additional-ids/create-multiple-path-alai.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAE,MAAM,oEAAoE,CAAC;AAEvH;;;;;GAKG;AACH,QAAA,MAAM,sBAAsB,GAAI,gBAAgB,MAAM,EAAE,KAAG,iCAAiC,EAQ3F,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-query-audit-log-for-alai.d.ts","sourceRoot":"","sources":["../../../../src/application/audit-log/additional-ids/create-query-audit-log-for-alai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,oEAAoE,CAAC;AAErH;;;;;GAKG;AACH,QAAA,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"create-query-audit-log-for-alai.d.ts","sourceRoot":"","sources":["../../../../src/application/audit-log/additional-ids/create-query-audit-log-for-alai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,oEAAoE,CAAC;AAErH;;;;;GAKG;AACH,QAAA,MAAM,0BAA0B,GAAI,gBAAgB,+BAA+B,EAAE,KAAG,MASvF,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-application-audit-log.d.ts","sourceRoot":"","sources":["../../../src/application/audit-log/create-application-audit-log.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,yBAAyB,EACzB,0BAA0B,EAC1B,uBAAuB,EAEvB,iCAAiC,EACjC,oBAAoB,EACvB,MAAM,iEAAiE,CAAC;AAEzE;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"create-application-audit-log.d.ts","sourceRoot":"","sources":["../../../src/application/audit-log/create-application-audit-log.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,yBAAyB,EACzB,0BAA0B,EAC1B,uBAAuB,EAEvB,iCAAiC,EACjC,oBAAoB,EACvB,MAAM,iEAAiE,CAAC;AAEzE;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,yBAAyB,GAC3B,2BAA2B,yBAAyB,EACpD,4BAA4B,0BAA0B,EACtD,WAAW,MAAM,EACjB,0BAAyB,uBAAmE,EAC5F,OAAM,iCAAiC,EAAO,EAC9C,cAAc,GAAG,EACjB,eAAe,GAAG,KACnB,oBAaF,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -15,7 +15,7 @@ const application_audit_log_models_1 = require("../../models/application/audit-l
|
|
|
15
15
|
* @param championsNetworkId the champions network Id.
|
|
16
16
|
* @param organizationId the organization Id.
|
|
17
17
|
*/
|
|
18
|
-
const createApplicationAuditLog = (applicationAuditLogAction, applicationAuditLogSubType, createdBy, applicationAuditLogType = application_audit_log_models_1.ApplicationAuditLogTypeSchema.
|
|
18
|
+
const createApplicationAuditLog = (applicationAuditLogAction, applicationAuditLogSubType, createdBy, applicationAuditLogType = application_audit_log_models_1.ApplicationAuditLogTypeSchema.enum.global, alai = [], currentData, previousData) => {
|
|
19
19
|
const auditLog = {
|
|
20
20
|
additionalAuditLogIds: alai,
|
|
21
21
|
applicationAuditLogAction,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-items-to-database.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/add-items-to-database.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAEtG,OAAO,EAAmC,uBAAuB,EAAiC,MAAM,uEAAuE,CAAC;AAEhL;;;;;;;GAOG;AACH,QAAA,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"add-items-to-database.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/add-items-to-database.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAEtG,OAAO,EAAmC,uBAAuB,EAAiC,MAAM,uEAAuE,CAAC;AAEhL;;;;;;;GAOG;AACH,QAAA,MAAM,kBAAkB,GACpB,2BAA2B,0BAA0B,EAAE,EACvD,QAAQ,MAAM,EACd,0BAAyB,uBAAmE,KAC7F,OAAO,CAAC,IAAI,CAed,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -47,13 +47,13 @@ const db = admin.firestore();
|
|
|
47
47
|
* @param applicationAuditLogType the type of audit log to create
|
|
48
48
|
* @returns
|
|
49
49
|
*/
|
|
50
|
-
const addItemsToDatabase = async (databaseChangeInformation, userId, applicationAuditLogType = application_audit_log_models_1.ApplicationAuditLogTypeSchema.
|
|
50
|
+
const addItemsToDatabase = async (databaseChangeInformation, userId, applicationAuditLogType = application_audit_log_models_1.ApplicationAuditLogTypeSchema.enum.global) => {
|
|
51
51
|
const auditLogColRef = (0, create_audit_log_col_ref_1.createAuditLogColRef)(); // create the audit log collection reference
|
|
52
52
|
// create the new records in the database
|
|
53
53
|
await db.runTransaction(async (t) => {
|
|
54
54
|
for (const changeRecords of databaseChangeInformation) {
|
|
55
55
|
// create the audit log
|
|
56
|
-
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.
|
|
56
|
+
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.enum.create, changeRecords.auditLogSubType, userId, applicationAuditLogType, changeRecords.alai, changeRecords.item, undefined);
|
|
57
57
|
t.create(changeRecords.itemDocRef, JSON.parse(JSON.stringify(changeRecords.item))); // add the item to the database.
|
|
58
58
|
t.create(auditLogColRef.doc(), auditLog); // add the audit log to the database.
|
|
59
59
|
}
|
package/dist/application/database/firestore/generics/add-or-update-items-to-database.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-or-update-items-to-database.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/add-or-update-items-to-database.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,uBAAuB,EAG1B,MAAM,uEAAuE,CAAC;AAG/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAGtG;;;;;;;GAOG;AACH,QAAA,MAAM,0BAA0B,GAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"add-or-update-items-to-database.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/add-or-update-items-to-database.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,uBAAuB,EAG1B,MAAM,uEAAuE,CAAC;AAG/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAGtG;;;;;;;GAOG;AACH,QAAA,MAAM,0BAA0B,GAAU,CAAC,EACvC,uBAAuB,0BAA0B,EAAE,EACnD,QAAQ,MAAM,EACd,0BAAyB,uBAAmE,KAC7F,OAAO,CAAC,IAAI,CAoCd,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
|
|
@@ -47,7 +47,7 @@ const db = admin.firestore();
|
|
|
47
47
|
* @param applicationAuditLogType the type of audit log to create
|
|
48
48
|
* @returns
|
|
49
49
|
*/
|
|
50
|
-
const addOrUpdateItemsToDatabase = async (databaseChangeRecords, userId, applicationAuditLogType = application_audit_log_models_1.ApplicationAuditLogTypeSchema.
|
|
50
|
+
const addOrUpdateItemsToDatabase = async (databaseChangeRecords, userId, applicationAuditLogType = application_audit_log_models_1.ApplicationAuditLogTypeSchema.enum.global) => {
|
|
51
51
|
// loop the transaction and update the database
|
|
52
52
|
await db.runTransaction(async (t) => {
|
|
53
53
|
const auditLogUpdates = []; // create an array of audit log updates
|
|
@@ -62,13 +62,13 @@ const addOrUpdateItemsToDatabase = async (databaseChangeRecords, userId, applica
|
|
|
62
62
|
// create the audit log for the update stringify and parse to ensure the deep properties are copied.
|
|
63
63
|
const updatedData = { ...JSON.parse(JSON.stringify(existingRecord)), ...newRecord };
|
|
64
64
|
// create the audit log
|
|
65
|
-
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.
|
|
65
|
+
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.enum.update, changeRecord.auditLogSubType, userId, applicationAuditLogType, changeRecord.alai, updatedData, existingRecord);
|
|
66
66
|
auditLogUpdates.push(auditLog);
|
|
67
67
|
updatedRecord.push(updatedData);
|
|
68
68
|
}
|
|
69
69
|
else {
|
|
70
70
|
// create the audit log
|
|
71
|
-
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.
|
|
71
|
+
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.enum.create, changeRecord.auditLogSubType, userId, applicationAuditLogType, changeRecord.alai, newRecord, undefined);
|
|
72
72
|
auditLogUpdates.push(auditLog);
|
|
73
73
|
updatedRecord.push(newRecord);
|
|
74
74
|
}
|
package/dist/application/database/firestore/generics/create-database-change-information.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-database-change-information.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/create-database-change-information.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,iCAAiC,EAAE,0BAA0B,EAAE,MAAM,uEAAuE,CAAC;AACtJ,OAAO,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAEtG;;;;;;;;GAQG;AACH,QAAA,MAAM,+BAA+B,
|
|
1
|
+
{"version":3,"file":"create-database-change-information.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/create-database-change-information.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,iCAAiC,EAAE,0BAA0B,EAAE,MAAM,uEAAuE,CAAC;AACtJ,OAAO,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAEtG;;;;;;;;GAQG;AACH,QAAA,MAAM,+BAA+B,GACjC,MAAM,iCAAiC,EAAE,EACzC,iBAAiB,0BAA0B,EAC3C,MAAM,OAAO,EACb,YAAY,iBAAiB,KAC9B,0BAOF,CAAC;AAEF,OAAO,EAAE,+BAA+B,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-items-on-database.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/delete-items-on-database.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,uBAAuB,EAE1B,MAAM,uEAAuE,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAM/F;;;;;;;GAOG;AACH,QAAA,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"delete-items-on-database.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/delete-items-on-database.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,uBAAuB,EAE1B,MAAM,uEAAuE,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAM/F;;;;;;;GAOG;AACH,QAAA,MAAM,qBAAqB,GACvB,qBAAqB,mBAAmB,EAAE,EAC1C,QAAQ,MAAM,EACd,0BAAyB,uBAAmE,KAC7F,OAAO,CAAC,IAAI,CA2Bd,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -48,7 +48,7 @@ const db = admin.firestore();
|
|
|
48
48
|
* @param applicationAuditLogType the type of audit log to create
|
|
49
49
|
* @returns
|
|
50
50
|
*/
|
|
51
|
-
const deleteItemsOnDatabase = async (databaseDeleteItems, userId, applicationAuditLogType = application_audit_log_models_1.ApplicationAuditLogTypeSchema.
|
|
51
|
+
const deleteItemsOnDatabase = async (databaseDeleteItems, userId, applicationAuditLogType = application_audit_log_models_1.ApplicationAuditLogTypeSchema.enum.global) => {
|
|
52
52
|
const auditLogColRef = (0, create_audit_log_col_ref_1.createAuditLogColRef)(); // create the audit log collection reference
|
|
53
53
|
// create the new records in the database
|
|
54
54
|
await db.runTransaction(async (t) => {
|
|
@@ -66,7 +66,7 @@ const deleteItemsOnDatabase = async (databaseDeleteItems, userId, applicationAud
|
|
|
66
66
|
const existingRecord = existingRecords[i]; // the existing record
|
|
67
67
|
const deleteRecord = databaseDeleteItems[i]; // the delete record
|
|
68
68
|
// create the audit log
|
|
69
|
-
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.
|
|
69
|
+
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.enum.delete, deleteRecord.auditLogSubType, userId, applicationAuditLogType, deleteRecord.alai, undefined, existingRecord);
|
|
70
70
|
t.delete(deleteRecord.itemDocRef); // delete the item from the database.
|
|
71
71
|
t.create(auditLogColRef.doc(), auditLog); // add the audit log to the database.
|
|
72
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-item-from-database.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/get-item-from-database.ts"],"names":[],"mappings":"AAGA,OAAO,EAEH,uBAAuB,EAE1B,MAAM,uEAAuE,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0DAA0D,CAAC;AAG5F;;;;;;;GAOG;AACH,QAAA,MAAM,mBAAmB,GAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"get-item-from-database.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/get-item-from-database.ts"],"names":[],"mappings":"AAGA,OAAO,EAEH,uBAAuB,EAE1B,MAAM,uEAAuE,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0DAA0D,CAAC;AAG5F;;;;;;;GAOG;AACH,QAAA,MAAM,mBAAmB,GAAU,CAAC,EAChC,SAAS,gBAAgB,EACzB,QAAQ,MAAM,EACd,0BAAyB,uBAAmE,KAC7F,OAAO,CAAC,CAAC,GAAG,SAAS,CAgBvB,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -48,10 +48,10 @@ const db = admin.firestore();
|
|
|
48
48
|
* @param applicationAuditLogType the type of audit log to create
|
|
49
49
|
* @returns
|
|
50
50
|
*/
|
|
51
|
-
const getItemFromDatabase = async (getItem, userId, applicationAuditLogType = application_audit_log_models_1.ApplicationAuditLogTypeSchema.
|
|
51
|
+
const getItemFromDatabase = async (getItem, userId, applicationAuditLogType = application_audit_log_models_1.ApplicationAuditLogTypeSchema.enum.global) => {
|
|
52
52
|
const auditLogRef = (0, create_audit_log_col_ref_1.createAuditLogColRef)(); // create the audit log reference
|
|
53
53
|
// create the audit log information
|
|
54
|
-
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.
|
|
54
|
+
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.enum.read, getItem.auditLogSubType, userId, applicationAuditLogType, getItem.alai, undefined, undefined);
|
|
55
55
|
const itemData = await db.runTransaction(async (t) => {
|
|
56
56
|
const connectedSnap = await t.get(getItem.itemDocRef); // get the connected snap
|
|
57
57
|
t.create(auditLogRef.doc(), auditLog); // add the audit log to the database.
|
package/dist/application/database/firestore/generics/get-items-different-path-on-database.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-items-different-path-on-database.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/get-items-different-path-on-database.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,uBAAuB,EAG1B,MAAM,uEAAuE,CAAC;AAI/E;;;;;;;GAOG;AACH,QAAA,MAAM,gCAAgC,GAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"get-items-different-path-on-database.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/get-items-different-path-on-database.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,uBAAuB,EAG1B,MAAM,uEAAuE,CAAC;AAI/E;;;;;;;GAOG;AACH,QAAA,MAAM,gCAAgC,GAAU,CAAC,EAC7C,eAAe,MAAM,EAAE,EACvB,QAAQ,MAAM,EACd,0BAAyB,uBAAmE,KAC7F,OAAO,CAAC,CAAC,EAAE,CA2Bb,CAAC;AAEF,OAAO,EAAE,gCAAgC,EAAE,CAAC"}
|
package/dist/application/database/firestore/generics/get-items-different-path-on-database.js
CHANGED
|
@@ -48,7 +48,7 @@ const db = admin.firestore();
|
|
|
48
48
|
* @param applicationAuditLogType the type of audit log to create
|
|
49
49
|
* @returns
|
|
50
50
|
*/
|
|
51
|
-
const getItemsDifferentPathsOnDatabase = async (documentPaths, userId, applicationAuditLogType = application_audit_log_models_1.ApplicationAuditLogTypeSchema.
|
|
51
|
+
const getItemsDifferentPathsOnDatabase = async (documentPaths, userId, applicationAuditLogType = application_audit_log_models_1.ApplicationAuditLogTypeSchema.enum.global) => {
|
|
52
52
|
const auditLogColRef = (0, create_audit_log_col_ref_1.createAuditLogColRef)(); // create the audit log collection reference
|
|
53
53
|
// create the promisees for the documents.
|
|
54
54
|
const documentPromises = [];
|
|
@@ -58,7 +58,7 @@ const getItemsDifferentPathsOnDatabase = async (documentPaths, userId, applicati
|
|
|
58
58
|
// create the audit log additional ids information
|
|
59
59
|
const alai = (0, create_multiple_path_alai_1.createMultiplePathALAI)(documentPaths);
|
|
60
60
|
// create the audit log information
|
|
61
|
-
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.
|
|
61
|
+
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.enum.list, application_audit_log_models_1.MultiplePathAuditLogSubTypeSchema.enum.multiplePathALAI, userId, applicationAuditLogType, alai, undefined, undefined);
|
|
62
62
|
// add in the audit log
|
|
63
63
|
await auditLogColRef.add(auditLog);
|
|
64
64
|
const allDocuments = await Promise.all(documentPromises);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-items-from-database.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/get-items-from-database.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmC,uBAAuB,EAAiC,MAAM,uEAAuE,CAAC;AAChL,OAAO,EAAE,uBAAuB,EAAE,MAAM,0DAA0D,CAAC;AAKnG;;;;;;;;GAQG;AACH,QAAA,MAAM,oBAAoB,GAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"get-items-from-database.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/get-items-from-database.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmC,uBAAuB,EAAiC,MAAM,uEAAuE,CAAC;AAChL,OAAO,EAAE,uBAAuB,EAAE,MAAM,0DAA0D,CAAC;AAKnG;;;;;;;;GAQG;AACH,QAAA,MAAM,oBAAoB,GAAU,CAAC,EACjC,QAAQ,MAAM,EACd,gBAAgB,uBAAuB,EACvC,0BAAyB,uBAAmE,KAC7F,OAAO,CAAC,CAAC,EAAE,CAuCb,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -78,7 +78,7 @@ const getItemsFromDatabase = async (userId, getInformation, applicationAuditLogT
|
|
|
78
78
|
databaseItems.push(item);
|
|
79
79
|
}
|
|
80
80
|
// create the audit log information
|
|
81
|
-
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.
|
|
81
|
+
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.enum.list, getInformation.auditLogSubType, userId, applicationAuditLogType, getInformation.alai, undefined, undefined);
|
|
82
82
|
t.create(auditLogColRef.doc(), auditLog); // add the audit log to the database.
|
|
83
83
|
return databaseItems;
|
|
84
84
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-items-on-database.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/update-items-on-database.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,uBAAuB,EAE1B,MAAM,uEAAuE,CAAC;AAC/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAMtG;;;;;;;GAOG;AACH,QAAA,MAAM,qBAAqB,GAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"update-items-on-database.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/update-items-on-database.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,uBAAuB,EAE1B,MAAM,uEAAuE,CAAC;AAC/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAMtG;;;;;;;GAOG;AACH,QAAA,MAAM,qBAAqB,GAAU,CAAC,EAClC,2BAA2B,0BAA0B,EAAE,EACvD,QAAQ,MAAM,EACd,0BAAyB,uBAAmE,KAC7F,OAAO,CAAC,IAAI,CA0Bd,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -48,7 +48,7 @@ const db = admin.firestore();
|
|
|
48
48
|
* @param applicationAuditLogType the type of audit log to create
|
|
49
49
|
* @returns
|
|
50
50
|
*/
|
|
51
|
-
const updateItemsOnDatabase = async (databaseChangeInformation, userId, applicationAuditLogType = application_audit_log_models_1.ApplicationAuditLogTypeSchema.
|
|
51
|
+
const updateItemsOnDatabase = async (databaseChangeInformation, userId, applicationAuditLogType = application_audit_log_models_1.ApplicationAuditLogTypeSchema.enum.global) => {
|
|
52
52
|
// loop the transaction and update the database
|
|
53
53
|
await db.runTransaction(async (t) => {
|
|
54
54
|
// get the existing records from the database
|
|
@@ -66,7 +66,7 @@ const updateItemsOnDatabase = async (databaseChangeInformation, userId, applicat
|
|
|
66
66
|
const changeRecord = databaseChangeInformation[i];
|
|
67
67
|
const existingRecord = existingRecords[i];
|
|
68
68
|
// create the audit log
|
|
69
|
-
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.
|
|
69
|
+
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.enum.update, changeRecord.auditLogSubType, userId, applicationAuditLogType, changeRecord.alai, changeRecord.item, existingRecord);
|
|
70
70
|
const updatedRecord = { ...existingRecord, ...changeRecord.item };
|
|
71
71
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
72
72
|
t.update(changeRecord.itemDocRef, updatedRecord);
|
package/dist/application/database/firestore/generics/update-items-properties-on-database.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-items-properties-on-database.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/update-items-properties-on-database.ts"],"names":[],"mappings":"AAEA,OAAO,EAGH,uBAAuB,EAE1B,MAAM,uEAAuE,CAAC;AAC/E,OAAO,EAAE,kCAAkC,EAAE,MAAM,0DAA0D,CAAC;AAI9G;;;;;;;;GAQG;AACH,QAAA,MAAM,+BAA+B,GAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"update-items-properties-on-database.d.ts","sourceRoot":"","sources":["../../../../../src/application/database/firestore/generics/update-items-properties-on-database.ts"],"names":[],"mappings":"AAEA,OAAO,EAGH,uBAAuB,EAE1B,MAAM,uEAAuE,CAAC;AAC/E,OAAO,EAAE,kCAAkC,EAAE,MAAM,0DAA0D,CAAC;AAI9G;;;;;;;;GAQG;AACH,QAAA,MAAM,+BAA+B,GAAU,CAAC,EAC5C,uBAAuB,kCAAkC,EAAE,EAC3D,QAAQ,MAAM,EACd,0BAAyB,uBAAmE,KAC7F,OAAO,CAAC,IAAI,CA6Bd,CAAC;AAEF,OAAO,EAAE,+BAA+B,EAAE,CAAC"}
|
|
@@ -49,7 +49,7 @@ const db = admin.firestore();
|
|
|
49
49
|
* @param applicationAuditLogType the type of audit log to create
|
|
50
50
|
* @returns
|
|
51
51
|
*/
|
|
52
|
-
const updateItemsPropertiesOnDatabase = async (databaseChangeRecords, userId, applicationAuditLogType = application_audit_log_models_1.ApplicationAuditLogTypeSchema.
|
|
52
|
+
const updateItemsPropertiesOnDatabase = async (databaseChangeRecords, userId, applicationAuditLogType = application_audit_log_models_1.ApplicationAuditLogTypeSchema.enum.global) => {
|
|
53
53
|
// loop the transaction and update the database
|
|
54
54
|
await db.runTransaction(async (t) => {
|
|
55
55
|
const auditLogUpdates = []; // create an array of audit log updates
|
|
@@ -65,7 +65,7 @@ const updateItemsPropertiesOnDatabase = async (databaseChangeRecords, userId, ap
|
|
|
65
65
|
const recordExisting = JSON.parse(JSON.stringify(existingRecord));
|
|
66
66
|
const updatedData = { recordExisting, ...changeRecord.partialObjectUpdate };
|
|
67
67
|
// create the audit log
|
|
68
|
-
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.
|
|
68
|
+
const auditLog = (0, create_application_audit_log_1.createApplicationAuditLog)(application_audit_log_models_1.ApplicationAuditLogActionSchema.enum.update, changeRecord.auditLogSubType, userId, applicationAuditLogType, changeRecord.alai, updatedData, existingRecord);
|
|
69
69
|
auditLogUpdates.push(auditLog);
|
|
70
70
|
updatedRecord.push(updatedData);
|
|
71
71
|
}
|
|
@@ -12,6 +12,7 @@ export * from './safe/authorization/authorized-authorities';
|
|
|
12
12
|
export * from './safe/request/decode-bearer-token';
|
|
13
13
|
export * from './safe/request/decode-safe-request';
|
|
14
14
|
export * from './safe/request/determine-issuer-from-request';
|
|
15
|
+
export * from './safe/request/verify-jwt-bearer-token-for-audience';
|
|
15
16
|
export * from './safe/request/issuer/determine-issuer-from-bearer-token';
|
|
16
17
|
export * from './safe/validation/jwt/payload/verify-authorization-audience';
|
|
17
18
|
export * from './safe/validation/jwt/payload/verify-authorization-expiration-time';
|
|
@@ -1 +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;
|
|
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;AAC7D,cAAc,qDAAqD,CAAC;AAGpE,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"}
|
|
@@ -40,6 +40,7 @@ __exportStar(require("./safe/authorization/authorized-authorities"), exports);
|
|
|
40
40
|
__exportStar(require("./safe/request/decode-bearer-token"), exports);
|
|
41
41
|
__exportStar(require("./safe/request/decode-safe-request"), exports);
|
|
42
42
|
__exportStar(require("./safe/request/determine-issuer-from-request"), exports);
|
|
43
|
+
__exportStar(require("./safe/request/verify-jwt-bearer-token-for-audience"), exports);
|
|
43
44
|
//#region Issuer
|
|
44
45
|
__exportStar(require("./safe/request/issuer/determine-issuer-from-bearer-token"), exports);
|
|
45
46
|
//#endregion Issuer
|
|
@@ -1 +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,
|
|
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,GAAI,WAAW,MAAM,KAAG,MAW/C,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1 +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,
|
|
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,GAAI,WAAW,MAAM,KAAG,MAU/C,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1 +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,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAEzF;;;;;GAKG;AACH,QAAA,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"create-authorization-issuer.d.ts","sourceRoot":"","sources":["../../../../src/authorization/jwt/sign/create-authorization-issuer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAEzF;;;;;GAKG;AACH,QAAA,MAAM,yBAAyB,GAAI,YAAY,MAAM,EAAE,WAAW,MAAM,KAAG,mBAe1E,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -1 +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,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAErH;;;;;;;GAOG;AACH,QAAA,MAAM,0BAA0B,
|
|
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,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAErH;;;;;;;GAOG;AACH,QAAA,MAAM,0BAA0B,GAC5B,aAAa,yBAAyB,EACtC,WAAW,MAAM,KAClB,oBAKF,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
|
|
@@ -12,6 +12,12 @@ import { AuthorizationAudience, AuthorizationSubject } from '../../../models/aut
|
|
|
12
12
|
* @param header An object containing additional header properties to include in the token. (optional)
|
|
13
13
|
* @returns
|
|
14
14
|
*/
|
|
15
|
-
declare const createJwtOptions: (subject: AuthorizationSubject,
|
|
15
|
+
declare const createJwtOptions: (subject: AuthorizationSubject, // the subject of the token
|
|
16
|
+
audience?: AuthorizationAudience | AuthorizationAudience[], // audience
|
|
17
|
+
algorithm?: jwt.Algorithm, // ECDSA using P-521 curve and SHA-512 hash algorithm
|
|
18
|
+
expiresIn?: string | number, // Default expiration time
|
|
19
|
+
notBefore?: string | number, // Default not before time
|
|
20
|
+
keyid?: string, // A unique identifier for the key used to sign the token. This can be used to prevent replay attacks.
|
|
21
|
+
header?: jwt.JwtHeader) => jwt.SignOptions;
|
|
16
22
|
export { createJwtOptions };
|
|
17
23
|
//# sourceMappingURL=create-jwt-options.d.ts.map
|
|
@@ -1 +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,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAGjH;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,gBAAgB,
|
|
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,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAGjH;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,gBAAgB,GAClB,SAAS,oBAAoB,EAAE,2BAA2B;AAC1D,WAAU,qBAAqB,GAAG,qBAAqB,EAAoC,EAAE,WAAW;AACxG,YAAW,GAAG,CAAC,SAAgE,EAAE,qDAAqD;AACtI,YAAW,MAAM,GAAG,MAAmD,EAAE,0BAA0B;AACnG,YAAW,MAAM,GAAG,MAAmD,EAAE,0BAA0B;AACnG,QAAQ,MAAM,EAAE,sGAAsG;AACtH,SAAS,GAAG,CAAC,SAAS,KACvB,GAAG,CAAC,WAkBN,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1 +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,
|
|
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,GACtB,SAAS,qBAAqB,EAC9B,WAAW,MAAM,EACjB,SAAS,GAAG,CAAC,WAAW,KACzB,MAIF,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1 +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,
|
|
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,GAAI,SAAS,sBAAsB,KAAG,gBAuB7E,CAAC;AAEF,OAAO,EAAE,kCAAkC,EAAE,CAAC"}
|
|
@@ -1 +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,
|
|
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,GAAI,OAAO,MAAM,KAAG,oBAU5C,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1 +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,
|
|
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,GAAI,OAAO,MAAM,KAAG,UAAU,GAAG,IAAI,GAAG,MAG5E,CAAC;AAEF,OAAO,EAAE,+BAA+B,EAAE,CAAC"}
|
|
@@ -1 +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,
|
|
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,GACtB,eAAe,MAAM,EACrB,YAAY,MAAM,EAClB,YAAY,MAAM,KACnB,MAAM,GAAG,GAAG,CAAC,UAgBf,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode-bearer-token.d.ts","sourceRoot":"","sources":["../../../../src/authorization/safe/request/decode-bearer-token.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AAKtF;;;;;;GAMG;AACH,QAAA,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"decode-bearer-token.d.ts","sourceRoot":"","sources":["../../../../src/authorization/safe/request/decode-bearer-token.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AAKtF;;;;;;GAMG;AACH,QAAA,MAAM,iBAAiB,GAAI,aAAa,MAAM,EAAE,iBAAiB,MAAM,EAAE,gBAAgB,MAAM,KAAG,gBAkBjG,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode-safe-request.d.ts","sourceRoot":"","sources":["../../../../src/authorization/safe/request/decode-safe-request.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AAEtF;;;;;;GAMG;AACH,QAAA,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"decode-safe-request.d.ts","sourceRoot":"","sources":["../../../../src/authorization/safe/request/decode-safe-request.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AAEtF;;;;;;GAMG;AACH,QAAA,MAAM,iBAAiB,GAAI,KAAK,GAAG,EAAE,iBAAiB,MAAM,EAAE,gBAAgB,MAAM,KAAG,gBAatF,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"determine-issuer-from-request.d.ts","sourceRoot":"","sources":["../../../../src/authorization/safe/request/determine-issuer-from-request.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAGzF;;;;;GAKG;AACH,QAAA,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"determine-issuer-from-request.d.ts","sourceRoot":"","sources":["../../../../src/authorization/safe/request/determine-issuer-from-request.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oDAAoD,CAAC;AAGzF;;;;;GAKG;AACH,QAAA,MAAM,0BAA0B,GAAI,KAAK,GAAG,KAAG,mBAa9C,CAAA;AAED,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"determine-issuer-from-bearer-token.d.ts","sourceRoot":"","sources":["../../../../../src/authorization/safe/request/issuer/determine-issuer-from-bearer-token.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAI5F;;;;;;;GAOG;AACH,QAAA,MAAM,8BAA8B,
|
|
1
|
+
{"version":3,"file":"determine-issuer-from-bearer-token.d.ts","sourceRoot":"","sources":["../../../../../src/authorization/safe/request/issuer/determine-issuer-from-bearer-token.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAI5F;;;;;;;GAOG;AACH,QAAA,MAAM,8BAA8B,GAAI,aAAa,MAAM,KAAG,mBAiB7D,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AuthorizedAuthorities } from '../authorization/authorized-authorities';
|
|
2
|
+
import { AuthorizationAudience, IDecodedJwtToken } from '../../../models/authorization/authorization-models';
|
|
3
|
+
/**
|
|
4
|
+
* End-to-end verification of a Bearer JWT for an expected audience. Shared
|
|
5
|
+
* primitive used by both the HTTP middleware (`buildValidateJWTForAudience`
|
|
6
|
+
* in `@degenerate/endpoints`) and the realtime upgrade authenticator
|
|
7
|
+
* (`createShareDataAuthenticate` in `@degenerate/realtime`). Centralizing
|
|
8
|
+
* the flow here means the two transports can't drift on which checks they
|
|
9
|
+
* run and which they skip — a recurring source of vulnerability classes in
|
|
10
|
+
* systems that hand-roll auth per route.
|
|
11
|
+
*
|
|
12
|
+
* Steps:
|
|
13
|
+
* 1. Peek the token's `iss` claim via {@link determineIssuerFromBearerToken}.
|
|
14
|
+
* 2. Look up the issuer's verification key for the supplied audience via
|
|
15
|
+
* {@link AuthorizedAuthorities}. No registered key →
|
|
16
|
+
* {@link SafeAuthorizationIssuerDoesNotExistError}.
|
|
17
|
+
* 3. Run {@link decodeBearerToken} — verifies signature, asserts the
|
|
18
|
+
* decoded `iss` matches what we looked up, runs payload schema
|
|
19
|
+
* validation.
|
|
20
|
+
* 4. Defense-in-depth: assert `payload.aud === audience`. The payload
|
|
21
|
+
* schema validation only checks that `aud` is *some* valid audience
|
|
22
|
+
* enum value — without this re-check, a token with `aud: 'EVENTS'`
|
|
23
|
+
* from a SHAREDATA-registered issuer would pass on a SHAREDATA
|
|
24
|
+
* route, because the signature and issuer would both be legitimate.
|
|
25
|
+
*
|
|
26
|
+
* Returns the decoded payload on success; throws on any failure. Each
|
|
27
|
+
* caller wraps with its own error semantics (Express middleware throws
|
|
28
|
+
* `RequestNotAuthorizedError`; WS upgrade handler returns `null`).
|
|
29
|
+
*/
|
|
30
|
+
export declare const verifyJwtBearerTokenForAudience: (token: string, authorities: AuthorizedAuthorities, audience: AuthorizationAudience) => IDecodedJwtToken;
|
|
31
|
+
//# sourceMappingURL=verify-jwt-bearer-token-for-audience.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-jwt-bearer-token-for-audience.d.ts","sourceRoot":"","sources":["../../../../src/authorization/safe/request/verify-jwt-bearer-token-for-audience.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAKhF,OAAO,EACH,qBAAqB,EACrB,gBAAgB,EACnB,MAAM,oDAAoD,CAAC;AAI5D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,+BAA+B,GACxC,OAAO,MAAM,EACb,aAAa,qBAAqB,EAClC,UAAU,qBAAqB,KAChC,gBAeF,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyJwtBearerTokenForAudience = void 0;
|
|
4
|
+
const authorization_errors_1 = require("../../../errors/authorization/authorization-errors");
|
|
5
|
+
const decode_bearer_token_1 = require("./decode-bearer-token");
|
|
6
|
+
const determine_issuer_from_bearer_token_1 = require("./issuer/determine-issuer-from-bearer-token");
|
|
7
|
+
/**
|
|
8
|
+
* End-to-end verification of a Bearer JWT for an expected audience. Shared
|
|
9
|
+
* primitive used by both the HTTP middleware (`buildValidateJWTForAudience`
|
|
10
|
+
* in `@degenerate/endpoints`) and the realtime upgrade authenticator
|
|
11
|
+
* (`createShareDataAuthenticate` in `@degenerate/realtime`). Centralizing
|
|
12
|
+
* the flow here means the two transports can't drift on which checks they
|
|
13
|
+
* run and which they skip — a recurring source of vulnerability classes in
|
|
14
|
+
* systems that hand-roll auth per route.
|
|
15
|
+
*
|
|
16
|
+
* Steps:
|
|
17
|
+
* 1. Peek the token's `iss` claim via {@link determineIssuerFromBearerToken}.
|
|
18
|
+
* 2. Look up the issuer's verification key for the supplied audience via
|
|
19
|
+
* {@link AuthorizedAuthorities}. No registered key →
|
|
20
|
+
* {@link SafeAuthorizationIssuerDoesNotExistError}.
|
|
21
|
+
* 3. Run {@link decodeBearerToken} — verifies signature, asserts the
|
|
22
|
+
* decoded `iss` matches what we looked up, runs payload schema
|
|
23
|
+
* validation.
|
|
24
|
+
* 4. Defense-in-depth: assert `payload.aud === audience`. The payload
|
|
25
|
+
* schema validation only checks that `aud` is *some* valid audience
|
|
26
|
+
* enum value — without this re-check, a token with `aud: 'EVENTS'`
|
|
27
|
+
* from a SHAREDATA-registered issuer would pass on a SHAREDATA
|
|
28
|
+
* route, because the signature and issuer would both be legitimate.
|
|
29
|
+
*
|
|
30
|
+
* Returns the decoded payload on success; throws on any failure. Each
|
|
31
|
+
* caller wraps with its own error semantics (Express middleware throws
|
|
32
|
+
* `RequestNotAuthorizedError`; WS upgrade handler returns `null`).
|
|
33
|
+
*/
|
|
34
|
+
const verifyJwtBearerTokenForAudience = (token, authorities, audience) => {
|
|
35
|
+
const issuer = (0, determine_issuer_from_bearer_token_1.determineIssuerFromBearerToken)(token);
|
|
36
|
+
const verificationKey = authorities.getAuthorizedJWTAuthorityPublicKey(audience, issuer);
|
|
37
|
+
if (!verificationKey) {
|
|
38
|
+
throw new authorization_errors_1.SafeAuthorizationIssuerDoesNotExistError(issuer);
|
|
39
|
+
}
|
|
40
|
+
const payload = (0, decode_bearer_token_1.decodeBearerToken)(token, verificationKey, issuer);
|
|
41
|
+
if (payload.aud !== audience) {
|
|
42
|
+
// `decodeBearerToken` validates the payload schema, but the schema
|
|
43
|
+
// only asserts `aud` is a valid AuthorizationAudience value — not
|
|
44
|
+
// that it equals what we expect. Without this re-check, an
|
|
45
|
+
// EVENTS-audience token would pass on a SHAREDATA route.
|
|
46
|
+
throw new authorization_errors_1.SafeAuthorizationPayloadNotValidError();
|
|
47
|
+
}
|
|
48
|
+
return payload;
|
|
49
|
+
};
|
|
50
|
+
exports.verifyJwtBearerTokenForAudience = verifyJwtBearerTokenForAudience;
|
package/dist/authorization/safe/validation/jwt/payload/verify-authorization-audience.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-authorization-audience.d.ts","sourceRoot":"","sources":["../../../../../../src/authorization/safe/validation/jwt/payload/verify-authorization-audience.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0DAA0D,CAAC;AAEjG;;;;;GAKG;AACH,QAAA,MAAM,2BAA2B,
|
|
1
|
+
{"version":3,"file":"verify-authorization-audience.d.ts","sourceRoot":"","sources":["../../../../../../src/authorization/safe/validation/jwt/payload/verify-authorization-audience.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0DAA0D,CAAC;AAEjG;;;;;GAKG;AACH,QAAA,MAAM,2BAA2B,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,qBAc1D,CAAA;AAED,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
|
package/dist/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-authorization-expiration-time.d.ts","sourceRoot":"","sources":["../../../../../../src/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,QAAA,MAAM,iCAAiC,
|
|
1
|
+
{"version":3,"file":"verify-authorization-expiration-time.d.ts","sourceRoot":"","sources":["../../../../../../src/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,QAAA,MAAM,iCAAiC,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,MAchE,CAAC;AAEF,OAAO,EAAE,iCAAiC,EAAE,CAAC"}
|
package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-authorization-issued-at-time.d.ts","sourceRoot":"","sources":["../../../../../../src/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,QAAA,MAAM,+BAA+B,
|
|
1
|
+
{"version":3,"file":"verify-authorization-issued-at-time.d.ts","sourceRoot":"","sources":["../../../../../../src/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,QAAA,MAAM,+BAA+B,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,MAc9D,CAAC;AAEF,OAAO,EAAE,+BAA+B,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-authorization-issuer.d.ts","sourceRoot":"","sources":["../../../../../../src/authorization/safe/validation/jwt/payload/verify-authorization-issuer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAG/F;;;;;GAKG;AACH,QAAA,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"verify-authorization-issuer.d.ts","sourceRoot":"","sources":["../../../../../../src/authorization/safe/validation/jwt/payload/verify-authorization-issuer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAG/F;;;;;GAKG;AACH,QAAA,MAAM,yBAAyB,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,mBAexD,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
package/dist/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-authorization-not-before-time.d.ts","sourceRoot":"","sources":["../../../../../../src/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,QAAA,MAAM,gCAAgC,
|
|
1
|
+
{"version":3,"file":"verify-authorization-not-before-time.d.ts","sourceRoot":"","sources":["../../../../../../src/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,QAAA,MAAM,gCAAgC,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,MAc/D,CAAC;AAEF,OAAO,EAAE,gCAAgC,EAAE,CAAC"}
|
package/dist/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-authorization-subject.d.ts","sourceRoot":"","sources":["../../../../../../src/authorization/safe/validation/jwt/payload/verify-authorization-subject.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,oBAAoB,EAEvB,MAAM,0DAA0D,CAAC;AAElE;;;;;GAKG;AACH,QAAA,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"verify-authorization-subject.d.ts","sourceRoot":"","sources":["../../../../../../src/authorization/safe/validation/jwt/payload/verify-authorization-subject.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,oBAAoB,EAEvB,MAAM,0DAA0D,CAAC;AAElE;;;;;GAKG;AACH,QAAA,MAAM,0BAA0B,GAAI,KAAK,OAAO,KAAG,GAAG,IAAI,oBASzD,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-token-header.d.ts","sourceRoot":"","sources":["../../../../../src/authorization/safe/validation/jwt/verify-token-header.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,QAAA,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"verify-token-header.d.ts","sourceRoot":"","sources":["../../../../../src/authorization/safe/validation/jwt/verify-token-header.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,QAAA,MAAM,iBAAiB,GAAI,OAAO,MAAM,KAAG,OAc1C,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-token-payload.d.ts","sourceRoot":"","sources":["../../../../../src/authorization/safe/validation/jwt/verify-token-payload.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,cAAc,CAAC;AAU/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAE/F;;;;;GAKG;AACH,QAAA,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"verify-token-payload.d.ts","sourceRoot":"","sources":["../../../../../src/authorization/safe/validation/jwt/verify-token-payload.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,cAAc,CAAC;AAU/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAE/F;;;;;GAKG;AACH,QAAA,MAAM,kBAAkB,GAAI,SAAS,GAAG,CAAC,UAAU,KAAG,OAAO,IAAI,sBAchE,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-combined-hash.d.ts","sourceRoot":"","sources":["../../src/crypto/calculate-combined-hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAGjC;;;;;;;;GAQG;AACH,QAAA,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"calculate-combined-hash.d.ts","sourceRoot":"","sources":["../../src/crypto/calculate-combined-hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAGjC;;;;;;;;GAQG;AACH,QAAA,MAAM,qBAAqB,GAAI,WAAW,MAAM,EAAE,aAAa,MAAM,EAAE,cAAc,MAAM,EACvF,UAAU,MAAM,CAAC,oBAAoB,KAAG,MAK3C,CAAC;AAEF,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -2,6 +2,6 @@ import * as crypto from 'crypto';
|
|
|
2
2
|
/**
|
|
3
3
|
* Calculates the hash of the input string.
|
|
4
4
|
*/
|
|
5
|
-
declare const calculateHash: (inputString: string, encoding
|
|
5
|
+
declare const calculateHash: (inputString: string, encoding?: crypto.BinaryToTextEncoding) => string;
|
|
6
6
|
export { calculateHash };
|
|
7
7
|
//# sourceMappingURL=calculate-hash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculate-hash.d.ts","sourceRoot":"","sources":["../../src/crypto/calculate-hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAGjC;;GAEG;AACH,QAAA,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"calculate-hash.d.ts","sourceRoot":"","sources":["../../src/crypto/calculate-hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAGjC;;GAEG;AACH,QAAA,MAAM,aAAa,GACf,aAAa,MAAM,EACnB,WAAU,MAAM,CAAC,oBAAiD,KACnE,MAIF,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -39,7 +39,7 @@ const cryptography_settings_1 = require("../_settings/cryptography-settings");
|
|
|
39
39
|
/**
|
|
40
40
|
* Calculates the hash of the input string.
|
|
41
41
|
*/
|
|
42
|
-
const calculateHash = (inputString, encoding) => {
|
|
42
|
+
const calculateHash = (inputString, encoding = cryptography_settings_1.CryptoSettings.Hash.Digest) => {
|
|
43
43
|
const combinedHash = crypto.createHash(cryptography_settings_1.CryptoSettings.Hash.Algorithm)
|
|
44
44
|
.update(inputString).digest(encoding);
|
|
45
45
|
return combinedHash;
|
package/dist/crypto/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './private-public-keys/generation/generate-key-pair';
|
|
|
8
8
|
export * from './private-public-keys/generation/get-private-public-key-from-keypair';
|
|
9
9
|
export * from './private-public-keys/create-key-pair-from-private-key';
|
|
10
10
|
export * from './private-public-keys/create-key-pair-from-mnemonic';
|
|
11
|
+
export * from './private-public-keys/create-key-pair-from-public-key';
|
|
11
12
|
export * from './signature/create-crypto-signature';
|
|
12
13
|
export * from './signature/verify-crypto-signature-by-data';
|
|
13
14
|
export * from './signature/verify-crypto-signature-by-hash';
|