@bitblit/ratchet-warden-common 4.0.116-alpha → 4.0.119-alpha

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 (88) hide show
  1. package/lib/build/ratchet-warden-common-info.d.ts +1 -1
  2. package/lib/common/model/warden-jwt-token.d.ts +1 -1
  3. package/lib/index.d.ts +37 -1
  4. package/lib/index.mjs +3 -0
  5. package/lib/index.mjs.map +1 -0
  6. package/package.json +11 -10
  7. package/lib/build/ratchet-warden-common-info.js +0 -15
  8. package/lib/build/ratchet-warden-common-info.js.map +0 -1
  9. package/lib/client/provider/warden-client-abstract-recent-login-provider.js +0 -45
  10. package/lib/client/provider/warden-client-abstract-recent-login-provider.js.map +0 -1
  11. package/lib/client/provider/warden-client-current-logged-in-jwt-token-provider.js +0 -2
  12. package/lib/client/provider/warden-client-current-logged-in-jwt-token-provider.js.map +0 -1
  13. package/lib/client/provider/warden-client-local-storage-logged-in-user-provider.js +0 -30
  14. package/lib/client/provider/warden-client-local-storage-logged-in-user-provider.js.map +0 -1
  15. package/lib/client/provider/warden-client-local-storage-recent-login-provider.js +0 -24
  16. package/lib/client/provider/warden-client-local-storage-recent-login-provider.js.map +0 -1
  17. package/lib/client/provider/warden-client-recent-login-provider.js +0 -2
  18. package/lib/client/provider/warden-client-recent-login-provider.js.map +0 -1
  19. package/lib/client/provider/warden-client-transient-memory-logged-in-user-provider.js +0 -13
  20. package/lib/client/provider/warden-client-transient-memory-logged-in-user-provider.js.map +0 -1
  21. package/lib/client/provider/warden-client-transient-memory-recent-login-provider.js +0 -11
  22. package/lib/client/provider/warden-client-transient-memory-recent-login-provider.js.map +0 -1
  23. package/lib/client/provider/warden-command-exchange-provider.js +0 -2
  24. package/lib/client/provider/warden-command-exchange-provider.js.map +0 -1
  25. package/lib/client/provider/warden-logged-in-user-provider.js +0 -2
  26. package/lib/client/provider/warden-logged-in-user-provider.js.map +0 -1
  27. package/lib/client/provider/warden-logged-in-user-wrapper.js +0 -2
  28. package/lib/client/provider/warden-logged-in-user-wrapper.js.map +0 -1
  29. package/lib/client/provider/warden-recent-login-descriptor.js +0 -2
  30. package/lib/client/provider/warden-recent-login-descriptor.js.map +0 -1
  31. package/lib/client/provider/warden-user-service-event-processing-provider.js +0 -2
  32. package/lib/client/provider/warden-user-service-event-processing-provider.js.map +0 -1
  33. package/lib/client/provider/warden-user-service-options.js +0 -2
  34. package/lib/client/provider/warden-user-service-options.js.map +0 -1
  35. package/lib/client/warden-client.js +0 -135
  36. package/lib/client/warden-client.js.map +0 -1
  37. package/lib/client/warden-client.spec.js +0 -23
  38. package/lib/client/warden-client.spec.js.map +0 -1
  39. package/lib/client/warden-delegating-current-user-providing-user-service-event-processing-provider.js +0 -42
  40. package/lib/client/warden-delegating-current-user-providing-user-service-event-processing-provider.js.map +0 -1
  41. package/lib/client/warden-user-service.js +0 -254
  42. package/lib/client/warden-user-service.js.map +0 -1
  43. package/lib/client/warden-user-service.spec.js +0 -20
  44. package/lib/client/warden-user-service.spec.js.map +0 -1
  45. package/lib/common/command/create-account.js +0 -2
  46. package/lib/common/command/create-account.js.map +0 -1
  47. package/lib/common/command/remove-web-authn-registration.js +0 -2
  48. package/lib/common/command/remove-web-authn-registration.js.map +0 -1
  49. package/lib/common/command/warden-command-response.js +0 -2
  50. package/lib/common/command/warden-command-response.js.map +0 -1
  51. package/lib/common/command/warden-command.js +0 -2
  52. package/lib/common/command/warden-command.js.map +0 -1
  53. package/lib/common/command/web-authn-object-wrapper.js +0 -2
  54. package/lib/common/command/web-authn-object-wrapper.js.map +0 -1
  55. package/lib/common/model/warden-contact-type.js +0 -6
  56. package/lib/common/model/warden-contact-type.js.map +0 -1
  57. package/lib/common/model/warden-contact.js +0 -2
  58. package/lib/common/model/warden-contact.js.map +0 -1
  59. package/lib/common/model/warden-customer-message-type.js +0 -5
  60. package/lib/common/model/warden-customer-message-type.js.map +0 -1
  61. package/lib/common/model/warden-entry-summary.js +0 -2
  62. package/lib/common/model/warden-entry-summary.js.map +0 -1
  63. package/lib/common/model/warden-entry.js +0 -2
  64. package/lib/common/model/warden-entry.js.map +0 -1
  65. package/lib/common/model/warden-jwt-token.js +0 -2
  66. package/lib/common/model/warden-jwt-token.js.map +0 -1
  67. package/lib/common/model/warden-login-request.js +0 -2
  68. package/lib/common/model/warden-login-request.js.map +0 -1
  69. package/lib/common/model/warden-login-results.js +0 -2
  70. package/lib/common/model/warden-login-results.js.map +0 -1
  71. package/lib/common/model/warden-store-registration-response-type.js +0 -7
  72. package/lib/common/model/warden-store-registration-response-type.js.map +0 -1
  73. package/lib/common/model/warden-store-registration-response.js +0 -2
  74. package/lib/common/model/warden-store-registration-response.js.map +0 -1
  75. package/lib/common/model/warden-team-role.js +0 -2
  76. package/lib/common/model/warden-team-role.js.map +0 -1
  77. package/lib/common/model/warden-user-decoration.js +0 -2
  78. package/lib/common/model/warden-user-decoration.js.map +0 -1
  79. package/lib/common/model/warden-web-authn-entry.js +0 -2
  80. package/lib/common/model/warden-web-authn-entry.js.map +0 -1
  81. package/lib/common/model/warden-web-authn-transport-future-type.js +0 -10
  82. package/lib/common/model/warden-web-authn-transport-future-type.js.map +0 -1
  83. package/lib/common/util/warden-utils.js +0 -106
  84. package/lib/common/util/warden-utils.js.map +0 -1
  85. package/lib/common/util/warden-utils.spec.js +0 -11
  86. package/lib/common/util/warden-utils.spec.js.map +0 -1
  87. package/lib/index.js +0 -2
  88. package/lib/index.js.map +0 -1
@@ -1,254 +0,0 @@
1
- import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
2
- import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
3
- import { JwtRatchet } from '@bitblit/ratchet-common/lib/jwt/jwt-ratchet.js';
4
- import { timer } from 'rxjs';
5
- export class WardenUserService {
6
- options;
7
- loggedInTimerSubscription;
8
- _autoRefreshEnabled = false;
9
- constructor(options) {
10
- this.options = options;
11
- Logger.info('Initializing user service');
12
- const stored = this.options.loggedInUserProvider.fetchLoggedInUserWrapper();
13
- if (WardenUserService.wrapperIsExpired(stored)) {
14
- Logger.info('Stored token is expired, removing it');
15
- this.options.loggedInUserProvider.logOutUser();
16
- }
17
- else {
18
- this.options.eventProcessor.onSuccessfulLogin(stored);
19
- }
20
- const timerSeconds = this.options.loginCheckTimerPingSeconds || 2.5;
21
- this.loggedInTimerSubscription = timer(0, timerSeconds * 1000).subscribe((t) => this.checkForAutoLogoutOrRefresh(t));
22
- }
23
- cleanShutDown() {
24
- if (this.loggedInTimerSubscription) {
25
- this.loggedInTimerSubscription.unsubscribe();
26
- }
27
- }
28
- get serviceOptions() {
29
- return this.options;
30
- }
31
- async createAccount(contact, sendCode, label, tags) {
32
- const rval = await this.options.wardenClient.createAccount(contact, sendCode, label, tags);
33
- if (this.options.recentLoginProvider && StringRatchet.trimToNull(rval)) {
34
- this.options.recentLoginProvider.saveNewUser(rval, label, contact);
35
- }
36
- return rval;
37
- }
38
- async addContactToLoggedInUser(contact) {
39
- return this.options.wardenClient.addContactToLoggedInUser(contact);
40
- }
41
- get autoRefreshEnabled() {
42
- return this._autoRefreshEnabled;
43
- }
44
- set autoRefreshEnabled(newValue) {
45
- if (newValue) {
46
- if (this.options.allowAutoRefresh) {
47
- this._autoRefreshEnabled = true;
48
- }
49
- else {
50
- throw new Error('Cannot enable auto-refresh - this is disabled in the user service options');
51
- }
52
- }
53
- else {
54
- this._autoRefreshEnabled = false;
55
- }
56
- }
57
- async checkForAutoLogoutOrRefresh(t) {
58
- Logger.debug('Checking for auto-logout or refresh : %s', t);
59
- const current = this.fetchLoggedInUserWrapper();
60
- if (current) {
61
- const thresholdSeconds = this.options.autoLoginHandlingThresholdSeconds || 10;
62
- const secondsLeft = current.expirationEpochSeconds - Math.floor(Date.now() / 1000);
63
- if (secondsLeft < thresholdSeconds) {
64
- if (this.autoRefreshEnabled) {
65
- Logger.info('Under threshold, initiating auto-refresh');
66
- const result = await this.refreshToken();
67
- this.options.eventProcessor.onAutomaticTokenRefresh(result);
68
- }
69
- else {
70
- Logger.info('Under threshold, initiating auto-logout');
71
- this.logout();
72
- }
73
- }
74
- }
75
- }
76
- logout() {
77
- this.options.loggedInUserProvider.logOutUser();
78
- this.options.eventProcessor.onLogout();
79
- }
80
- static wrapperIsExpired(value) {
81
- const rval = value?.userObject?.exp && value.expirationEpochSeconds < Date.now() / 1000;
82
- return rval;
83
- }
84
- fetchLoggedInUserWrapper() {
85
- let tmp = this.options.loggedInUserProvider.fetchLoggedInUserWrapper();
86
- if (tmp) {
87
- if (WardenUserService.wrapperIsExpired(tmp)) {
88
- Logger.info('Token is expired - auto logout triggered');
89
- this.logout();
90
- tmp = null;
91
- }
92
- }
93
- return tmp;
94
- }
95
- loggedInUserHasRole(role) {
96
- let rval = false;
97
- if (StringRatchet.trimToNull(role)) {
98
- const t = this.fetchLoggedInUserWrapper();
99
- const testRole = role.toLowerCase();
100
- rval = t?.userObject?.roles && !!t.userObject.roles.find((r) => r.toLowerCase() === testRole);
101
- }
102
- return rval;
103
- }
104
- isLoggedIn() {
105
- const t = this.fetchLoggedInUserWrapper();
106
- return !!t;
107
- }
108
- fetchLoggedInUserJwtObject() {
109
- const t = this.fetchLoggedInUserWrapper();
110
- return t ? t.userObject : null;
111
- }
112
- fetchLoggedInUserJwtToken() {
113
- const t = this.fetchLoggedInUserWrapper();
114
- return t ? t.jwtToken : null;
115
- }
116
- fetchLoggedInUserObject() {
117
- const t = this.fetchLoggedInUserJwtObject();
118
- return t ? t.user : null;
119
- }
120
- fetchLoggedInUserExpirationEpochSeconds() {
121
- const t = this.fetchLoggedInUserJwtObject();
122
- return t ? t.exp : null;
123
- }
124
- fetchLoggedInUserRemainingSeconds() {
125
- const t = this.fetchLoggedInUserJwtObject();
126
- return t ? t.exp - Math.floor(Date.now() / 1000) : null;
127
- }
128
- updateLoggedInUserFromTokenString(token) {
129
- let rval = null;
130
- if (!StringRatchet.trimToNull(token)) {
131
- Logger.info('Called updateLoggedInUserFromTokenString with empty string - logging out');
132
- this.logout();
133
- }
134
- else {
135
- Logger.info('updateLoggedInUserFromTokenString : %s', token);
136
- const parsed = JwtRatchet.decodeTokenNoVerify(token);
137
- if (parsed) {
138
- rval = {
139
- userObject: parsed,
140
- jwtToken: token,
141
- expirationEpochSeconds: parsed.exp,
142
- };
143
- this.options.loggedInUserProvider.setLoggedInUserWrapper(rval);
144
- this.updateRecentLoginsFromWardenEntrySummary(parsed.loginData);
145
- this.options.eventProcessor.onSuccessfulLogin(rval);
146
- }
147
- else {
148
- Logger.warn('Failed to parse token %s - ignoring login and triggering failure');
149
- this.options.eventProcessor.onLoginFailure('Could not parse token string');
150
- }
151
- }
152
- return rval;
153
- }
154
- async refreshToken() {
155
- let rval = null;
156
- const currentWrapper = this.fetchLoggedInUserWrapper();
157
- if (!currentWrapper) {
158
- Logger.info('Could not refresh - no token available');
159
- }
160
- else {
161
- const newToken = await this.options.wardenClient.refreshJwtToken(currentWrapper.jwtToken);
162
- rval = await this.updateLoggedInUserFromTokenString(newToken);
163
- }
164
- return rval;
165
- }
166
- async sendExpiringCode(contact) {
167
- return this.options.wardenClient.sendExpiringValidationToken(contact);
168
- }
169
- async processWardenLoginResults(resp) {
170
- let rval = null;
171
- if (resp) {
172
- Logger.info('Warden: response : %j ', resp);
173
- if (resp.jwtToken) {
174
- Logger.info('Applying login');
175
- rval = await this.updateLoggedInUserFromTokenString(resp.jwtToken);
176
- }
177
- else if (resp.error) {
178
- this.options.eventProcessor.onLoginFailure(resp.error);
179
- }
180
- else {
181
- Logger.error('Response contained neither token nor error');
182
- this.options.eventProcessor.onLoginFailure('Response contained neither token nor error');
183
- }
184
- }
185
- else {
186
- Logger.error('Login call failed');
187
- this.options.eventProcessor.onLoginFailure('Login call returned null');
188
- }
189
- return rval;
190
- }
191
- updateRecentLoginsFromWardenEntrySummary(res) {
192
- if (this.options.recentLoginProvider && res) {
193
- Logger.info('UserService : Saving recent login %j', res);
194
- this.options.recentLoginProvider.saveRecentLogin(res);
195
- }
196
- else {
197
- Logger.info('Not saving recent login - no storage configured or no data passed');
198
- }
199
- }
200
- updateRecentLoginsFromLoggedInUserWrapper(res) {
201
- this.updateRecentLoginsFromWardenEntrySummary(res?.userObject?.loginData);
202
- }
203
- async executeWebAuthnBasedLogin(userId) {
204
- const resp = await this.executeWebAuthnLoginToWardenLoginResults(userId);
205
- const rval = await this.processWardenLoginResults(resp);
206
- this.updateRecentLoginsFromLoggedInUserWrapper(rval);
207
- return rval;
208
- }
209
- async removeWebAuthnRegistrationFromLoggedInUser(input) {
210
- const rval = await this.options.wardenClient.removeWebAuthnRegistrationFromLoggedInUser(input);
211
- return rval;
212
- }
213
- async removeContactFromLoggedInUser(input) {
214
- const rval = await this.options.wardenClient.removeContactFromLoggedInUser(input);
215
- return rval;
216
- }
217
- async executeValidationTokenBasedLogin(contact, token) {
218
- Logger.info('Warden: executeValidationTokenBasedLogin : %j : %s ', contact, token);
219
- const resp = await this.options.wardenClient.performLoginCmd({ contact: contact, expiringToken: token });
220
- const rval = await this.processWardenLoginResults(resp);
221
- this.updateRecentLoginsFromLoggedInUserWrapper(rval);
222
- return rval;
223
- }
224
- async saveCurrentDeviceAsWebAuthnForCurrentUser() {
225
- const input = await this.options.wardenClient.generateWebAuthnRegistrationChallengeForLoggedInUser();
226
- const startRegistration = (await import('@simplewebauthn/browser')).startRegistration;
227
- const creds = await startRegistration(input);
228
- const output = await this.options.wardenClient.addWebAuthnRegistrationToLoggedInUser(creds);
229
- this.updateRecentLoginsFromWardenEntrySummary(output);
230
- return output;
231
- }
232
- async executeWebAuthnLoginToWardenLoginResults(userId) {
233
- let rval = null;
234
- try {
235
- const input = await this.options.wardenClient.generateWebAuthnAuthenticationChallengeForUserId(userId);
236
- Logger.info('Got login challenge : %s', input);
237
- const startAuthentication = (await import('@simplewebauthn/browser')).startAuthentication;
238
- const creds = await startAuthentication(input);
239
- Logger.info('Got creds: %j', creds);
240
- const loginCmd = {
241
- userId: userId,
242
- webAuthn: creds,
243
- };
244
- rval = await this.options.wardenClient.performLoginCmd(loginCmd);
245
- if (rval?.jwtToken) {
246
- }
247
- }
248
- catch (err) {
249
- Logger.error('WebauthN Failed : %s', err);
250
- }
251
- return rval;
252
- }
253
- }
254
- //# sourceMappingURL=warden-user-service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-user-service.js","sourceRoot":"","sources":["../../src/client/warden-user-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,8CAA8C,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAC;AAC5E,OAAO,EAAgB,KAAK,EAAE,MAAM,MAAM,CAAC;AAuB3C,MAAM,OAAO,iBAAiB;IAIR;IAHZ,yBAAyB,CAAe;IACxC,mBAAmB,GAAY,KAAK,CAAC;IAE7C,YAAoB,OAAoC;QAApC,YAAO,GAAP,OAAO,CAA6B;QACtD,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAEzC,MAAM,MAAM,GAAiC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,wBAAwB,EAAE,CAAC;QAC1G,IAAI,iBAAiB,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE;YAE9C,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;YACpD,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,UAAU,EAAE,CAAC;SAChD;aAAM;YAEL,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;SACvD;QAED,MAAM,YAAY,GAAW,IAAI,CAAC,OAAO,CAAC,0BAA0B,IAAI,GAAG,CAAC;QAC5E,IAAI,CAAC,yBAAyB,GAAG,KAAK,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC,CA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AM,MAAM,CAAC,yBAAyB,CAAC,CAAC,CAAC,mBAAmB,CAAC;YAC1F,MAAM,KAAK,GAA+B,MAAM,mBAAmB,CAAC,KAAK,CAAC,CAAC;YAC3E,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;YAEpC,MAAM,QAAQ,GAAuB;gBACnC,MAAM,EAAE,MAAM;gBACd,QAAQ,EAAE,KAAK;aAChB,CAAC;YACF,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;YACjE,IAAI,IAAI,EAAE,QAAQ,EAAE;aAGnB;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;SAC3C;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -1,20 +0,0 @@
1
- import { WardenUserService } from './warden-user-service.js';
2
- import { JestRatchet } from '@bitblit/ratchet-jest/lib/jest/jest-ratchet.js';
3
- import { jest } from '@jest/globals';
4
- describe('#wardenUserService', function () {
5
- it('should instantiate', async () => {
6
- const wuso = {
7
- recentLoginProvider: JestRatchet.mock(jest.fn),
8
- loggedInUserProvider: JestRatchet.mock(jest.fn),
9
- wardenClient: JestRatchet.mock(jest.fn),
10
- eventProcessor: JestRatchet.mock(jest.fn),
11
- loginCheckTimerPingSeconds: 60,
12
- autoLoginHandlingThresholdSeconds: 60,
13
- allowAutoRefresh: true,
14
- };
15
- const wus = new WardenUserService(wuso);
16
- expect(wus).not.toBeNull();
17
- wus.cleanShutDown();
18
- });
19
- });
20
- //# sourceMappingURL=warden-user-service.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-user-service.spec.js","sourceRoot":"","sources":["../../src/client/warden-user-service.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAK7E,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,QAAQ,CAAC,oBAAoB,EAAE;IAE7B,EAAE,CAAC,oBAAoB,EAAE,KAAK,IAAI,EAAE;QAClC,MAAM,IAAI,GAAkC;YAC1C,mBAAmB,EAAE,WAAW,CAAC,IAAI,CAAkC,IAAI,CAAC,EAAE,CAAC;YAC/E,oBAAoB,EAAE,WAAW,CAAC,IAAI,CAAkC,IAAI,CAAC,EAAE,CAAC;YAChF,YAAY,EAAE,WAAW,CAAC,IAAI,CAAe,IAAI,CAAC,EAAE,CAAC;YACrD,cAAc,EAAE,WAAW,CAAC,IAAI,CAAgD,IAAI,CAAC,EAAE,CAAC;YACxF,0BAA0B,EAAE,EAAE;YAC9B,iCAAiC,EAAE,EAAE;YACrC,gBAAgB,EAAE,IAAI;SACvB,CAAC;QAEF,MAAM,GAAG,GAA2B,IAAI,iBAAiB,CAAM,IAAI,CAAC,CAAC;QACrE,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC3B,GAAG,CAAC,aAAa,EAAE,CAAC;IACtB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=create-account.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-account.js","sourceRoot":"","sources":["../../../src/common/command/create-account.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=remove-web-authn-registration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remove-web-authn-registration.js","sourceRoot":"","sources":["../../../src/common/command/remove-web-authn-registration.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=warden-command-response.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-command-response.js","sourceRoot":"","sources":["../../../src/common/command/warden-command-response.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=warden-command.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-command.js","sourceRoot":"","sources":["../../../src/common/command/warden-command.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=web-authn-object-wrapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"web-authn-object-wrapper.js","sourceRoot":"","sources":["../../../src/common/command/web-authn-object-wrapper.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- export var WardenContactType;
2
- (function (WardenContactType) {
3
- WardenContactType["TextCapablePhoneNumber"] = "TextCapablePhoneNumber";
4
- WardenContactType["EmailAddress"] = "EmailAddress";
5
- })(WardenContactType || (WardenContactType = {}));
6
- //# sourceMappingURL=warden-contact-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-contact-type.js","sourceRoot":"","sources":["../../../src/common/model/warden-contact-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,sEAAiD,CAAA;IACjD,kDAA6B,CAAA;AAC/B,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,QAG5B"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=warden-contact.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-contact.js","sourceRoot":"","sources":["../../../src/common/model/warden-contact.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
1
- export var WardenCustomerMessageType;
2
- (function (WardenCustomerMessageType) {
3
- WardenCustomerMessageType["ExpiringCode"] = "ExpiringCode";
4
- })(WardenCustomerMessageType || (WardenCustomerMessageType = {}));
5
- //# sourceMappingURL=warden-customer-message-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-customer-message-type.js","sourceRoot":"","sources":["../../../src/common/model/warden-customer-message-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,yBAEX;AAFD,WAAY,yBAAyB;IACnC,0DAA6B,CAAA;AAC/B,CAAC,EAFW,yBAAyB,KAAzB,yBAAyB,QAEpC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=warden-entry-summary.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-entry-summary.js","sourceRoot":"","sources":["../../../src/common/model/warden-entry-summary.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=warden-entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-entry.js","sourceRoot":"","sources":["../../../src/common/model/warden-entry.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=warden-jwt-token.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-jwt-token.js","sourceRoot":"","sources":["../../../src/common/model/warden-jwt-token.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=warden-login-request.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-login-request.js","sourceRoot":"","sources":["../../../src/common/model/warden-login-request.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=warden-login-results.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-login-results.js","sourceRoot":"","sources":["../../../src/common/model/warden-login-results.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- export var WardenStoreRegistrationResponseType;
2
- (function (WardenStoreRegistrationResponseType) {
3
- WardenStoreRegistrationResponseType["Verified"] = "Verified";
4
- WardenStoreRegistrationResponseType["Failed"] = "Failed";
5
- WardenStoreRegistrationResponseType["Error"] = "Error";
6
- })(WardenStoreRegistrationResponseType || (WardenStoreRegistrationResponseType = {}));
7
- //# sourceMappingURL=warden-store-registration-response-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-store-registration-response-type.js","sourceRoot":"","sources":["../../../src/common/model/warden-store-registration-response-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,mCAIX;AAJD,WAAY,mCAAmC;IAC7C,4DAAqB,CAAA;IACrB,wDAAiB,CAAA;IACjB,sDAAe,CAAA;AACjB,CAAC,EAJW,mCAAmC,KAAnC,mCAAmC,QAI9C"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=warden-store-registration-response.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-store-registration-response.js","sourceRoot":"","sources":["../../../src/common/model/warden-store-registration-response.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=warden-team-role.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-team-role.js","sourceRoot":"","sources":["../../../src/common/model/warden-team-role.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=warden-user-decoration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-user-decoration.js","sourceRoot":"","sources":["../../../src/common/model/warden-user-decoration.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=warden-web-authn-entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-web-authn-entry.js","sourceRoot":"","sources":["../../../src/common/model/warden-web-authn-entry.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- export var WardenWebAuthnTransportFutureType;
2
- (function (WardenWebAuthnTransportFutureType) {
3
- WardenWebAuthnTransportFutureType["ble"] = "ble";
4
- WardenWebAuthnTransportFutureType["internal"] = "internal";
5
- WardenWebAuthnTransportFutureType["nfc"] = "nfc";
6
- WardenWebAuthnTransportFutureType["usb"] = "usb";
7
- WardenWebAuthnTransportFutureType["cable"] = "cable";
8
- WardenWebAuthnTransportFutureType["hybrid"] = "hybrid";
9
- })(WardenWebAuthnTransportFutureType || (WardenWebAuthnTransportFutureType = {}));
10
- //# sourceMappingURL=warden-web-authn-transport-future-type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-web-authn-transport-future-type.js","sourceRoot":"","sources":["../../../src/common/model/warden-web-authn-transport-future-type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,iCAOX;AAPD,WAAY,iCAAiC;IAC3C,gDAAW,CAAA;IACX,0DAAqB,CAAA;IACrB,gDAAW,CAAA;IACX,gDAAW,CAAA;IACX,oDAAe,CAAA;IACf,sDAAiB,CAAA;AACnB,CAAC,EAPW,iCAAiC,KAAjC,iCAAiC,QAO5C"}
@@ -1,106 +0,0 @@
1
- import { WardenContactType } from '../model/warden-contact-type.js';
2
- import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
3
- import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
4
- export class WardenUtils {
5
- constructor() { }
6
- static extractContactsOfType(req, type) {
7
- let rval = null;
8
- if (req?.contactMethods) {
9
- rval = req.contactMethods.filter((s) => s.type === type).map((s) => s.value);
10
- }
11
- return rval;
12
- }
13
- static validLoginRequest(req) {
14
- let rval = false;
15
- if (req) {
16
- if (StringRatchet.trimToNull(req.userId) || WardenUtils.validContact(req.contact)) {
17
- if (StringRatchet.trimToNull(req.expiringToken) || StringRatchet.trimToNull(req.jwtTokenToRefresh) || req.webAuthn) {
18
- rval = true;
19
- }
20
- }
21
- }
22
- return rval;
23
- }
24
- static stringToWardenContact(input) {
25
- let rval = null;
26
- const type = WardenUtils.stringToContactType(input);
27
- if (type) {
28
- rval = {
29
- type: type,
30
- value: input,
31
- };
32
- }
33
- else {
34
- Logger.error('Failed to convert a string to a contact type', input);
35
- }
36
- return rval;
37
- }
38
- static teamRolesToRoles(teamRoles) {
39
- const rval = teamRoles?.length ? teamRoles.map((t) => WardenUtils.teamRoleToRoleString(t)) : [];
40
- return rval;
41
- }
42
- static roleStringsToTeamRoles(roles) {
43
- const rval = roles?.length ? roles.map((t) => WardenUtils.roleStringToTeamRole(t)) : [];
44
- return rval;
45
- }
46
- static roleStringToTeamRole(role) {
47
- let rval = null;
48
- if (role && role.indexOf('_/_') >= 0) {
49
- const sp = role.split('_/_');
50
- rval = {
51
- team: sp[0],
52
- role: sp[1],
53
- };
54
- }
55
- return rval;
56
- }
57
- static teamRoleToRoleString(tr) {
58
- let rval = null;
59
- if (tr?.role && tr.team) {
60
- rval = tr.team + '_/_' + tr.role;
61
- }
62
- return rval;
63
- }
64
- static stringToContactType(input) {
65
- let rval = null;
66
- if (!!StringRatchet.trimToNull(input)) {
67
- rval = WardenUtils.stringIsEmailAddress(input) ? WardenContactType.EmailAddress : null;
68
- rval = !rval && WardenUtils.stringIsPhoneNumber(input) ? WardenContactType.TextCapablePhoneNumber : rval;
69
- }
70
- return rval;
71
- }
72
- static validContact(contact) {
73
- let rval = false;
74
- if (contact?.type && StringRatchet.trimToNull(contact?.value)) {
75
- switch (contact.type) {
76
- case WardenContactType.EmailAddress:
77
- rval = WardenUtils.stringIsEmailAddress(contact.value);
78
- break;
79
- case WardenContactType.TextCapablePhoneNumber:
80
- rval = WardenUtils.stringIsPhoneNumber(contact.value);
81
- break;
82
- default:
83
- rval = false;
84
- }
85
- }
86
- return rval;
87
- }
88
- static stringIsEmailAddress(value) {
89
- return !!value.match(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/);
90
- }
91
- static stringIsPhoneNumber(value) {
92
- return !!value.match(/^[\\+]?[(]?[0-9]{3}[)]?[-\\s\\.]?[0-9]{3}[-\\s\\.]?[0-9]{4,6}$/im);
93
- }
94
- static stripWardenEntryToSummary(we) {
95
- const rval = we
96
- ? {
97
- userId: we.userId,
98
- userLabel: we.userLabel,
99
- contactMethods: we.contactMethods,
100
- webAuthnAuthenticatorIds: (we.webAuthnAuthenticators || []).map((s) => s.credentialIdBase64),
101
- }
102
- : null;
103
- return rval;
104
- }
105
- }
106
- //# sourceMappingURL=warden-utils.js.map
@@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,sEAAsE,CAAC,CAAC;IAC/F,CAAC;IAEM,MAAM,CAAC,mBAAmB,CAAC,KAAa;QAC7C,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;IAC3F,CAAC;IAEM,MAAM,CAAC,yBAAyB,CAAC,EAAe;QACrD,MAAM,IAAI,GAAuB,EAAE;YACjC,CAAC,CAAC;gBACE,MAAM,EAAE,EAAE,CAAC,MAAM;gBACjB,SAAS,EAAE,EAAE,CAAC,SAAS;gBACvB,cAAc,EAAE,EAAE,CAAC,cAAc;gBACjC,wBAAwB,EAAE,CAAC,EAAE,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC;aAC7F;YACH,CAAC,CAAC,IAAI,CAAC;QACT,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -1,11 +0,0 @@
1
- import { WardenContactType } from '../model/warden-contact-type.js';
2
- import { WardenUtils } from './warden-utils.js';
3
- describe('#WardenUtils', () => {
4
- it('Should convert a string to a contact type', async () => {
5
- const output = WardenUtils.stringToWardenContact('test@test.com');
6
- expect(output).not.toBeNull();
7
- expect(output.value).toEqual('test@test.com');
8
- expect(output.type).toEqual(WardenContactType.EmailAddress);
9
- });
10
- });
11
- //# sourceMappingURL=warden-utils.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"warden-utils.spec.js","sourceRoot":"","sources":["../../../src/common/util/warden-utils.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAG5B,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;QACzD,MAAM,MAAM,GAAkB,WAAW,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC;QACjF,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC9B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QAC9C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/lib/index.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}