corebasic 1.0.212 → 1.0.213

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 (141) hide show
  1. package/dist/index.js +10 -0
  2. package/dist/libs/ObjectId.js +114 -0
  3. package/dist/libs/auth.js +103 -0
  4. package/dist/libs/compression.js +11 -0
  5. package/dist/libs/cpp.js +154 -0
  6. package/dist/libs/dip/suffix/date.js +89 -0
  7. package/dist/libs/dip/suffix/index.js +227 -0
  8. package/dist/libs/dip/suffix/policy.js +113 -0
  9. package/dist/libs/dip/suffix/query.js +279 -0
  10. package/dist/libs/dip/suffix/suffix.js +99 -0
  11. package/dist/libs/dip/suffix/tests/date.test.js +187 -0
  12. package/dist/libs/dip/suffix/tests/index.test.js +441 -0
  13. package/dist/libs/dip/suffix/tests/policy.applySuffixPolicy.test.js +489 -0
  14. package/dist/libs/dip/suffix/tests/policy.test.js +329 -0
  15. package/dist/libs/dip/suffix/tests/suffix.test.js +316 -0
  16. package/dist/libs/dip.js +102 -0
  17. package/dist/libs/dipper.js +73 -0
  18. package/dist/libs/elabase.js +656 -0
  19. package/dist/libs/features.js +366 -0
  20. package/dist/libs/kafka.js +121 -0
  21. package/dist/libs/messaging.js +130 -0
  22. package/dist/libs/mobilecodes.js +562 -0
  23. package/dist/libs/session.js +96 -0
  24. package/dist/libs/utils.js +297 -0
  25. package/package.json +3 -2
  26. package/tsc/@typescript/typescript-linux-x64/LICENSE +55 -0
  27. package/tsc/@typescript/typescript-linux-x64/NOTICE.txt +436 -0
  28. package/tsc/@typescript/typescript-linux-x64/README.md +3 -0
  29. package/tsc/@typescript/typescript-linux-x64/lib/lib.d.ts +20 -0
  30. package/tsc/@typescript/typescript-linux-x64/lib/lib.decorators.d.ts +382 -0
  31. package/tsc/@typescript/typescript-linux-x64/lib/lib.decorators.legacy.d.ts +20 -0
  32. package/tsc/@typescript/typescript-linux-x64/lib/lib.dom.asynciterable.d.ts +18 -0
  33. package/tsc/@typescript/typescript-linux-x64/lib/lib.dom.d.ts +45125 -0
  34. package/tsc/@typescript/typescript-linux-x64/lib/lib.dom.iterable.d.ts +18 -0
  35. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2015.collection.d.ts +159 -0
  36. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2015.core.d.ts +595 -0
  37. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2015.d.ts +26 -0
  38. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2015.generator.d.ts +75 -0
  39. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2015.iterable.d.ts +603 -0
  40. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2015.promise.d.ts +79 -0
  41. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2015.proxy.d.ts +126 -0
  42. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2015.reflect.d.ts +142 -0
  43. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2015.symbol.d.ts +44 -0
  44. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2015.symbol.wellknown.d.ts +324 -0
  45. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2016.array.include.d.ts +114 -0
  46. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2016.d.ts +19 -0
  47. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2016.full.d.ts +21 -0
  48. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2016.intl.d.ts +29 -0
  49. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2017.arraybuffer.d.ts +19 -0
  50. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2017.d.ts +24 -0
  51. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2017.date.d.ts +29 -0
  52. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2017.full.d.ts +21 -0
  53. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2017.intl.d.ts +42 -0
  54. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2017.object.d.ts +47 -0
  55. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2017.sharedmemory.d.ts +133 -0
  56. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2017.string.d.ts +47 -0
  57. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2017.typedarrays.d.ts +51 -0
  58. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2018.asyncgenerator.d.ts +75 -0
  59. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2018.asynciterable.d.ts +51 -0
  60. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2018.d.ts +22 -0
  61. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2018.full.d.ts +22 -0
  62. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2018.intl.d.ts +81 -0
  63. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2018.promise.d.ts +28 -0
  64. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2018.regexp.d.ts +35 -0
  65. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2019.array.d.ts +77 -0
  66. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2019.d.ts +22 -0
  67. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2019.full.d.ts +22 -0
  68. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2019.intl.d.ts +21 -0
  69. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2019.object.d.ts +31 -0
  70. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2019.string.d.ts +35 -0
  71. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2019.symbol.d.ts +22 -0
  72. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2020.bigint.d.ts +763 -0
  73. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2020.d.ts +25 -0
  74. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2020.date.d.ts +40 -0
  75. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2020.full.d.ts +22 -0
  76. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2020.intl.d.ts +472 -0
  77. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2020.number.d.ts +26 -0
  78. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2020.promise.d.ts +45 -0
  79. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2020.sharedmemory.d.ts +97 -0
  80. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2020.string.d.ts +42 -0
  81. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2020.symbol.wellknown.d.ts +39 -0
  82. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2021.d.ts +21 -0
  83. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2021.full.d.ts +22 -0
  84. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2021.intl.d.ts +164 -0
  85. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2021.promise.d.ts +46 -0
  86. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2021.string.d.ts +31 -0
  87. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2021.weakref.d.ts +76 -0
  88. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2022.array.d.ts +119 -0
  89. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2022.d.ts +23 -0
  90. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2022.error.d.ts +73 -0
  91. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2022.full.d.ts +22 -0
  92. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2022.intl.d.ts +143 -0
  93. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2022.object.d.ts +24 -0
  94. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2022.regexp.d.ts +37 -0
  95. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2022.string.d.ts +23 -0
  96. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2023.array.d.ts +922 -0
  97. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2023.collection.d.ts +19 -0
  98. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2023.d.ts +20 -0
  99. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2023.full.d.ts +22 -0
  100. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2023.intl.d.ts +62 -0
  101. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2024.arraybuffer.d.ts +63 -0
  102. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2024.collection.d.ts +27 -0
  103. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2024.d.ts +24 -0
  104. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2024.full.d.ts +22 -0
  105. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2024.object.d.ts +27 -0
  106. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2024.promise.d.ts +33 -0
  107. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2024.regexp.d.ts +23 -0
  108. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2024.sharedmemory.d.ts +66 -0
  109. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2024.string.d.ts +27 -0
  110. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2025.collection.d.ts +94 -0
  111. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2025.d.ts +23 -0
  112. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2025.float16.d.ts +443 -0
  113. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2025.full.d.ts +22 -0
  114. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2025.intl.d.ts +200 -0
  115. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2025.iterator.d.ts +146 -0
  116. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2025.promise.d.ts +32 -0
  117. package/tsc/@typescript/typescript-linux-x64/lib/lib.es2025.regexp.d.ts +30 -0
  118. package/tsc/@typescript/typescript-linux-x64/lib/lib.es5.d.ts +4599 -0
  119. package/tsc/@typescript/typescript-linux-x64/lib/lib.es6.d.ts +21 -0
  120. package/tsc/@typescript/typescript-linux-x64/lib/lib.esnext.array.d.ts +33 -0
  121. package/tsc/@typescript/typescript-linux-x64/lib/lib.esnext.collection.d.ts +47 -0
  122. package/tsc/@typescript/typescript-linux-x64/lib/lib.esnext.d.ts +27 -0
  123. package/tsc/@typescript/typescript-linux-x64/lib/lib.esnext.date.d.ts +21 -0
  124. package/tsc/@typescript/typescript-linux-x64/lib/lib.esnext.decorators.d.ts +26 -0
  125. package/tsc/@typescript/typescript-linux-x64/lib/lib.esnext.disposable.d.ts +191 -0
  126. package/tsc/@typescript/typescript-linux-x64/lib/lib.esnext.error.d.ts +22 -0
  127. package/tsc/@typescript/typescript-linux-x64/lib/lib.esnext.full.d.ts +22 -0
  128. package/tsc/@typescript/typescript-linux-x64/lib/lib.esnext.intl.d.ts +107 -0
  129. package/tsc/@typescript/typescript-linux-x64/lib/lib.esnext.sharedmemory.d.ts +23 -0
  130. package/tsc/@typescript/typescript-linux-x64/lib/lib.esnext.temporal.d.ts +485 -0
  131. package/tsc/@typescript/typescript-linux-x64/lib/lib.esnext.typedarrays.d.ts +90 -0
  132. package/tsc/@typescript/typescript-linux-x64/lib/lib.scripthost.d.ts +320 -0
  133. package/tsc/@typescript/typescript-linux-x64/lib/lib.webworker.asynciterable.d.ts +18 -0
  134. package/tsc/@typescript/typescript-linux-x64/lib/lib.webworker.d.ts +15606 -0
  135. package/tsc/@typescript/typescript-linux-x64/lib/lib.webworker.importscripts.d.ts +21 -0
  136. package/tsc/@typescript/typescript-linux-x64/lib/lib.webworker.iterable.d.ts +18 -0
  137. package/tsc/@typescript/typescript-linux-x64/lib/tsc +0 -0
  138. package/tsc/@typescript/typescript-linux-x64/lib/tsc.sig +11 -0
  139. package/tsc/@typescript/typescript-linux-x64/package.json +45 -0
  140. package/tsc/notes +14 -0
  141. package/tsconfig.json +48 -0
@@ -0,0 +1,562 @@
1
+ // Found at https://gist.github.com/ally-commits/9073ff23fc7f96fab1290fdec22775bc
2
+ export const codes = {
3
+ AD: { code: 'AD', label: 'Andorra', phone: '376', phoneLength: 6 },
4
+ AE: {
5
+ code: 'AE',
6
+ label: 'United Arab Emirates',
7
+ phone: '971',
8
+ phoneLength: 9
9
+ },
10
+ AF: { code: 'AF', label: 'Afghanistan', phone: '93', phoneLength: 9 },
11
+ AG: {
12
+ code: 'AG',
13
+ label: 'Antigua and Barbuda',
14
+ phone: '1-268',
15
+ phoneLength: 10
16
+ },
17
+ AI: { code: 'AI', label: 'Anguilla', phone: '1-264', phoneLength: 10 },
18
+ AL: { code: 'AL', label: 'Albania', phone: '355', phoneLength: 9 },
19
+ AM: { code: 'AM', label: 'Armenia', phone: '374', phoneLength: 6 },
20
+ AO: { code: 'AO', label: 'Angola', phone: '244', phoneLength: 9 },
21
+ AQ: { code: 'AQ', label: 'Antarctica', phone: '672', phoneLength: 6 },
22
+ AR: {
23
+ code: 'AR',
24
+ label: 'Argentina',
25
+ phone: '54',
26
+ phoneLength: [6, 7, 8]
27
+ },
28
+ AS: {
29
+ code: 'AS',
30
+ label: 'American Samoa',
31
+ phone: '1-684',
32
+ phoneLength: 10
33
+ },
34
+ AT: {
35
+ code: 'AT',
36
+ label: 'Austria',
37
+ phone: '43',
38
+ phoneLength: [10, 11]
39
+ },
40
+ AU: {
41
+ code: 'AU',
42
+ label: 'Australia',
43
+ phone: '61',
44
+ suggested: true,
45
+ phoneLength: 9
46
+ },
47
+ AW: { code: 'AW', label: 'Aruba', phone: '297', phoneLength: 7 },
48
+ AX: {
49
+ code: 'AX',
50
+ label: 'Alland Islands',
51
+ phone: '358',
52
+ min: 7,
53
+ max: 10
54
+ },
55
+ AZ: { code: 'AZ', label: 'Azerbaijan', phone: '994', phoneLength: 9 },
56
+ BA: {
57
+ code: 'BA',
58
+ label: 'Bosnia and Herzegovina',
59
+ phone: '387',
60
+ phoneLength: 8
61
+ },
62
+ BB: { code: 'BB', label: 'Barbados', phone: '1-246', phoneLength: 10 },
63
+ BD: { code: 'BD', label: 'Bangladesh', phone: '880', phoneLength: 10 },
64
+ BE: { code: 'BE', label: 'Belgium', phone: '32', phoneLength: 9 },
65
+ BF: { code: 'BF', label: 'Burkina Faso', phone: '226', phoneLength: 8 },
66
+ BG: { code: 'BG', label: 'Bulgaria', phone: '359', phoneLength: 9 },
67
+ BH: { code: 'BH', label: 'Bahrain', phone: '973', phoneLength: 8 },
68
+ BI: { code: 'BI', label: 'Burundi', phone: '257', phoneLength: 8 },
69
+ BJ: { code: 'BJ', label: 'Benin', phone: '229', phoneLength: 8 },
70
+ BL: {
71
+ code: 'BL',
72
+ label: 'Saint Barthelemy',
73
+ phone: '590',
74
+ phoneLength: 9
75
+ },
76
+ BM: { code: 'BM', label: 'Bermuda', phone: '1-441', phoneLength: 10 },
77
+ BN: {
78
+ code: 'BN',
79
+ label: 'Brunei Darussalam',
80
+ phone: '673',
81
+ phoneLength: 7
82
+ },
83
+ BO: { code: 'BO', label: 'Bolivia', phone: '591', phoneLength: 9 },
84
+ BR: { code: 'BR', label: 'Brazil', phone: '55', phoneLength: 11 },
85
+ BS: { code: 'BS', label: 'Bahamas', phone: '1-242', phoneLength: 10 },
86
+ BT: { code: 'BT', label: 'Bhutan', phone: '975', phoneLength: 7 },
87
+ BV: { code: 'BV', label: 'Bouvet Island', phone: '47', phoneLength: 10 },
88
+ BW: { code: 'BW', label: 'Botswana', phone: '267', phoneLength: 7 },
89
+ BY: { code: 'BY', label: 'Belarus', phone: '375', phoneLength: 9 },
90
+ BZ: { code: 'BZ', label: 'Belize', phone: '501', phoneLength: 7 },
91
+ CA: {
92
+ code: 'CA',
93
+ label: 'Canada',
94
+ phone: '1',
95
+ suggested: true,
96
+ phoneLength: 10
97
+ },
98
+ CC: {
99
+ code: 'CC',
100
+ label: 'Cocos (Keeling) Islands',
101
+ phone: '61',
102
+ phoneLength: 10
103
+ },
104
+ CD: {
105
+ code: 'CD',
106
+ label: 'Congo, Democratic Republic of the',
107
+ phone: '243',
108
+ phoneLength: 7
109
+ },
110
+ CF: {
111
+ code: 'CF',
112
+ label: 'Central African Republic',
113
+ phone: '236',
114
+ phoneLength: 8
115
+ },
116
+ CG: {
117
+ code: 'CG',
118
+ label: 'Congo, Republic of the',
119
+ phone: '242',
120
+ phoneLength: 9
121
+ },
122
+ CH: { code: 'CH', label: 'Switzerland', phone: '41', phoneLength: 9 },
123
+ CI: { code: 'CI', label: "Cote d'Ivoire", phone: '225', phoneLength: 8 },
124
+ CK: { code: 'CK', label: 'Cook Islands', phone: '682', phoneLength: 5 },
125
+ CL: { code: 'CL', label: 'Chile', phone: '56', phoneLength: 9 },
126
+ CM: { code: 'CM', label: 'Cameroon', phone: '237', phoneLength: 9 },
127
+ CN: { code: 'CN', label: 'China', phone: '86', phoneLength: 11 },
128
+ CO: { code: 'CO', label: 'Colombia', phone: '57', phoneLength: 10 },
129
+ CR: { code: 'CR', label: 'Costa Rica', phone: '506', phoneLength: 8 },
130
+ CU: { code: 'CU', label: 'Cuba', phone: '53', phoneLength: 8 },
131
+ CV: { code: 'CV', label: 'Cape Verde', phone: '238', phoneLength: 7 },
132
+ CW: { code: 'CW', label: 'Curacao', phone: '599', phoneLength: 7 },
133
+ CX: {
134
+ code: 'CX',
135
+ label: 'Christmas Island',
136
+ phone: '61',
137
+ phoneLength: 9
138
+ },
139
+ CY: { code: 'CY', label: 'Cyprus', phone: '357', phoneLength: 8 },
140
+ CZ: { code: 'CZ', label: 'Czech Republic', phone: '420', phoneLength: 9 },
141
+ DE: {
142
+ code: 'DE',
143
+ label: 'Germany',
144
+ phone: '49',
145
+ suggested: true,
146
+ phoneLength: 10
147
+ },
148
+ DJ: { code: 'DJ', label: 'Djibouti', phone: '253', phoneLength: 10 },
149
+ DK: { code: 'DK', label: 'Denmark', phone: '45', phoneLength: 8 },
150
+ DM: { code: 'DM', label: 'Dominica', phone: '1-767', phoneLength: 10 },
151
+ DO: {
152
+ code: 'DO',
153
+ label: 'Dominican Republic',
154
+ phone: '1-809',
155
+ phoneLength: 10
156
+ },
157
+ DZ: { code: 'DZ', label: 'Algeria', phone: '213', phoneLength: 9 },
158
+ EC: { code: 'EC', label: 'Ecuador', phone: '593', phoneLength: 9 },
159
+ EE: { code: 'EE', label: 'Estonia', phone: '372', phoneLength: 8 },
160
+ EG: { code: 'EG', label: 'Egypt', phone: '20', phoneLength: 10 },
161
+ EH: { code: 'EH', label: 'Western Sahara', phone: '212', phoneLength: 9 },
162
+ ER: { code: 'ER', label: 'Eritrea', phone: '291', phoneLength: 7 },
163
+ ES: { code: 'ES', label: 'Spain', phone: '34', phoneLength: 9 },
164
+ ET: { code: 'ET', label: 'Ethiopia', phone: '251', phoneLength: 9 },
165
+ FI: { code: 'FI', label: 'Finland', phone: '358', min: 9, max: 11 },
166
+ FJ: { code: 'FJ', label: 'Fiji', phone: '679', phoneLength: 7 },
167
+ FK: {
168
+ code: 'FK',
169
+ label: 'Falkland Islands (Malvinas)',
170
+ phone: '500',
171
+ phoneLength: 5
172
+ },
173
+ FM: {
174
+ code: 'FM',
175
+ label: 'Micronesia, Federated States of',
176
+ phone: '691',
177
+ phoneLength: 7
178
+ },
179
+ FO: { code: 'FO', label: 'Faroe Islands', phone: '298', phoneLength: 5 },
180
+ FR: {
181
+ code: 'FR',
182
+ label: 'France',
183
+ phone: '33',
184
+ suggested: true,
185
+ phoneLength: 9
186
+ },
187
+ GA: { code: 'GA', label: 'Gabon', phone: '241', phoneLength: 7 },
188
+ GB: { code: 'GB', label: 'United Kingdom', phone: '44', phoneLength: 10 },
189
+ GD: { code: 'GD', label: 'Grenada', phone: '1-473', phoneLength: 10 },
190
+ GE: { code: 'GE', label: 'Georgia', phone: '995', phoneLength: 9 },
191
+ GF: { code: 'GF', label: 'French Guiana', phone: '594', phoneLength: 9 },
192
+ GG: { code: 'GG', label: 'Guernsey', phone: '44', phoneLength: 10 },
193
+ GH: { code: 'GH', label: 'Ghana', phone: '233', phoneLength: 9 },
194
+ GI: { code: 'GI', label: 'Gibraltar', phone: '350', phoneLength: 8 },
195
+ GL: { code: 'GL', label: 'Greenland', phone: '299', phoneLength: 6 },
196
+ GM: { code: 'GM', label: 'Gambia', phone: '220', phoneLength: 7 },
197
+ GN: { code: 'GN', label: 'Guinea', phone: '224', phoneLength: 9 },
198
+ GP: { code: 'GP', label: 'Guadeloupe', phone: '590', phoneLength: 9 },
199
+ GQ: {
200
+ code: 'GQ',
201
+ label: 'Equatorial Guinea',
202
+ phone: '240',
203
+ phoneLength: 9
204
+ },
205
+ GR: { code: 'GR', label: 'Greece', phone: '30', phoneLength: 10 },
206
+ GS: {
207
+ code: 'GS',
208
+ label: 'South Georgia and the South Sandwich Islands',
209
+ phone: '500',
210
+ phoneLength: 5
211
+ },
212
+ GT: { code: 'GT', label: 'Guatemala', phone: '502', phoneLength: 8 },
213
+ GU: { code: 'GU', label: 'Guam', phone: '1-671', phoneLength: 10 },
214
+ GW: { code: 'GW', label: 'Guinea-Bissau', phone: '245', phoneLength: 9 },
215
+ GY: { code: 'GY', label: 'Guyana', phone: '592', phoneLength: 7 },
216
+ HK: { code: 'HK', label: 'Hong Kong', phone: '852', phoneLength: 8 },
217
+ HM: {
218
+ code: 'HM',
219
+ label: 'Heard Island and McDonald Islands',
220
+ phone: '672',
221
+ phoneLength: 10
222
+ },
223
+ HN: { code: 'HN', label: 'Honduras', phone: '504', phoneLength: 8 },
224
+ HR: { code: 'HR', label: 'Croatia', phone: '385', phoneLength: 9 },
225
+ HT: { code: 'HT', label: 'Haiti', phone: '509', phoneLength: 8 },
226
+ HU: { code: 'HU', label: 'Hungary', phone: '36', phoneLength: 9 },
227
+ ID: { code: 'ID', label: 'Indonesia', phone: '62', phoneLength: 11 },
228
+ IE: { code: 'IE', label: 'Ireland', phone: '353', phoneLength: 9 },
229
+ IL: { code: 'IL', label: 'Israel', phone: '972', phoneLength: 9 },
230
+ IM: { code: 'IM', label: 'Isle of Man', phone: '44', phoneLength: 10 },
231
+ IN: { code: 'IN', label: 'India', phone: '91', phoneLength: 10 },
232
+ IO: {
233
+ code: 'IO',
234
+ label: 'British Indian Ocean Territory',
235
+ phone: '246',
236
+ phoneLength: 7
237
+ },
238
+ IQ: { code: 'IQ', label: 'Iraq', phone: '964', phoneLength: 10 },
239
+ IR: {
240
+ code: 'IR',
241
+ label: 'Iran, Islamic Republic of',
242
+ phone: '98',
243
+ phoneLength: 11
244
+ },
245
+ IS: { code: 'IS', label: 'Iceland', phone: '354', phoneLength: 7 },
246
+ IT: { code: 'IT', label: 'Italy', phone: '39', phoneLength: 10 },
247
+ JE: { code: 'JE', label: 'Jersey', phone: '44', phoneLength: 10 },
248
+ JM: { code: 'JM', label: 'Jamaica', phone: '1-876', phoneLength: 10 },
249
+ JO: { code: 'JO', label: 'Jordan', phone: '962', phoneLength: [8, 9] },
250
+ JP: { code: 'JP', label: 'Japan', phone: '81', suggested: true },
251
+ KE: { code: 'KE', label: 'Kenya', phone: '254', phoneLength: 10 },
252
+ KG: { code: 'KG', label: 'Kyrgyzstan', phone: '996', phoneLength: 9 },
253
+ KH: { code: 'KH', label: 'Cambodia', phone: '855', phoneLength: 9 },
254
+ KI: { code: 'KI', label: 'Kiribati', phone: '686', phoneLength: 8 },
255
+ KM: { code: 'KM', label: 'Comoros', phone: '269', phoneLength: 7 },
256
+ KN: {
257
+ code: 'KN',
258
+ label: 'Saint Kitts and Nevis',
259
+ phone: '1-869',
260
+ phoneLength: 10
261
+ },
262
+ KP: {
263
+ code: 'KP',
264
+ label: "Korea, Democratic People's Republic of",
265
+ phone: '850',
266
+ phoneLength: [4, 6, 7, 13]
267
+ },
268
+ KR: {
269
+ code: 'KR',
270
+ label: 'Korea, Republic of',
271
+ phone: '82',
272
+ phoneLength: [7, 8]
273
+ },
274
+ KW: { code: 'KW', label: 'Kuwait', phone: '965', phoneLength: 8 },
275
+ KY: {
276
+ code: 'KY',
277
+ label: 'Cayman Islands',
278
+ phone: '1-345',
279
+ phoneLength: 7
280
+ },
281
+ KZ: { code: 'KZ', label: 'Kazakhstan', phone: '7', phoneLength: 10 },
282
+ LA: {
283
+ code: 'LA',
284
+ label: "Lao People's Democratic Republic",
285
+ phone: '856',
286
+ phoneLength: [8, 9]
287
+ },
288
+ LB: { code: 'LB', label: 'Lebanon', phone: '961', phoneLength: [7, 8] },
289
+ LC: { code: 'LC', label: 'Saint Lucia', phone: '1-758', phoneLength: 7 },
290
+ LI: { code: 'LI', label: 'Liechtenstein', phone: '423', phoneLength: 7 },
291
+ LK: { code: 'LK', label: 'Sri Lanka', phone: '94', phoneLength: 7 },
292
+ LR: { code: 'LR', label: 'Liberia', phone: '231', phoneLength: [8, 9] },
293
+ LS: { code: 'LS', label: 'Lesotho', phone: '266', phoneLength: 8 },
294
+ LT: { code: 'LT', label: 'Lithuania', phone: '370', phoneLength: 8 },
295
+ LU: { code: 'LU', label: 'Luxembourg', phone: '352', phoneLength: 9 },
296
+ LV: { code: 'LV', label: 'Latvia', phone: '371', phoneLength: 8 },
297
+ LY: { code: 'LY', label: 'Libya', phone: '218', phoneLength: 10 },
298
+ MA: { code: 'MA', label: 'Morocco', phone: '212', phoneLength: 9 },
299
+ MC: { code: 'MC', label: 'Monaco', phone: '377', phoneLength: 8 },
300
+ MD: {
301
+ code: 'MD',
302
+ label: 'Moldova, Republic of',
303
+ phone: '373',
304
+ phoneLength: 8
305
+ },
306
+ ME: { code: 'ME', label: 'Montenegro', phone: '382', phoneLength: 8 },
307
+ MF: {
308
+ code: 'MF',
309
+ label: 'Saint Martin (French part)',
310
+ phone: '590',
311
+ phoneLength: 6
312
+ },
313
+ MG: { code: 'MG', label: 'Madagascar', phone: '261', phoneLength: 7 },
314
+ MH: {
315
+ code: 'MH',
316
+ label: 'Marshall Islands',
317
+ phone: '692',
318
+ phoneLength: 7
319
+ },
320
+ MK: {
321
+ code: 'MK',
322
+ label: 'Macedonia, the Former Yugoslav Republic of',
323
+ phone: '389',
324
+ phoneLength: 8
325
+ },
326
+ ML: { code: 'ML', label: 'Mali', phone: '223', phoneLength: 8 },
327
+ MM: { code: 'MM', label: 'Myanmar', phone: '95', min: 7, max: 10 },
328
+ MN: { code: 'MN', label: 'Mongolia', phone: '976', phoneLength: 8 },
329
+ MO: { code: 'MO', label: 'Macao', phone: '853', phoneLength: 8 },
330
+ MP: {
331
+ code: 'MP',
332
+ label: 'Northern Mariana Islands',
333
+ phone: '1-670',
334
+ phoneLength: 7
335
+ },
336
+ MQ: { code: 'MQ', label: 'Martinique', phone: '596', phoneLength: 9 },
337
+ MR: { code: 'MR', label: 'Mauritania', phone: '222', phoneLength: 8 },
338
+ MS: { code: 'MS', label: 'Montserrat', phone: '1-664', phoneLength: 10 },
339
+ MT: { code: 'MT', label: 'Malta', phone: '356', phoneLength: 8 },
340
+ MU: { code: 'MU', label: 'Mauritius', phone: '230', phoneLength: 8 },
341
+ MV: { code: 'MV', label: 'Maldives', phone: '960', phoneLength: 7 },
342
+ MW: {
343
+ code: 'MW',
344
+ label: 'Malawi',
345
+ phone: '265',
346
+ phoneLength: [7, 8, 9]
347
+ },
348
+ MX: { code: 'MX', label: 'Mexico', phone: '52', phoneLength: 10 },
349
+ MY: { code: 'MY', label: 'Malaysia', phone: '60', phoneLength: 7 },
350
+ MZ: { code: 'MZ', label: 'Mozambique', phone: '258', phoneLength: 12 },
351
+ NA: { code: 'NA', label: 'Namibia', phone: '264', phoneLength: 7 },
352
+ NC: { code: 'NC', label: 'New Caledonia', phone: '687', phoneLength: 6 },
353
+ NE: { code: 'NE', label: 'Niger', phone: '227', phoneLength: 8 },
354
+ NF: { code: 'NF', label: 'Norfolk Island', phone: '672', phoneLength: 6 },
355
+ NG: { code: 'NG', label: 'Nigeria', phone: '234', phoneLength: 8 },
356
+ NI: { code: 'NI', label: 'Nicaragua', phone: '505', phoneLength: 8 },
357
+ NL: { code: 'NL', label: 'Netherlands', phone: '31', phoneLength: 9 },
358
+ NO: { code: 'NO', label: 'Norway', phone: '47', phoneLength: 8 },
359
+ NP: { code: 'NP', label: 'Nepal', phone: '977', phoneLength: 10 },
360
+ NR: { code: 'NR', label: 'Nauru', phone: '674', phoneLength: 7 },
361
+ NU: { code: 'NU', label: 'Niue', phone: '683', phoneLength: 4 },
362
+ NZ: {
363
+ code: 'NZ',
364
+ label: 'New Zealand',
365
+ phone: '64',
366
+ phoneLength: [8, 9]
367
+ },
368
+ OM: { code: 'OM', label: 'Oman', phone: '968', phoneLength: 8 },
369
+ PA: { code: 'PA', label: 'Panama', phone: '507', phoneLength: 8 },
370
+ PE: { code: 'PE', label: 'Peru', phone: '51', phoneLength: 9 },
371
+ PF: {
372
+ code: 'PF',
373
+ label: 'French Polynesia',
374
+ phone: '689',
375
+ phoneLength: 8
376
+ },
377
+ PG: {
378
+ code: 'PG',
379
+ label: 'Papua New Guinea',
380
+ phone: '675',
381
+ phoneLength: 8
382
+ },
383
+ PH: { code: 'PH', label: 'Philippines', phone: '63', phoneLength: 10 },
384
+ PK: { code: 'PK', label: 'Pakistan', phone: '92', phoneLength: 10 },
385
+ PL: { code: 'PL', label: 'Poland', phone: '48', phoneLength: 9 },
386
+ PM: {
387
+ code: 'PM',
388
+ label: 'Saint Pierre and Miquelon',
389
+ phone: '508',
390
+ phoneLength: 6
391
+ },
392
+ PN: { code: 'PN', label: 'Pitcairn', phone: '870', phoneLength: 9 },
393
+ PR: { code: 'PR', label: 'Puerto Rico', phone: '1', phoneLength: 10 },
394
+ PS: {
395
+ code: 'PS',
396
+ label: 'Palestine, State of',
397
+ phone: '970',
398
+ phoneLength: 9
399
+ },
400
+ PT: { code: 'PT', label: 'Portugal', phone: '351', phoneLength: 9 },
401
+ PW: { code: 'PW', label: 'Palau', phone: '680', phoneLength: 7 },
402
+ PY: { code: 'PY', label: 'Paraguay', phone: '595', phoneLength: 9 },
403
+ QA: { code: 'QA', label: 'Qatar', phone: '974', phoneLength: 8 },
404
+ RE: { code: 'RE', label: 'Reunion', phone: '262', phoneLength: 10 },
405
+ RO: { code: 'RO', label: 'Romania', phone: '40', phoneLength: 10 },
406
+ RS: { code: 'RS', label: 'Serbia', phone: '381', phoneLength: 9 },
407
+ RU: {
408
+ code: 'RU',
409
+ label: 'Russian Federation',
410
+ phone: '7',
411
+ phoneLength: 10
412
+ },
413
+ RW: { code: 'RW', label: 'Rwanda', phone: '250', phoneLength: 9 },
414
+ SA: { code: 'SA', label: 'Saudi Arabia', phone: '966', phoneLength: 9 },
415
+ SB: {
416
+ code: 'SB',
417
+ label: 'Solomon Islands',
418
+ phone: '677',
419
+ phoneLength: 7
420
+ },
421
+ SC: { code: 'SC', label: 'Seychelles', phone: '248', phoneLength: 7 },
422
+ SD: { code: 'SD', label: 'Sudan', phone: '249', phoneLength: 7 },
423
+ SE: { code: 'SE', label: 'Sweden', phone: '46', phoneLength: 7 },
424
+ SG: { code: 'SG', label: 'Singapore', phone: '65', phoneLength: 8 },
425
+ SH: { code: 'SH', label: 'Saint Helena', phone: '290', phoneLength: 4 },
426
+ SI: { code: 'SI', label: 'Slovenia', phone: '386', phoneLength: 9 },
427
+ SJ: {
428
+ code: 'SJ',
429
+ label: 'Svalbard and Jan Mayen',
430
+ phone: '47',
431
+ phoneLength: 8
432
+ },
433
+ SK: { code: 'SK', label: 'Slovakia', phone: '421', phoneLength: 9 },
434
+ SL: { code: 'SL', label: 'Sierra Leone', phone: '232', phoneLength: 8 },
435
+ SM: { code: 'SM', label: 'San Marino', phone: '378', phoneLength: 10 },
436
+ SN: { code: 'SN', label: 'Senegal', phone: '221', phoneLength: 9 },
437
+ SO: { code: 'SO', label: 'Somalia', phone: '252', phoneLength: [8, 9] },
438
+ SR: {
439
+ code: 'SR',
440
+ label: 'Suriname',
441
+ phone: '597',
442
+ phoneLength: [6, 7]
443
+ },
444
+ SS: { code: 'SS', label: 'South Sudan', phone: '211', phoneLength: 7 },
445
+ ST: {
446
+ code: 'ST',
447
+ label: 'Sao Tome and Principe',
448
+ phone: '239',
449
+ phoneLength: 7
450
+ },
451
+ SV: { code: 'SV', label: 'El Salvador', phone: '503', phoneLength: 8 },
452
+ SX: {
453
+ code: 'SX',
454
+ label: 'Sint Maarten (Dutch part)',
455
+ phone: '1-721',
456
+ phoneLength: 10
457
+ },
458
+ SY: {
459
+ code: 'SY',
460
+ label: 'Syrian Arab Republic',
461
+ phone: '963',
462
+ phoneLength: 7
463
+ },
464
+ SZ: { code: 'SZ', label: 'Swaziland', phone: '268', phoneLength: 8 },
465
+ TC: {
466
+ code: 'TC',
467
+ label: 'Turks and Caicos Islands',
468
+ phone: '1-649',
469
+ phoneLength: 10
470
+ },
471
+ TD: { code: 'TD', label: 'Chad', phone: '235', phoneLength: 6 },
472
+ TF: {
473
+ code: 'TF',
474
+ label: 'French Southern Territories',
475
+ phone: '262',
476
+ phoneLength: 10
477
+ },
478
+ TG: { code: 'TG', label: 'Togo', phone: '228', phoneLength: 8 },
479
+ TH: { code: 'TH', label: 'Thailand', phone: '66', phoneLength: 9 },
480
+ TJ: { code: 'TJ', label: 'Tajikistan', phone: '992', phoneLength: 9 },
481
+ TK: { code: 'TK', label: 'Tokelau', phone: '690', phoneLength: 5 },
482
+ TL: { code: 'TL', label: 'Timor-Leste', phone: '670', phoneLength: 7 },
483
+ TM: { code: 'TM', label: 'Turkmenistan', phone: '993', phoneLength: 8 },
484
+ TN: { code: 'TN', label: 'Tunisia', phone: '216', phoneLength: 8 },
485
+ TO: { code: 'TO', label: 'Tonga', phone: '676', phoneLength: 5 },
486
+ TR: { code: 'TR', label: 'Turkey', phone: '90', phoneLength: 11 },
487
+ TT: {
488
+ code: 'TT',
489
+ label: 'Trinidad and Tobago',
490
+ phone: '1-868',
491
+ phoneLength: 7
492
+ },
493
+ TV: { code: 'TV', label: 'Tuvalu', phone: '688', phoneLength: 5 },
494
+ TW: {
495
+ code: 'TW',
496
+ label: 'Taiwan, Province of China',
497
+ phone: '886',
498
+ phoneLength: 9
499
+ },
500
+ TZ: {
501
+ code: 'TZ',
502
+ label: 'United Republic of Tanzania',
503
+ phone: '255',
504
+ phoneLength: 7
505
+ },
506
+ UA: { code: 'UA', label: 'Ukraine', phone: '380', phoneLength: 9 },
507
+ UG: { code: 'UG', label: 'Uganda', phone: '256', phoneLength: 7 },
508
+ US: {
509
+ code: 'US',
510
+ label: 'United States',
511
+ phone: '1',
512
+ suggested: true,
513
+ phoneLength: 10
514
+ },
515
+ UY: { code: 'UY', label: 'Uruguay', phone: '598', phoneLength: 8 },
516
+ UZ: { code: 'UZ', label: 'Uzbekistan', phone: '998', phoneLength: 9 },
517
+ VA: {
518
+ code: 'VA',
519
+ label: 'Holy See (Vatican City State)',
520
+ phone: '379',
521
+ phoneLength: 10
522
+ },
523
+ VC: {
524
+ code: 'VC',
525
+ label: 'Saint Vincent and the Grenadines',
526
+ phone: '1-784',
527
+ phoneLength: 7
528
+ },
529
+ VE: { code: 'VE', label: 'Venezuela', phone: '58', phoneLength: 7 },
530
+ VG: {
531
+ code: 'VG',
532
+ label: 'British Virgin Islands',
533
+ phone: '1-284',
534
+ phoneLength: 7
535
+ },
536
+ VI: {
537
+ code: 'VI',
538
+ label: 'US Virgin Islands',
539
+ phone: '1-340',
540
+ phoneLength: 10
541
+ },
542
+ VN: { code: 'VN', label: 'Vietnam', phone: '84', phoneLength: 9 },
543
+ VU: { code: 'VU', label: 'Vanuatu', phone: '678', phoneLength: 5 },
544
+ WF: {
545
+ code: 'WF',
546
+ label: 'Wallis and Futuna',
547
+ phone: '681',
548
+ phoneLength: 6
549
+ },
550
+ WS: {
551
+ code: 'WS',
552
+ label: 'Samoa',
553
+ phone: '685',
554
+ phoneLength: [5, 6, 7]
555
+ },
556
+ XK: { code: 'XK', label: 'Kosovo', phone: '383', phoneLength: 8 },
557
+ YE: { code: 'YE', label: 'Yemen', phone: '967', phoneLength: 9 },
558
+ YT: { code: 'YT', label: 'Mayotte', phone: '262', phoneLength: 9 },
559
+ ZA: { code: 'ZA', label: 'South Africa', phone: '27', phoneLength: 9 },
560
+ ZM: { code: 'ZM', label: 'Zambia', phone: '260', phoneLength: 9 },
561
+ ZW: { code: 'ZW', label: 'Zimbabwe', phone: '263', phoneLength: 9 }
562
+ };
@@ -0,0 +1,96 @@
1
+ import jwt from 'jsonwebtoken';
2
+ import * as Utils from './utils.js';
3
+ import * as Features from './features.js';
4
+ let app;
5
+ const ACCESS_TOKEN_SECRET = process.env.JWT_ACCESS_TOKEN_SECRET || "MY_SECRET_ACCESS_TOKEN";
6
+ const REFRESH_TOKEN_SECRET = process.env.JWT_REFRESH_TOKEN_SECRET || "MY_SECRET_REFRESH_TOKEN";
7
+ const DEPLOY_TOKEN_SECRET = process.env.DEPLOY_TOKEN_SECRET || "MY_SECRET_DEPLOY_TOKEN";
8
+ const NDCURVE_DEVELOPER_LICENSE_ACCESS_TOKEN_SECRET = process.env.NDCURVE_DEVELOPER_LICENSE_ACCESS_TOKEN_PUBLIC_KEY;
9
+ let urlsAllowed = [];
10
+ export var ALLOWED_URLS = [];
11
+ export const start = (expressApp, allowedUrls) => {
12
+ urlsAllowed = ["/refreshToken", "/login"].concat(allowedUrls ?? []);
13
+ ALLOWED_URLS = urlsAllowed;
14
+ app = expressApp;
15
+ app.use(async (req, res, next) => {
16
+ // return next() // Disable session
17
+ let allowedDefaults = req.url === '/features' || req.url.startsWith('/messages/');
18
+ if (urlsAllowed.includes(req.path))
19
+ return next();
20
+ const checkPrivilege = async (req) => {
21
+ const staff = Utils.isEmpty(req.body.staff) ? 'BLANK_STAFF' : req.body.staff;
22
+ const granted = (await Features.send({ company: req.body.company, outlet: req.body.outlet, app: req.body.app }, "privileges.query.check", { feature: req.body.feature }, { id: staff })).data.granted;
23
+ if (!granted)
24
+ throw { message: "Access Denied" };
25
+ return granted;
26
+ };
27
+ try {
28
+ const token = req.header('JWT'); // 'Authorization' for Spring Boot, 'x-access-token' for Node.js Express back-end
29
+ const service = req.header('SERVICE'); // Case insensitive search
30
+ const additionalValidation = async (_) => (process.env.GRANT_FULL_ACCESS || allowedDefaults || await checkPrivilege(req));
31
+ async function verifyDeveloperAccess() {
32
+ const NDCURVE_DEVELOPER_LICENSE_ACCESS_TOKEN = req.header('NDCURVE_DEVELOPER_LICENSE_ACCESS_TOKEN');
33
+ const isDeveloper = NDCURVE_DEVELOPER_LICENSE_ACCESS_TOKEN && NDCURVE_DEVELOPER_LICENSE_ACCESS_TOKEN_SECRET;
34
+ if (!isDeveloper)
35
+ return false;
36
+ const verify = _ => jwt.verify(NDCURVE_DEVELOPER_LICENSE_ACCESS_TOKEN, NDCURVE_DEVELOPER_LICENSE_ACCESS_TOKEN_SECRET, { algorithms: ['RS512'] });
37
+ try {
38
+ if (service && verify())
39
+ return true;
40
+ else if (verify() && await additionalValidation())
41
+ return true;
42
+ }
43
+ catch (error) {
44
+ }
45
+ return false;
46
+ }
47
+ if (await verifyDeveloperAccess())
48
+ return next();
49
+ else if (service && jwt.verify(token, DEPLOY_TOKEN_SECRET))
50
+ return next();
51
+ else if (jwt.verify(token, ACCESS_TOKEN_SECRET) && await additionalValidation())
52
+ return next();
53
+ throw null;
54
+ }
55
+ catch (error) {
56
+ return res.status(401).json({ message: error?.message === "Access Denied" ? error.message : 'Unauthorized' });
57
+ }
58
+ });
59
+ app.post("/refreshToken", (req, res) => {
60
+ try {
61
+ let { userId, clientId, refreshToken } = req.body;
62
+ const decoded = jwt.verify(refreshToken, REFRESH_TOKEN_SECRET);
63
+ if (decoded.userId === userId && decoded.clientId === clientId) {
64
+ let now = Utils.now();
65
+ let accessTokenExpiry = new Date(now);
66
+ accessTokenExpiry.setDate(accessTokenExpiry.getDate() + 1);
67
+ accessTokenExpiry = accessTokenExpiry.getTime();
68
+ let refreshTokenExpiry = new Date(now);
69
+ refreshTokenExpiry.setDate(refreshTokenExpiry.getDate() + 30);
70
+ refreshTokenExpiry = refreshTokenExpiry.getTime();
71
+ const accessToken = jwt.sign({ userId, clientId }, ACCESS_TOKEN_SECRET, { expiresIn: '1d' });
72
+ const refreshToken = jwt.sign({ userId, clientId }, REFRESH_TOKEN_SECRET, { expiresIn: '30d' });
73
+ return res.json({ tokens: { accessToken, refreshToken, accessTokenExpiry, refreshTokenExpiry } });
74
+ }
75
+ // Access Denied
76
+ throw null;
77
+ }
78
+ catch (error) {
79
+ // Access Denied
80
+ return res.status(400).json({ message: 'Unauthorized' });
81
+ }
82
+ });
83
+ };
84
+ export const generateAccessToken = (userId, clientId) => {
85
+ let data = { userId, clientId };
86
+ let now = Utils.now();
87
+ let accessTokenExpiry = new Date(now);
88
+ accessTokenExpiry.setDate(accessTokenExpiry.getDate() + 1);
89
+ accessTokenExpiry = accessTokenExpiry.getTime();
90
+ let refreshTokenExpiry = new Date(now);
91
+ refreshTokenExpiry.setDate(refreshTokenExpiry.getDate() + 30);
92
+ refreshTokenExpiry = refreshTokenExpiry.getTime();
93
+ const accessToken = jwt.sign(data, ACCESS_TOKEN_SECRET, { expiresIn: '1d' });
94
+ const refreshToken = jwt.sign(data, REFRESH_TOKEN_SECRET, { expiresIn: '365d' });
95
+ return { accessToken, refreshToken, accessTokenExpiry, refreshTokenExpiry };
96
+ };