@degenerate/endpoints 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/dist/endpoints/src/cors/authority/audience/get-set-audiences.d.ts +60 -0
  2. package/dist/endpoints/src/cors/authority/audience/get-set-audiences.d.ts.map +1 -0
  3. package/dist/endpoints/src/cors/authority/audience/get-set-audiences.js +90 -0
  4. package/dist/endpoints/src/cors/authority/jwt/validate-jwt-authorities.d.ts +16 -0
  5. package/dist/endpoints/src/cors/authority/jwt/validate-jwt-authorities.d.ts.map +1 -0
  6. package/dist/endpoints/src/cors/authority/jwt/validate-jwt-authorities.js +34 -0
  7. package/dist/endpoints/src/cors/endpoints/authorities/validate-authorities-transaction.d.ts +30 -0
  8. package/dist/endpoints/src/cors/endpoints/authorities/validate-authorities-transaction.d.ts.map +1 -0
  9. package/dist/endpoints/src/cors/endpoints/authorities/validate-authorities-transaction.js +155 -0
  10. package/dist/endpoints/src/cors/endpoints/helpers/validate-request-body.d.ts +11 -0
  11. package/dist/endpoints/src/cors/endpoints/helpers/validate-request-body.d.ts.map +1 -0
  12. package/dist/endpoints/src/cors/endpoints/helpers/validate-request-body.js +32 -0
  13. package/dist/{cors → endpoints/src/cors}/errors/all-error-handler.d.ts +2 -2
  14. package/dist/endpoints/src/cors/errors/all-error-handler.d.ts.map +1 -0
  15. package/dist/{cors → endpoints/src/cors}/errors/all-error-handler.js +1 -0
  16. package/dist/endpoints/src/cors/errors/bad-request-handler.d.ts +12 -0
  17. package/dist/endpoints/src/cors/errors/bad-request-handler.d.ts.map +1 -0
  18. package/dist/{cors → endpoints/src/cors}/errors/bad-request-handler.js +1 -0
  19. package/dist/endpoints/src/cors/errors/unauthorized-handler.d.ts +12 -0
  20. package/dist/endpoints/src/cors/errors/unauthorized-handler.d.ts.map +1 -0
  21. package/dist/{cors → endpoints/src/cors}/errors/unauthorized-handler.js +1 -0
  22. package/dist/endpoints/src/cors/index.d.ts +9 -0
  23. package/dist/endpoints/src/cors/index.d.ts.map +1 -0
  24. package/dist/{cors → endpoints/src/cors}/index.js +7 -0
  25. package/dist/endpoints/src/cors/routes/authorities.routes.d.ts +2 -0
  26. package/dist/endpoints/src/cors/routes/authorities.routes.d.ts.map +1 -0
  27. package/dist/endpoints/src/cors/routes/authorities.routes.js +69 -0
  28. package/dist/endpoints/src/cors/routes/events.routes.d.ts +2 -0
  29. package/dist/endpoints/src/cors/routes/events.routes.d.ts.map +1 -0
  30. package/dist/endpoints/src/cors/routes/events.routes.js +56 -0
  31. package/dist/endpoints/src/cors/routes/functions.routes.d.ts +2 -0
  32. package/dist/endpoints/src/cors/routes/functions.routes.d.ts.map +1 -0
  33. package/dist/endpoints/src/cors/routes/functions.routes.js +56 -0
  34. package/dist/endpoints/src/cors/routes/rules.routes.d.ts +2 -0
  35. package/dist/endpoints/src/cors/routes/rules.routes.d.ts.map +1 -0
  36. package/dist/endpoints/src/cors/routes/rules.routes.js +56 -0
  37. package/dist/endpoints/src/cors/routes/share-data.routes.d.ts +2 -0
  38. package/dist/endpoints/src/cors/routes/share-data.routes.d.ts.map +1 -0
  39. package/dist/endpoints/src/cors/routes/share-data.routes.js +56 -0
  40. package/dist/endpoints/src/examples/express-server/app.d.ts +3 -0
  41. package/dist/endpoints/src/examples/express-server/app.d.ts.map +1 -0
  42. package/dist/endpoints/src/examples/express-server/app.js +29 -0
  43. package/dist/endpoints/src/examples/express-server/server.d.ts +2 -0
  44. package/dist/endpoints/src/examples/express-server/server.d.ts.map +1 -0
  45. package/dist/endpoints/src/examples/express-server/server.js +9 -0
  46. package/dist/{index.d.ts.map → endpoints/src/index.d.ts.map} +1 -1
  47. package/dist/generic/src/_settings/authorization-settings.d.ts +17 -0
  48. package/dist/generic/src/_settings/authorization-settings.d.ts.map +1 -0
  49. package/dist/generic/src/_settings/authorization-settings.js +20 -0
  50. package/dist/generic/src/authorization/index.d.ts +24 -0
  51. package/dist/generic/src/authorization/index.d.ts.map +1 -0
  52. package/dist/generic/src/authorization/index.js +61 -0
  53. package/dist/generic/src/authorization/jwt/keys/create-public-key-pem.d.ts +9 -0
  54. package/dist/generic/src/authorization/jwt/keys/create-public-key-pem.d.ts.map +1 -0
  55. package/dist/generic/src/authorization/jwt/keys/create-public-key-pem.js +25 -0
  56. package/dist/generic/src/authorization/jwt/keys/create-secret-key-pem.d.ts +9 -0
  57. package/dist/generic/src/authorization/jwt/keys/create-secret-key-pem.d.ts.map +1 -0
  58. package/dist/generic/src/authorization/jwt/keys/create-secret-key-pem.js +24 -0
  59. package/dist/generic/src/authorization/jwt/sign/create-authorization-issuer.d.ts +10 -0
  60. package/dist/generic/src/authorization/jwt/sign/create-authorization-issuer.d.ts.map +1 -0
  61. package/dist/generic/src/authorization/jwt/sign/create-authorization-issuer.js +26 -0
  62. package/dist/generic/src/authorization/jwt/sign/create-authorization-subject.d.ts +12 -0
  63. package/dist/generic/src/authorization/jwt/sign/create-authorization-subject.d.ts.map +1 -0
  64. package/dist/generic/src/authorization/jwt/sign/create-authorization-subject.js +19 -0
  65. package/dist/generic/src/authorization/jwt/sign/create-jwt-options.d.ts +17 -0
  66. package/dist/generic/src/authorization/jwt/sign/create-jwt-options.d.ts.map +1 -0
  67. package/dist/generic/src/authorization/jwt/sign/create-jwt-options.js +43 -0
  68. package/dist/generic/src/authorization/jwt/sign/create-jwt-signed-token.d.ts +13 -0
  69. package/dist/generic/src/authorization/jwt/sign/create-jwt-signed-token.d.ts.map +1 -0
  70. package/dist/generic/src/authorization/jwt/sign/create-jwt-signed-token.js +22 -0
  71. package/dist/generic/src/authorization/jwt/transform/transform-token-payload-to-safe-payload.d.ts +10 -0
  72. package/dist/generic/src/authorization/jwt/transform/transform-token-payload-to-safe-payload.d.ts.map +1 -0
  73. package/dist/generic/src/authorization/jwt/transform/transform-token-payload-to-safe-payload.js +31 -0
  74. package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-header.d.ts +10 -0
  75. package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-header.d.ts.map +1 -0
  76. package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-header.js +20 -0
  77. package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.d.ts +9 -0
  78. package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.d.ts.map +1 -0
  79. package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.js +17 -0
  80. package/dist/generic/src/authorization/jwt/verify/verify-jwt-signed-token.d.ts +12 -0
  81. package/dist/generic/src/authorization/jwt/verify/verify-jwt-signed-token.d.ts.map +1 -0
  82. package/dist/generic/src/authorization/jwt/verify/verify-jwt-signed-token.js +34 -0
  83. package/dist/generic/src/authorization/safe/authorization/authorized-authorities.d.ts +42 -0
  84. package/dist/generic/src/authorization/safe/authorization/authorized-authorities.d.ts.map +1 -0
  85. package/dist/generic/src/authorization/safe/authorization/authorized-authorities.js +65 -0
  86. package/dist/generic/src/authorization/safe/request/decode-bearer-token.d.ts +11 -0
  87. package/dist/generic/src/authorization/safe/request/decode-bearer-token.d.ts.map +1 -0
  88. package/dist/generic/src/authorization/safe/request/decode-bearer-token.js +31 -0
  89. package/dist/generic/src/authorization/safe/request/decode-safe-request.d.ts +11 -0
  90. package/dist/generic/src/authorization/safe/request/decode-safe-request.d.ts.map +1 -0
  91. package/dist/generic/src/authorization/safe/request/decode-safe-request.js +30 -0
  92. package/dist/generic/src/authorization/safe/request/determine-issuer-from-request.d.ts +10 -0
  93. package/dist/generic/src/authorization/safe/request/determine-issuer-from-request.d.ts.map +1 -0
  94. package/dist/generic/src/authorization/safe/request/determine-issuer-from-request.js +29 -0
  95. package/dist/generic/src/authorization/safe/request/issuer/determine-issuer-from-bearer-token.d.ts +12 -0
  96. package/dist/generic/src/authorization/safe/request/issuer/determine-issuer-from-bearer-token.d.ts.map +1 -0
  97. package/dist/generic/src/authorization/safe/request/issuer/determine-issuer-from-bearer-token.js +30 -0
  98. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-audience.d.ts +10 -0
  99. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-audience.d.ts.map +1 -0
  100. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-audience.js +24 -0
  101. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.d.ts +8 -0
  102. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.d.ts.map +1 -0
  103. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.js +23 -0
  104. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.d.ts +9 -0
  105. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.d.ts.map +1 -0
  106. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.js +24 -0
  107. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issuer.d.ts +10 -0
  108. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issuer.d.ts.map +1 -0
  109. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issuer.js +25 -0
  110. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.d.ts +8 -0
  111. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.d.ts.map +1 -0
  112. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.js +23 -0
  113. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts +10 -0
  114. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts.map +1 -0
  115. package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-subject.js +22 -0
  116. package/dist/generic/src/authorization/safe/validation/jwt/verify-token-header.d.ts +9 -0
  117. package/dist/generic/src/authorization/safe/validation/jwt/verify-token-header.d.ts.map +1 -0
  118. package/dist/generic/src/authorization/safe/validation/jwt/verify-token-header.js +25 -0
  119. package/dist/generic/src/authorization/safe/validation/jwt/verify-token-payload.d.ts +11 -0
  120. package/dist/generic/src/authorization/safe/validation/jwt/verify-token-payload.d.ts.map +1 -0
  121. package/dist/generic/src/authorization/safe/validation/jwt/verify-token-payload.js +30 -0
  122. package/dist/generic/src/errors/audit-log/audit-log-errors.d.ts +20 -0
  123. package/dist/generic/src/errors/audit-log/audit-log-errors.d.ts.map +1 -0
  124. package/dist/generic/src/errors/audit-log/audit-log-errors.js +31 -0
  125. package/dist/generic/src/errors/authorization/authorization-errors.d.ts +106 -0
  126. package/dist/generic/src/errors/authorization/authorization-errors.d.ts.map +1 -0
  127. package/dist/generic/src/errors/authorization/authorization-errors.js +160 -0
  128. package/dist/generic/src/errors/base-error.d.ts +23 -0
  129. package/dist/generic/src/errors/base-error.d.ts.map +1 -0
  130. package/dist/generic/src/errors/base-error.js +34 -0
  131. package/dist/generic/src/errors/database/database-errors.d.ts +24 -0
  132. package/dist/generic/src/errors/database/database-errors.d.ts.map +1 -0
  133. package/dist/generic/src/errors/database/database-errors.js +33 -0
  134. package/dist/generic/src/errors/generic/generic-errors.d.ts +35 -0
  135. package/dist/generic/src/errors/generic/generic-errors.d.ts.map +1 -0
  136. package/dist/generic/src/errors/generic/generic-errors.js +47 -0
  137. package/dist/generic/src/errors/index.d.ts +10 -0
  138. package/dist/generic/src/errors/index.d.ts.map +1 -0
  139. package/dist/generic/src/errors/index.js +26 -0
  140. package/dist/generic/src/errors/request/request-errors.d.ts +98 -0
  141. package/dist/generic/src/errors/request/request-errors.d.ts.map +1 -0
  142. package/dist/generic/src/errors/request/request-errors.js +134 -0
  143. package/dist/generic/src/errors/safe/safe-rules-errors.d.ts +102 -0
  144. package/dist/generic/src/errors/safe/safe-rules-errors.d.ts.map +1 -0
  145. package/dist/generic/src/errors/safe/safe-rules-errors.js +152 -0
  146. package/dist/generic/src/errors/scheduler/scheduler-errors.d.ts +8 -0
  147. package/dist/generic/src/errors/scheduler/scheduler-errors.d.ts.map +1 -0
  148. package/dist/generic/src/errors/scheduler/scheduler-errors.js +14 -0
  149. package/dist/generic/src/errors/share-data/share-data-errors.d.ts +67 -0
  150. package/dist/generic/src/errors/share-data/share-data-errors.d.ts.map +1 -0
  151. package/dist/generic/src/errors/share-data/share-data-errors.js +92 -0
  152. package/dist/generic/src/helpers/crypto/cryptography-helpers.d.ts +37 -0
  153. package/dist/generic/src/helpers/crypto/cryptography-helpers.d.ts.map +1 -0
  154. package/dist/generic/src/helpers/crypto/cryptography-helpers.js +65 -0
  155. package/dist/generic/src/helpers/object-validation-helpers.d.ts +66 -0
  156. package/dist/generic/src/helpers/object-validation-helpers.d.ts.map +1 -0
  157. package/dist/generic/src/helpers/object-validation-helpers.js +254 -0
  158. package/dist/generic/src/models/application/audit-log/application-audit-log-models.d.ts +87 -0
  159. package/dist/generic/src/models/application/audit-log/application-audit-log-models.d.ts.map +1 -0
  160. package/dist/generic/src/models/application/audit-log/application-audit-log-models.js +59 -0
  161. package/dist/generic/src/models/application/database/firestore-models.d.ts +84 -0
  162. package/dist/generic/src/models/application/database/firestore-models.d.ts.map +1 -0
  163. package/dist/generic/src/models/application/database/firestore-models.js +4 -0
  164. package/dist/generic/src/models/authorization/authorization-models.d.ts +81 -0
  165. package/dist/generic/src/models/authorization/authorization-models.d.ts.map +1 -0
  166. package/dist/generic/src/models/authorization/authorization-models.js +33 -0
  167. package/dist/generic/src/models/crypto/crypto-models.d.ts +5 -0
  168. package/dist/generic/src/models/crypto/crypto-models.d.ts.map +1 -0
  169. package/dist/generic/src/models/crypto/crypto-models.js +3 -0
  170. package/dist/generic/src/models/data/data-models.d.ts +24 -0
  171. package/dist/generic/src/models/data/data-models.d.ts.map +1 -0
  172. package/dist/generic/src/models/data/data-models.js +3 -0
  173. package/dist/generic/src/models/dynamic-execution/dynamic-execution-models.d.ts +9 -0
  174. package/dist/generic/src/models/dynamic-execution/dynamic-execution-models.d.ts.map +1 -0
  175. package/dist/generic/src/models/dynamic-execution/dynamic-execution-models.js +2 -0
  176. package/dist/generic/src/models/events/share-event-models.d.ts +65 -0
  177. package/dist/generic/src/models/events/share-event-models.d.ts.map +1 -0
  178. package/dist/generic/src/models/events/share-event-models.js +70 -0
  179. package/dist/generic/src/models/functions/share-data-function-models.d.ts +86 -0
  180. package/dist/generic/src/models/functions/share-data-function-models.d.ts.map +1 -0
  181. package/dist/generic/src/models/functions/share-data-function-models.js +17 -0
  182. package/dist/generic/src/models/generic/request-response-models.d.ts +8 -0
  183. package/dist/generic/src/models/generic/request-response-models.d.ts.map +1 -0
  184. package/dist/generic/src/models/generic/request-response-models.js +2 -0
  185. package/dist/generic/src/models/index.d.ts +13 -0
  186. package/dist/generic/src/models/index.d.ts.map +1 -0
  187. package/dist/generic/src/models/index.js +29 -0
  188. package/dist/generic/src/models/rules/share-rule-models.d.ts +303 -0
  189. package/dist/generic/src/models/rules/share-rule-models.d.ts.map +1 -0
  190. package/dist/generic/src/models/rules/share-rule-models.js +93 -0
  191. package/dist/generic/src/models/safe/safe-transaction-models.d.ts +81 -0
  192. package/dist/generic/src/models/safe/safe-transaction-models.d.ts.map +1 -0
  193. package/dist/generic/src/models/safe/safe-transaction-models.js +26 -0
  194. package/dist/generic/src/models/share-data/share-data.d.ts +56 -0
  195. package/dist/generic/src/models/share-data/share-data.d.ts.map +1 -0
  196. package/dist/generic/src/models/share-data/share-data.js +20 -0
  197. package/package.json +4 -3
  198. package/dist/cors/authority/audience/set-audience-authority.d.ts +0 -1
  199. package/dist/cors/authority/audience/set-audience-authority.d.ts.map +0 -1
  200. package/dist/cors/authority/audience/set-audience-authority.js +0 -1
  201. package/dist/cors/authority/jwt/validate-jwt-authority.d.ts +0 -1
  202. package/dist/cors/authority/jwt/validate-jwt-authority.d.ts.map +0 -1
  203. package/dist/cors/authority/jwt/validate-jwt-authority.js +0 -1
  204. package/dist/cors/errors/all-error-handler.d.ts.map +0 -1
  205. package/dist/cors/errors/bad-request-handler.d.ts +0 -12
  206. package/dist/cors/errors/bad-request-handler.d.ts.map +0 -1
  207. package/dist/cors/errors/unauthorized-handler.d.ts +0 -12
  208. package/dist/cors/errors/unauthorized-handler.d.ts.map +0 -1
  209. package/dist/cors/index.d.ts +0 -4
  210. package/dist/cors/index.d.ts.map +0 -1
  211. /package/dist/{index.d.ts → endpoints/src/index.d.ts} +0 -0
  212. /package/dist/{index.js → endpoints/src/index.js} +0 -0
@@ -0,0 +1,254 @@
1
+ "use strict";
2
+ // This file contains the validation functions for objects.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.validateUrl = exports.validateStringHex = exports.validateString = exports.validateNumber = exports.validateDate = exports.validateBoolean = exports.validateArray = void 0;
5
+ /**
6
+ * Checks that an object is an array and that it has the minimum number of items.
7
+ *
8
+ * @param incomingObject the object to check
9
+ * @param minimumLength the minimum number of objects to match (zero by default)
10
+ * @param maximumLength the maximum number of objects to match will default to the array length if not provided
11
+ *
12
+ * @returns whether the criteria matches.
13
+ */
14
+ const validateArray = (incomingObject, minimumLength = 0, maximumLength) => {
15
+ if (incomingObject && Array.isArray(incomingObject) && incomingObject.length >= minimumLength) {
16
+ if (!maximumLength) {
17
+ return true;
18
+ }
19
+ else {
20
+ if (incomingObject.length <= maximumLength) {
21
+ return true;
22
+ }
23
+ else {
24
+ return false;
25
+ }
26
+ }
27
+ }
28
+ else {
29
+ return false;
30
+ }
31
+ };
32
+ exports.validateArray = validateArray;
33
+ /**
34
+ * This validates an incoming shape of a boolean type data.
35
+ *
36
+ * @param incomingObject an object to validate as a boolean.
37
+ * @param undefinedValid whether the item can be undefined or not (false by default)
38
+ *
39
+ * @returns whether the shape is valid.
40
+ */
41
+ const validateBoolean = (incomingObject, undefinedValid = false) => {
42
+ if (undefinedValid && typeof incomingObject === 'undefined') { // if undefined is valid and it"s undefined
43
+ return true;
44
+ }
45
+ if (typeof incomingObject === 'boolean') {
46
+ return true;
47
+ }
48
+ else {
49
+ return false;
50
+ }
51
+ };
52
+ exports.validateBoolean = validateBoolean;
53
+ /**
54
+ * This validates a date object or a string that can be converted to a date object.
55
+ * @param dateToValidate the date to validate
56
+ * @param undefinedValid whether the item can be undefined or not (false by default)
57
+ * @param allowFutureDated the date can be in the future (false by default)
58
+ * @param ensureAtLeast18YearsAgo whether the date is at least 18 years ago (true by default)
59
+ *
60
+ * @returns
61
+ */
62
+ const validateDate = (dateToValidate, undefinedValid = false, allowFutureDated = false, ensureAtLeast18YearsAgo = false) => {
63
+ if (undefinedValid && (typeof dateToValidate === 'undefined' || dateToValidate === '' || dateToValidate === null)) {
64
+ return true;
65
+ }
66
+ let date; // a placeholder for the date object
67
+ if (typeof dateToValidate === 'string') {
68
+ date = new Date(dateToValidate); // try to parse the date
69
+ if (isNaN(date.getTime())) { // if it's not a valid date
70
+ return false; // return false
71
+ }
72
+ return true;
73
+ }
74
+ else {
75
+ if (!(typeof dateToValidate === 'object' && dateToValidate !== null)) {
76
+ return false; // the date isn't an object
77
+ }
78
+ if (Object.prototype.toString.call(dateToValidate) !== '[object Date]') {
79
+ return false; // the date isn't a date object
80
+ }
81
+ // Check if the date is in the future and this is not allowed
82
+ if (!allowFutureDated && dateToValidate > new Date()) {
83
+ return false;
84
+ }
85
+ // determine if the date is newer than 18 years in the past
86
+ if (ensureAtLeast18YearsAgo) {
87
+ const today = new Date();
88
+ const eighteenYearsAgo = new Date(today.getFullYear() - 18, today.getMonth(), today.getDate());
89
+ return dateToValidate <= eighteenYearsAgo;
90
+ }
91
+ // otherwise the date is valid.
92
+ return true;
93
+ }
94
+ };
95
+ exports.validateDate = validateDate;
96
+ /**
97
+ * This validates that the incoming Object is a number and that it is in the range (if provided)
98
+ *
99
+ * @param incomingObject object to validate to a number
100
+ * @param min (optional) minimum number
101
+ * @param max (optional) maximum number
102
+ * @returns
103
+ */
104
+ const validateNumber = (incomingObject, min, max) => {
105
+ if (typeof incomingObject === 'number') {
106
+ if (validateMin(incomingObject, min) && validateMax(incomingObject, max)) {
107
+ return true;
108
+ }
109
+ else {
110
+ return false;
111
+ }
112
+ }
113
+ else {
114
+ return false;
115
+ }
116
+ };
117
+ exports.validateNumber = validateNumber;
118
+ /**
119
+ * This validates an incoming shape of a set of files links to the data.
120
+ *
121
+ * @param incomingObject an object to validate as a string.
122
+ * @param hasNoSpaces whether the item should have no spaces in it (false by default)
123
+ * @param undefinedValid whether the item can be undefined or not (false by default)
124
+ * @param emptyStringValid whether the item can be an empty string or not (false by default)
125
+ *
126
+ * @returns whether the shape is valid.
127
+ */
128
+ const validateString = (incomingObject, hasNoSpaces = false, undefinedValid = false, emptyStringValid = false) => {
129
+ // if undefined is valid and check if it's undefined and if so, return true
130
+ if (undefinedValid) {
131
+ if (typeof incomingObject === 'undefined') { // if undefined is valid and it"s undefined
132
+ return true;
133
+ }
134
+ if (incomingObject === null) { // include null values.
135
+ return true;
136
+ }
137
+ }
138
+ // Check if the string is empty and if it's valid to be empty
139
+ if (emptyStringValid) {
140
+ if (typeof incomingObject === 'string' && incomingObject.length === 0) {
141
+ return true;
142
+ }
143
+ }
144
+ // if it's a string and it's not empty
145
+ if (typeof incomingObject === 'string') {
146
+ // check that it is a string and that it is not empty
147
+ if (incomingObject.length === 0) {
148
+ return false;
149
+ }
150
+ // check if it has no spaces
151
+ if (hasNoSpaces) {
152
+ return incomingObject.indexOf(' ') === -1;
153
+ }
154
+ // otherwise it's a valid string
155
+ return true;
156
+ }
157
+ else {
158
+ return false;
159
+ }
160
+ };
161
+ exports.validateString = validateString;
162
+ /**
163
+ * This validates that an incoming object is a valid hex string without spaces.
164
+ *
165
+ * @param incomingObject the object to validate
166
+ * @returns
167
+ */
168
+ const validateStringHex = (incomingObject) => {
169
+ // make sure its a string
170
+ const isStringWithoutSpaces = validateString(incomingObject, true, false, false);
171
+ // make sure its a valid hex string
172
+ if (!isStringWithoutSpaces) {
173
+ return false;
174
+ }
175
+ // check that it is a hex string
176
+ const hexStringRegexp = /^[0-9a-fA-F]+$/;
177
+ if (!hexStringRegexp.test(incomingObject)) {
178
+ return false;
179
+ }
180
+ return true;
181
+ };
182
+ exports.validateStringHex = validateStringHex;
183
+ /**
184
+ * This validates that an incoming object is a valid URL.
185
+ *
186
+ * @param incomingUrl the URL to check
187
+ * @param undefinedValid whether the item can be undefined or not (false by default)
188
+ * @returns wether it is a valid URL or not
189
+ */
190
+ const validateUrl = (incomingUrl, undefinedValid = false) => {
191
+ if (undefinedValid && (typeof incomingUrl === 'undefined' || incomingUrl === '')) { // if undefined is valid and it"s undefined
192
+ return true;
193
+ }
194
+ if (typeof incomingUrl !== 'string') {
195
+ return false;
196
+ }
197
+ if (incomingUrl.indexOf(' ') !== -1) {
198
+ return false;
199
+ }
200
+ //Is it recognized as a valid URL?
201
+ let givenURL;
202
+ try {
203
+ givenURL = new URL(incomingUrl);
204
+ //Is the domain name a valid one with TLD and using HTTP or HTTPS?
205
+ const validDomainRegexp = /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/im;
206
+ return validDomainRegexp.test(givenURL.host) && (givenURL.protocol === 'http:' || givenURL.protocol === 'https:');
207
+ }
208
+ catch (error) {
209
+ return false;
210
+ }
211
+ };
212
+ exports.validateUrl = validateUrl;
213
+ //#endregion Public Functions
214
+ //#region Internal Functions
215
+ /**
216
+ * validates that an incoming number is greater than the minimum if it was provided.
217
+ *
218
+ * @param incomingNumber the number to check
219
+ * @param min the minimum value.
220
+ * @returns
221
+ */
222
+ const validateMin = (incomingNumber, min) => {
223
+ if (typeof min === 'number') {
224
+ if (incomingNumber >= min) {
225
+ return true;
226
+ }
227
+ else {
228
+ return false;
229
+ }
230
+ }
231
+ else {
232
+ return true;
233
+ }
234
+ };
235
+ /**
236
+ * validates that an incoming number is less than or equal to the mamimum if it was provided.
237
+ *
238
+ * @param incomingNumber the number to check
239
+ * @param max the maximum value.
240
+ * @returns
241
+ */
242
+ const validateMax = (incomingNumber, max) => {
243
+ if (typeof max === 'number') {
244
+ if (incomingNumber <= max) {
245
+ return true;
246
+ }
247
+ else {
248
+ return false;
249
+ }
250
+ }
251
+ else {
252
+ return true;
253
+ }
254
+ };
@@ -0,0 +1,87 @@
1
+ /**
2
+ * This contains interfaces for the audit logs that are generated in the system.
3
+ * This type of audit log is used to create and log application functions within a non structured database.
4
+ */
5
+ export type IApplicationAuditLog = IApplicationAuditLogUnstructured;
6
+ /**
7
+ * This is an application audit log.
8
+ */
9
+ export interface IApplicationAuditLogUnstructured {
10
+ additionalAuditLogIds: IAdditionalApplicationAuditLogIds[];
11
+ applicationAuditLogAction: ApplicationAuditLogAction;
12
+ applicationAuditLogType: ApplicationAuditLogType;
13
+ applicationAuditLogSubType: ApplicationAuditLogSubType;
14
+ createdAt: number;
15
+ createdBy: string;
16
+ currentData?: any;
17
+ previousData?: any;
18
+ }
19
+ /**
20
+ * This contains the additional audit log Ids in order of the access in the application
21
+ * for database this would be the reference path and reference Id
22
+ * for User Financial data this would be
23
+ * [
24
+ * { referencePath: 'Administrator', referenceId: '{{ administratorId }} ' }, // These are every path downstream from the root data
25
+ * { referencePath: 'Accounts', referenceId: '{{ accountId }}' },
26
+ * ]
27
+ *
28
+ * These are available in the helper files based on the Application Audit Log Sub Types.
29
+ */
30
+ export interface IAdditionalApplicationAuditLogIds {
31
+ referencePath: string;
32
+ referenceId: string;
33
+ }
34
+ /**
35
+ * This contains the enum for the audit log actions.
36
+ */
37
+ export declare enum ApplicationAuditLogAction {
38
+ create = "create",
39
+ update = "update",
40
+ delete = "delete",
41
+ read = "read",
42
+ list = "list",
43
+ file = "file"
44
+ }
45
+ /**
46
+ * This contains the model for the audit logs that are generated in the system.
47
+ */
48
+ export declare enum ApplicationAuditLogType {
49
+ authorizedAuthority = "authorizedAuthority",// the authorized authority audit log
50
+ global = "global"
51
+ }
52
+ /**
53
+ * This contains the enum for the audit log sub types for the multiple path classes.
54
+ */
55
+ export declare enum MultiplePathAuditLogSubType {
56
+ multiplePathALAI = "multiplePathALAI"
57
+ }
58
+ /**
59
+ * This contains the interface for keeping the query audit log and value.
60
+ */
61
+ export interface IQueryObjectAndValueForAuditLog {
62
+ queryObject: string;
63
+ queryValue: string | number | boolean;
64
+ }
65
+ /**
66
+ * This contains the enum for the audit log sub types.
67
+ */
68
+ export type ApplicationAuditLogSubType = AdministrationAuditLogSubType | UserAuditLogSubType | PublicDataAuditLogSubType | MultiplePathAuditLogSubType;
69
+ /**
70
+ * This contains the enum for the audit log sub types for the administrator classes.
71
+ */
72
+ export declare enum AdministrationAuditLogSubType {
73
+ administrator = "administrator"
74
+ }
75
+ /**
76
+ * This contains the enum for the audit log sub types for the user classes.
77
+ */
78
+ export declare enum UserAuditLogSubType {
79
+ profile = "profile"
80
+ }
81
+ /**
82
+ * This contains the enum for the audit log sub types for the public data classes.
83
+ */
84
+ export declare enum PublicDataAuditLogSubType {
85
+ userRelatedProfile = "userRelatedProfile"
86
+ }
87
+ //# sourceMappingURL=application-audit-log-models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application-audit-log-models.d.ts","sourceRoot":"","sources":["../../../../../../../generic/src/models/application/audit-log/application-audit-log-models.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAIH,MAAM,MAAM,oBAAoB,GAAG,gCAAgC,CAAC;AACpE;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC7C,qBAAqB,EAAE,iCAAiC,EAAE,CAAC;IAC3D,yBAAyB,EAAE,yBAAyB,CAAC;IACrD,uBAAuB,EAAE,uBAAuB,CAAC;IACjD,0BAA0B,EAAE,0BAA0B,CAAC;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,YAAY,CAAC,EAAE,GAAG,CAAC;CACtB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iCAAiC;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,oBAAY,yBAAyB;IACjC,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;CAChB;AAED;;GAEG;AACH,oBAAY,uBAAuB;IAC/B,mBAAmB,wBAAwB,CAAE,qCAAqC;IAClF,MAAM,WAAW;CACpB;AAKD;;GAEG;AACH,oBAAY,2BAA2B;IACnC,gBAAgB,qBAAqB;CACxC;AAMD;;GAEG;AACH,MAAM,WAAW,+BAA+B;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CACzC;AAMD;;GAEG;AAEH,MAAM,MAAM,0BAA0B,GAAG,6BAA6B,GAAG,mBAAmB,GAAG,yBAAyB,GAClH,2BAA2B,CAAC;AAIlC;;GAEG;AACH,oBAAY,6BAA6B;IACrC,aAAa,kBAAkB;CAClC;AAMD;;GAEG;AACH,oBAAY,mBAAmB;IAC3B,OAAO,YAAY;CACtB;AAMD;;GAEG;AACH,oBAAY,yBAAyB;IACjC,kBAAkB,uBAAuB;CAC5C"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.PublicDataAuditLogSubType = exports.UserAuditLogSubType = exports.AdministrationAuditLogSubType = exports.MultiplePathAuditLogSubType = exports.ApplicationAuditLogType = exports.ApplicationAuditLogAction = void 0;
5
+ /**
6
+ * This contains the enum for the audit log actions.
7
+ */
8
+ var ApplicationAuditLogAction;
9
+ (function (ApplicationAuditLogAction) {
10
+ ApplicationAuditLogAction["create"] = "create";
11
+ ApplicationAuditLogAction["update"] = "update";
12
+ ApplicationAuditLogAction["delete"] = "delete";
13
+ ApplicationAuditLogAction["read"] = "read";
14
+ ApplicationAuditLogAction["list"] = "list";
15
+ ApplicationAuditLogAction["file"] = "file";
16
+ })(ApplicationAuditLogAction || (exports.ApplicationAuditLogAction = ApplicationAuditLogAction = {}));
17
+ /**
18
+ * This contains the model for the audit logs that are generated in the system.
19
+ */
20
+ var ApplicationAuditLogType;
21
+ (function (ApplicationAuditLogType) {
22
+ ApplicationAuditLogType["authorizedAuthority"] = "authorizedAuthority";
23
+ ApplicationAuditLogType["global"] = "global";
24
+ })(ApplicationAuditLogType || (exports.ApplicationAuditLogType = ApplicationAuditLogType = {}));
25
+ //#region Multiple Path Audit Log Types
26
+ /**
27
+ * This contains the enum for the audit log sub types for the multiple path classes.
28
+ */
29
+ var MultiplePathAuditLogSubType;
30
+ (function (MultiplePathAuditLogSubType) {
31
+ MultiplePathAuditLogSubType["multiplePathALAI"] = "multiplePathALAI";
32
+ })(MultiplePathAuditLogSubType || (exports.MultiplePathAuditLogSubType = MultiplePathAuditLogSubType = {}));
33
+ //#region Administration Audit Log Types
34
+ /**
35
+ * This contains the enum for the audit log sub types for the administrator classes.
36
+ */
37
+ var AdministrationAuditLogSubType;
38
+ (function (AdministrationAuditLogSubType) {
39
+ AdministrationAuditLogSubType["administrator"] = "administrator";
40
+ })(AdministrationAuditLogSubType || (exports.AdministrationAuditLogSubType = AdministrationAuditLogSubType = {}));
41
+ // #endregion Administration Audit Log Types
42
+ //#region User Audit Log Types
43
+ /**
44
+ * This contains the enum for the audit log sub types for the user classes.
45
+ */
46
+ var UserAuditLogSubType;
47
+ (function (UserAuditLogSubType) {
48
+ UserAuditLogSubType["profile"] = "profile";
49
+ })(UserAuditLogSubType || (exports.UserAuditLogSubType = UserAuditLogSubType = {}));
50
+ //#endregion User Audit Log Types
51
+ //#region Public Data audit log types
52
+ /**
53
+ * This contains the enum for the audit log sub types for the public data classes.
54
+ */
55
+ var PublicDataAuditLogSubType;
56
+ (function (PublicDataAuditLogSubType) {
57
+ PublicDataAuditLogSubType["userRelatedProfile"] = "userRelatedProfile";
58
+ })(PublicDataAuditLogSubType || (exports.PublicDataAuditLogSubType = PublicDataAuditLogSubType = {}));
59
+ //#endregion Public Data audit log types
@@ -0,0 +1,84 @@
1
+ import { CollectionReference, DocumentReference } from 'firebase-admin/firestore';
2
+ import * as admin from 'firebase-admin';
3
+ import { IAdditionalApplicationAuditLogIds, ApplicationAuditLogSubType, IApplicationAuditLog } from '../audit-log/application-audit-log-models';
4
+ /**
5
+ * This contains the information that is needed to pass a change to the generic database functions.
6
+ */
7
+ export interface IDatabaseChangeInformation {
8
+ alai: IAdditionalApplicationAuditLogIds[];
9
+ auditLogSubType: ApplicationAuditLogSubType;
10
+ item: unknown;
11
+ itemDocRef: DocumentReference;
12
+ }
13
+ /**
14
+ * This contains the information that is needed to pass a change to the generic database functions.
15
+ * It allows for a property of an object to be retrieved and updated without needing the original
16
+ * object when called.
17
+ */
18
+ export interface IDatabasePropertyChangeInformation {
19
+ alai: IAdditionalApplicationAuditLogIds[];
20
+ auditLogSubType: ApplicationAuditLogSubType;
21
+ partialObjectUpdate: any;
22
+ itemDocRef: DocumentReference;
23
+ }
24
+ /**
25
+ * This contains the information records and audit logs for database changes
26
+ */
27
+ export interface IDatabaseUpdates {
28
+ recordsandRefs: IDatabaseRecordAndRef[];
29
+ auditLogInfo: IApplicationAuditLog;
30
+ }
31
+ /**
32
+ * This contains the database record and document reference to update.
33
+ */
34
+ export interface IDatabaseRecordAndRef {
35
+ record: unknown;
36
+ recordDocRef: DocumentReference;
37
+ }
38
+ /**
39
+ * This contains the information to get a single item from the database.
40
+ */
41
+ export interface IDatabaseGetItem extends IDatabaseAuditLogUpdates {
42
+ itemDocRef: DocumentReference;
43
+ throwErrorOnNotFound: boolean;
44
+ }
45
+ /**
46
+ * This contains the information that is needed to get multiple items from the database.
47
+ */
48
+ export interface IDatabaseGetInformation extends IDatabaseAuditLogUpdates {
49
+ itemColRef: CollectionReference;
50
+ lastId: string;
51
+ orderBy?: IDatabaseOrderBy;
52
+ queryFields: IDatabaseQueryFields[];
53
+ isMaxSizeDocumentSet?: boolean;
54
+ }
55
+ /**
56
+ * This contains the information that is needed to get information from the database.
57
+ */
58
+ export interface IDatabaseOrderBy {
59
+ fieldPath: string | admin.firestore.FieldPath;
60
+ direction: admin.firestore.OrderByDirection;
61
+ }
62
+ /**
63
+ * This contains the query information for the database if it is required
64
+ */
65
+ export interface IDatabaseQueryFields {
66
+ fieldPath: string | admin.firestore.FieldPath;
67
+ opStr: admin.firestore.WhereFilterOp;
68
+ value: any;
69
+ }
70
+ /**
71
+ * This contains the information to delete a single item from the database.
72
+ */
73
+ export interface IDatabaseDeleteItem extends IDatabaseAuditLogUpdates {
74
+ itemDocRef: DocumentReference;
75
+ throwErrorOnNotFound: boolean;
76
+ }
77
+ /**
78
+ * This contains the additional information audit logs.
79
+ */
80
+ export interface IDatabaseAuditLogUpdates {
81
+ alai: IAdditionalApplicationAuditLogIds[];
82
+ auditLogSubType: ApplicationAuditLogSubType;
83
+ }
84
+ //# sourceMappingURL=firestore-models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firestore-models.d.ts","sourceRoot":"","sources":["../../../../../../../generic/src/models/application/database/firestore-models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClF,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EACH,iCAAiC,EACjC,0BAA0B,EAC1B,oBAAoB,EACvB,MAAM,2CAA2C,CAAC;AAMnD;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACvC,IAAI,EAAE,iCAAiC,EAAE,CAAC;IAC1C,eAAe,EAAE,0BAA0B,CAAC;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,iBAAiB,CAAC;CACjC;AAED;;;;GAIG;AACH,MAAM,WAAW,kCAAkC;IAC/C,IAAI,EAAE,iCAAiC,EAAE,CAAC;IAC1C,eAAe,EAAE,0BAA0B,CAAC;IAE5C,mBAAmB,EAAE,GAAG,CAAC;IACzB,UAAU,EAAE,iBAAiB,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,cAAc,EAAE,qBAAqB,EAAE,CAAC;IACxC,YAAY,EAAE,oBAAoB,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,iBAAiB,CAAC;CACnC;AAMD;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,wBAAwB;IAC9D,UAAU,EAAE,iBAAiB,CAAC;IAC9B,oBAAoB,EAAE,OAAO,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,wBAAwB;IACrE,UAAU,EAAE,mBAAmB,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,WAAW,EAAE,oBAAoB,EAAE,CAAC;IACpC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC;IAC9C,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC;IAC9C,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC;IAErC,KAAK,EAAE,GAAG,CAAC;CACd;AAMD;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,wBAAwB;IACjE,UAAU,EAAE,iBAAiB,CAAC;IAC9B,oBAAoB,EAAE,OAAO,CAAC;CACjC;AAMD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,IAAI,EAAE,iCAAiC,EAAE,CAAC;IAC1C,eAAe,EAAE,0BAA0B,CAAC;CAC/C"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //#endregion Audit Log Information
4
+ //#endregion Backend Data Models
@@ -0,0 +1,81 @@
1
+ /**
2
+ * This is the authorities that can be validated with incoming requests.
3
+ * it is AuthorityName Declaration-with ending of the original hex version of the publickey, publickey for the authority
4
+ */
5
+ export type IJWTAuthority = Map<IAuthorizationIssuer, string>;
6
+ /**
7
+ * This contains the types of validation that can be done on the authority.
8
+ */
9
+ export declare enum AuthorityValidationType {
10
+ JWT = "jwt"
11
+ }
12
+ /**
13
+ * This is the payload for the jwt.
14
+ */
15
+ export interface IAuthorizationPayload {
16
+ [key: string]: any;
17
+ }
18
+ /**
19
+ * This is the header for the jwt.
20
+ */
21
+ export interface IAuthorizationHeader {
22
+ alg: string;
23
+ typ: string;
24
+ }
25
+ /**
26
+ * This is the audience that the jwt is intended for.
27
+ */
28
+ export declare enum AuthorizationAudience {
29
+ AUTHORITIES = "authorities",// the authorities in the SAFE Ecosystem
30
+ SHAREDATA = "sharedata",// the Share Data in the SAFE Ecosystem
31
+ FUNCTIONS = "functions",// the functions in the SAFE Ecosystem
32
+ RULES = "rules",// the rules in the SAFE Ecosystem
33
+ EVENTS = "events",// the events in the SAFE Ecosystem
34
+ ENDPOINTS = "endpoints"
35
+ }
36
+ /**
37
+ * This contains the start of the subject for the authorization subject
38
+ */
39
+ export declare enum AuthorizationSubjectStart {
40
+ USER = "user",
41
+ SAFE_NETWORK = "safe-network"
42
+ }
43
+ /**
44
+ * This type represents the formatted authorization subject.
45
+ */
46
+ export type IAuthorizationSubject = `${AuthorizationSubjectStart}:${string}`;
47
+ /**
48
+ * This is the issuer of the token.
49
+ */
50
+ export type IAuthorizationIssuer = `${string}-${string}`;
51
+ /**
52
+ * Any custom network claims that are added to the token.
53
+ */
54
+ export interface ICustomClaims {
55
+ [key: string]: any;
56
+ }
57
+ /**
58
+ * This interface represents the valid safe token payload (after deconstructing the jwt token).
59
+ */
60
+ export interface IValidSafeTokenPayload {
61
+ [key: string]: any;
62
+ aud: AuthorizationAudience;
63
+ exp: number;
64
+ iat: number;
65
+ nbf: number;
66
+ sub: IAuthorizationSubject;
67
+ iss: IAuthorizationIssuer;
68
+ }
69
+ /**
70
+ * This is the decoded jwt token.
71
+ */
72
+ export interface IDecodedJwtToken {
73
+ customClaims?: ICustomClaims;
74
+ aud: AuthorizationAudience;
75
+ exp: number;
76
+ iat: number;
77
+ nbf: number;
78
+ sub: IAuthorizationSubject;
79
+ iss: IAuthorizationIssuer;
80
+ }
81
+ //# sourceMappingURL=authorization-models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization-models.d.ts","sourceRoot":"","sources":["../../../../../../generic/src/models/authorization/authorization-models.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;AAG9D;;GAEG;AACH,oBAAY,uBAAuB;IAC/B,GAAG,QAAQ;CACd;AAOD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,oBAAY,qBAAqB;IAC7B,WAAW,gBAAgB,CAAE,wCAAwC;IACrE,SAAS,cAAc,CAAE,uCAAuC;IAChE,SAAS,cAAc,CAAE,sCAAsC;IAC/D,KAAK,UAAU,CAAE,kCAAkC;IACnD,MAAM,WAAW,CAAE,mCAAmC;IACtD,SAAS,cAAc;CAC1B;AAED;;GAEG;AACH,oBAAY,yBAAyB;IACjC,IAAI,SAAS;IACb,YAAY,iBAAiB;CAChC;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,GAAG,yBAAyB,IAAI,MAAM,EAAE,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAIzD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,GAAG,EAAE,qBAAqB,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,qBAAqB,CAAC;IAC3B,GAAG,EAAE,oBAAoB,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,GAAG,EAAE,qBAAqB,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,qBAAqB,CAAC;IAC3B,GAAG,EAAE,oBAAoB,CAAC;CAC7B"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ // This file contains the models for the authorization.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AuthorizationSubjectStart = exports.AuthorizationAudience = exports.AuthorityValidationType = void 0;
5
+ /**
6
+ * This contains the types of validation that can be done on the authority.
7
+ */
8
+ var AuthorityValidationType;
9
+ (function (AuthorityValidationType) {
10
+ AuthorityValidationType["JWT"] = "jwt";
11
+ })(AuthorityValidationType || (exports.AuthorityValidationType = AuthorityValidationType = {}));
12
+ /**
13
+ * This is the audience that the jwt is intended for.
14
+ */
15
+ var AuthorizationAudience;
16
+ (function (AuthorizationAudience) {
17
+ AuthorizationAudience["AUTHORITIES"] = "authorities";
18
+ AuthorizationAudience["SHAREDATA"] = "sharedata";
19
+ AuthorizationAudience["FUNCTIONS"] = "functions";
20
+ AuthorizationAudience["RULES"] = "rules";
21
+ AuthorizationAudience["EVENTS"] = "events";
22
+ AuthorizationAudience["ENDPOINTS"] = "endpoints";
23
+ })(AuthorizationAudience || (exports.AuthorizationAudience = AuthorizationAudience = {}));
24
+ /**
25
+ * This contains the start of the subject for the authorization subject
26
+ */
27
+ var AuthorizationSubjectStart;
28
+ (function (AuthorizationSubjectStart) {
29
+ AuthorizationSubjectStart["USER"] = "user";
30
+ AuthorizationSubjectStart["SAFE_NETWORK"] = "safe-network";
31
+ })(AuthorizationSubjectStart || (exports.AuthorizationSubjectStart = AuthorizationSubjectStart = {}));
32
+ //#region jwt header models
33
+ //#endregion jwt models
@@ -0,0 +1,5 @@
1
+ export interface IPublicPrivateKeyDerPair {
2
+ privateKeyDer: string;
3
+ publicKeyDer: string;
4
+ }
5
+ //# sourceMappingURL=crypto-models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto-models.d.ts","sourceRoot":"","sources":["../../../../../../generic/src/models/crypto/crypto-models.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,wBAAwB;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACxB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file contains the models use in the cryptography functions of this library.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,24 @@
1
+ /**
2
+ * This contains the minimum information that is needed on a data record.
3
+ */
4
+ export interface IGenericData {
5
+ createdAt: number;
6
+ createdBy: string;
7
+ updatedAt: number;
8
+ updatedBy: string;
9
+ versionNumber: number;
10
+ }
11
+ /**
12
+ * This contains the data for an item with a searchable index.
13
+ * for the word 'found' this object would look like this:
14
+ * {
15
+ * f: true,
16
+ * fo: true,
17
+ * fou: true,
18
+ * foun: true,
19
+ * found: true,
20
+ */
21
+ export interface ISearchableIndex {
22
+ [key: string]: true;
23
+ }
24
+ //# sourceMappingURL=data-models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-models.d.ts","sourceRoot":"","sources":["../../../../../../generic/src/models/data/data-models.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ /// This contains the models for data in the degenerate package
3
+ Object.defineProperty(exports, "__esModule", { value: true });