@casual-simulation/aux-records 3.3.9 → 3.3.11-alpha.11019730384
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AuthController.d.ts +102 -88
- package/AuthController.js +169 -159
- package/AuthController.js.map +1 -1
- package/AuthStore.d.ts +3 -2
- package/AuthUtils.d.ts +2 -2
- package/AuthUtils.js +6 -4
- package/AuthUtils.js.map +1 -1
- package/CachingConfigStore.js +17 -0
- package/CachingConfigStore.js.map +1 -1
- package/FileRecordsController.js +6 -5
- package/FileRecordsController.js.map +1 -1
- package/FileRecordsStore.d.ts +1 -1
- package/LockStore.d.ts +16 -0
- package/LockStore.js +2 -0
- package/LockStore.js.map +1 -0
- package/MemoryStore.d.ts +3 -1
- package/MemoryStore.js +10 -0
- package/MemoryStore.js.map +1 -1
- package/PolicyController.d.ts +10 -2
- package/PolicyController.js +5 -1
- package/PolicyController.js.map +1 -1
- package/PolicyStore.d.ts +13 -0
- package/PolicyStore.js +16 -0
- package/PolicyStore.js.map +1 -1
- package/RecordsClient.d.ts +5 -2
- package/RecordsClient.js +3 -2
- package/RecordsClient.js.map +1 -1
- package/RecordsServer.d.ts +247 -121
- package/RecordsServer.js +227 -278
- package/RecordsServer.js.map +1 -1
- package/ServerConfig.d.ts +862 -0
- package/ServerConfig.js +51 -1
- package/ServerConfig.js.map +1 -1
- package/SubscriptionConfigBuilder.d.ts +86 -0
- package/SubscriptionConfigBuilder.js +336 -0
- package/SubscriptionConfigBuilder.js.map +1 -0
- package/SubscriptionConfiguration.d.ts +651 -14
- package/SubscriptionConfiguration.js +116 -0
- package/SubscriptionConfiguration.js.map +1 -1
- package/TestUtils.d.ts +2 -1
- package/TestUtils.js +7 -14
- package/TestUtils.js.map +1 -1
- package/Utils.d.ts +5 -0
- package/Utils.js +10 -0
- package/Utils.js.map +1 -1
- package/Validations.d.ts +165 -0
- package/Validations.js +218 -0
- package/Validations.js.map +1 -0
- package/crud/CrudHelpers.d.ts +52 -0
- package/crud/CrudHelpers.js +155 -0
- package/crud/CrudHelpers.js.map +1 -0
- package/crud/CrudRecordsController.d.ts +255 -0
- package/crud/CrudRecordsController.js +400 -0
- package/crud/CrudRecordsController.js.map +1 -0
- package/crud/CrudRecordsControllerTests.d.ts +37 -0
- package/crud/CrudRecordsControllerTests.js +792 -0
- package/crud/CrudRecordsControllerTests.js.map +1 -0
- package/crud/CrudRecordsStore.d.ts +109 -0
- package/crud/CrudRecordsStore.js +2 -0
- package/crud/CrudRecordsStore.js.map +1 -0
- package/crud/MemoryCrudRecordsStore.d.ts +21 -0
- package/crud/MemoryCrudRecordsStore.js +154 -0
- package/crud/MemoryCrudRecordsStore.js.map +1 -0
- package/crud/index.d.ts +3 -0
- package/crud/index.js +3 -0
- package/crud/index.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +4 -4
- package/webhooks/MemoryWebhookRecordsStore.d.ts +14 -0
- package/webhooks/MemoryWebhookRecordsStore.js +87 -0
- package/webhooks/MemoryWebhookRecordsStore.js.map +1 -0
- package/webhooks/WebhookEnvironment.d.ts +756 -0
- package/webhooks/WebhookEnvironment.js +59 -0
- package/webhooks/WebhookEnvironment.js.map +1 -0
- package/webhooks/WebhookRecordsController.d.ts +189 -0
- package/webhooks/WebhookRecordsController.js +488 -0
- package/webhooks/WebhookRecordsController.js.map +1 -0
- package/webhooks/WebhookRecordsStore.d.ts +178 -0
- package/webhooks/WebhookRecordsStore.js +2 -0
- package/webhooks/WebhookRecordsStore.js.map +1 -0
- package/webhooks/index.d.ts +5 -0
- package/webhooks/index.js +5 -0
- package/webhooks/index.js.map +1 -0
- package/websockets/MemoryTempInstRecordsStore.d.ts +1 -1
- package/websockets/MemoryTempInstRecordsStore.js +1 -1
- package/websockets/MemoryTempInstRecordsStore.js.map +1 -1
- package/websockets/TemporaryInstRecordsStore.d.ts +2 -9
- package/websockets/WebsocketController.d.ts +9 -1
- package/websockets/WebsocketController.js +41 -14
- package/websockets/WebsocketController.js.map +1 -1
package/AuthController.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddressType, AuthListedUserAuthenticator, AuthStore, AuthUser, SaveNewUserFailure, UserRole } from './AuthStore';
|
|
1
|
+
import { AddressType, AuthListedUserAuthenticator, AuthSession, AuthStore, AuthUser, SaveNewUserFailure, UserRole } from './AuthStore';
|
|
2
2
|
import { NotAuthorizedError, NotLoggedInError, NotSupportedError, ServerError } from '@casual-simulation/aux-common/Errors';
|
|
3
3
|
import { AuthMessenger } from './AuthMessenger';
|
|
4
4
|
import { RegexRule } from './Utils';
|
|
@@ -100,7 +100,8 @@ export declare class AuthController {
|
|
|
100
100
|
set relyingParties(value: RelyingParty[]);
|
|
101
101
|
constructor(authStore: AuthStore, messenger: AuthMessenger, configStore: ConfigurationStore, forceAllowSubscriptionFeatures?: boolean, privoClient?: PrivoClientInterface, relyingParties?: RelyingParty[]);
|
|
102
102
|
createAccount(request: CreateAccountRequest): Promise<CreateAccountResult>;
|
|
103
|
-
|
|
103
|
+
issueSession(request: IssueSessionRequest): Promise<IssueSessionResult>;
|
|
104
|
+
private _hashHighEntropyPasswordWithSalt;
|
|
104
105
|
requestLogin(request: LoginRequest): Promise<LoginRequestResult>;
|
|
105
106
|
private _validateAddress;
|
|
106
107
|
completeLogin(request: CompleteLoginRequest): Promise<CompleteLoginResult>;
|
|
@@ -159,6 +160,93 @@ export declare class AuthController {
|
|
|
159
160
|
listSmsRules(): Promise<ListSmsRulesResult>;
|
|
160
161
|
isValidEmailAddress(email: string): Promise<IsValidEmailAddressResult>;
|
|
161
162
|
isValidDisplayName(displayName: string, name?: string): Promise<IsValidDisplayNameResult>;
|
|
163
|
+
/**
|
|
164
|
+
* Issues a new session for the given user.
|
|
165
|
+
* @param userId The ID of the user to issue the session for.
|
|
166
|
+
* @param lifetimeMs The lifetime of the session in milliseconds. If null, then the session will not expire.
|
|
167
|
+
* @param previousSession The previous session that this session is replacing. If null, then this session is not related to another session.
|
|
168
|
+
* @param ipAddress The IP address that the session is being issued to. Should be null if the ip address is not known.
|
|
169
|
+
*/
|
|
170
|
+
private _issueSession;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Validates the given session key using the given auth controller.
|
|
174
|
+
* @param sessionKey The session key to validate.
|
|
175
|
+
*/
|
|
176
|
+
export declare function validateSessionKey(auth: AuthController, sessionKey: string | null): Promise<ValidateSessionKeyResult | NoSessionKeyResult>;
|
|
177
|
+
export interface IssueSessionRequest {
|
|
178
|
+
/**
|
|
179
|
+
* The ID of the user to issue the session for.
|
|
180
|
+
*/
|
|
181
|
+
userId: string;
|
|
182
|
+
/**
|
|
183
|
+
* The role of the user that is requesting the session.
|
|
184
|
+
*/
|
|
185
|
+
requestingUserRole: UserRole;
|
|
186
|
+
/**
|
|
187
|
+
* The ID of the user that is requesting the session.
|
|
188
|
+
* Null if the session is not being requested by another user.
|
|
189
|
+
*/
|
|
190
|
+
requestingUserId: string | null;
|
|
191
|
+
/**
|
|
192
|
+
* The number of miliseconds that the session should last.
|
|
193
|
+
* If null, then the session will not expire.
|
|
194
|
+
* If undefined, then the default session lifetime will be used.
|
|
195
|
+
*/
|
|
196
|
+
lifetimeMs?: number | null | undefined;
|
|
197
|
+
/**
|
|
198
|
+
* The IP address that the session is being issued from.
|
|
199
|
+
*/
|
|
200
|
+
ipAddress: string | null;
|
|
201
|
+
}
|
|
202
|
+
export type IssueSessionResult = IssueSessionSuccess | IssueSessionFailure;
|
|
203
|
+
export interface IssueSessionSuccess extends AuthSessionInfo {
|
|
204
|
+
success: true;
|
|
205
|
+
}
|
|
206
|
+
export interface IssueSessionFailure {
|
|
207
|
+
success: false;
|
|
208
|
+
errorCode: ServerError | 'not_authorized';
|
|
209
|
+
errorMessage: string;
|
|
210
|
+
}
|
|
211
|
+
export interface IssueSessionOptions extends Omit<AuthSession, 'secretHash' | 'sessionId' | 'connectionSecret' | 'revokeTimeMs' | 'grantedTimeMs' | 'nextSessionId' | 'previousSessionId' | 'expireTimeMs' | 'requestId'> {
|
|
212
|
+
/**
|
|
213
|
+
* The lifetime of the session in milliseconds. If null, then the session will not expire.
|
|
214
|
+
*/
|
|
215
|
+
lifetimeMs: number | null;
|
|
216
|
+
/**
|
|
217
|
+
* The previous session that is being used to issue this session.
|
|
218
|
+
* If null, then the session is not being issued from another session.
|
|
219
|
+
*/
|
|
220
|
+
previousSession?: AuthSession | null;
|
|
221
|
+
/**
|
|
222
|
+
* The ID of the login request that this session is being issued from.
|
|
223
|
+
*/
|
|
224
|
+
requestId?: string | null;
|
|
225
|
+
}
|
|
226
|
+
export interface AuthSessionInfo {
|
|
227
|
+
/**
|
|
228
|
+
* The ID of the user that the session is for.
|
|
229
|
+
*/
|
|
230
|
+
userId: string;
|
|
231
|
+
/**
|
|
232
|
+
* The secret key that provides access for the session.
|
|
233
|
+
*/
|
|
234
|
+
sessionKey: string;
|
|
235
|
+
/**
|
|
236
|
+
* The connection key that provides websocket access for the session.
|
|
237
|
+
*/
|
|
238
|
+
connectionKey: string;
|
|
239
|
+
/**
|
|
240
|
+
* The unix timestamp in miliseconds that the session will expire at.
|
|
241
|
+
* If null, then the session will not expire.
|
|
242
|
+
*/
|
|
243
|
+
expireTimeMs: number | null;
|
|
244
|
+
}
|
|
245
|
+
export interface NoSessionKeyResult {
|
|
246
|
+
success: false;
|
|
247
|
+
userId: null;
|
|
248
|
+
errorCode: 'no_session_key';
|
|
249
|
+
errorMessage: string;
|
|
162
250
|
}
|
|
163
251
|
export interface PrivoSignUpRequest {
|
|
164
252
|
/**
|
|
@@ -248,24 +336,8 @@ export interface CompleteOpenIDLoginRequest {
|
|
|
248
336
|
ipAddress: string;
|
|
249
337
|
}
|
|
250
338
|
export type CompleteOpenIDLoginResult = CompleteOpenIDLoginSuccess | CompleteOpenIDLoginFailure;
|
|
251
|
-
export interface CompleteOpenIDLoginSuccess {
|
|
339
|
+
export interface CompleteOpenIDLoginSuccess extends AuthSessionInfo {
|
|
252
340
|
success: true;
|
|
253
|
-
/**
|
|
254
|
-
* The ID of the user that the session is for.
|
|
255
|
-
*/
|
|
256
|
-
userId: string;
|
|
257
|
-
/**
|
|
258
|
-
* The secret key that provides access for the session.
|
|
259
|
-
*/
|
|
260
|
-
sessionKey: string;
|
|
261
|
-
/**
|
|
262
|
-
* The connection key that provides websocket access for the session.
|
|
263
|
-
*/
|
|
264
|
-
connectionKey: string;
|
|
265
|
-
/**
|
|
266
|
-
* The unix timestamp in miliseconds that the session will expire at.
|
|
267
|
-
*/
|
|
268
|
-
expireTimeMs: number;
|
|
269
341
|
}
|
|
270
342
|
export interface CompleteOpenIDLoginFailure {
|
|
271
343
|
success: false;
|
|
@@ -273,28 +345,12 @@ export interface CompleteOpenIDLoginFailure {
|
|
|
273
345
|
errorMessage: string;
|
|
274
346
|
}
|
|
275
347
|
export type PrivoSignUpRequestResult = PrivoSignUpRequestSuccess | PrivoSignUpRequestFailure;
|
|
276
|
-
export interface PrivoSignUpRequestSuccess {
|
|
348
|
+
export interface PrivoSignUpRequestSuccess extends AuthSessionInfo {
|
|
277
349
|
success: true;
|
|
278
|
-
/**
|
|
279
|
-
* The ID of the user that was created.
|
|
280
|
-
*/
|
|
281
|
-
userId: string;
|
|
282
350
|
/**
|
|
283
351
|
* The URL that the user can be sent to in order to complete the sign up and set their password.
|
|
284
352
|
*/
|
|
285
353
|
updatePasswordUrl: string;
|
|
286
|
-
/**
|
|
287
|
-
* The session key that was issued for the session.
|
|
288
|
-
*/
|
|
289
|
-
sessionKey: string;
|
|
290
|
-
/**
|
|
291
|
-
* The connection key that was issued for the session.
|
|
292
|
-
*/
|
|
293
|
-
connectionKey: string;
|
|
294
|
-
/**
|
|
295
|
-
* The expiration time of the session in miliseconds in Unix time.
|
|
296
|
-
*/
|
|
297
|
-
expireTimeMs: number;
|
|
298
354
|
}
|
|
299
355
|
export interface PrivoSignUpRequestFailure {
|
|
300
356
|
success: false;
|
|
@@ -318,28 +374,18 @@ export interface CreateAccountRequest {
|
|
|
318
374
|
userRole: UserRole;
|
|
319
375
|
/**
|
|
320
376
|
* The IP Address that the request is being made from.
|
|
377
|
+
* Can be set to null if not creating a session.
|
|
321
378
|
*/
|
|
322
|
-
ipAddress: string;
|
|
379
|
+
ipAddress: string | null;
|
|
380
|
+
/**
|
|
381
|
+
* Whether or not to create a session for the user.
|
|
382
|
+
* Defaults to true.
|
|
383
|
+
*/
|
|
384
|
+
createSession?: boolean;
|
|
323
385
|
}
|
|
324
386
|
export type CreateAccountResult = CreateAccountSuccess | CreateAccountFailure;
|
|
325
|
-
export interface CreateAccountSuccess {
|
|
387
|
+
export interface CreateAccountSuccess extends AuthSessionInfo {
|
|
326
388
|
success: true;
|
|
327
|
-
/**
|
|
328
|
-
* The ID of the user that was created.
|
|
329
|
-
*/
|
|
330
|
-
userId: string;
|
|
331
|
-
/**
|
|
332
|
-
* The session key that was issued for the session.
|
|
333
|
-
*/
|
|
334
|
-
sessionKey: string;
|
|
335
|
-
/**
|
|
336
|
-
* The connection key that was issued for the session.
|
|
337
|
-
*/
|
|
338
|
-
connectionKey: string;
|
|
339
|
-
/**
|
|
340
|
-
* The expiration time of the session in miliseconds in Unix time.
|
|
341
|
-
*/
|
|
342
|
-
expireTimeMs: number;
|
|
343
389
|
}
|
|
344
390
|
export interface CreateAccountFailure {
|
|
345
391
|
success: false;
|
|
@@ -433,24 +479,8 @@ export interface CompleteLoginRequest {
|
|
|
433
479
|
ipAddress: string;
|
|
434
480
|
}
|
|
435
481
|
export type CompleteLoginResult = CompleteLoginSuccess | CompleteLoginFailure;
|
|
436
|
-
export interface CompleteLoginSuccess {
|
|
482
|
+
export interface CompleteLoginSuccess extends AuthSessionInfo {
|
|
437
483
|
success: true;
|
|
438
|
-
/**
|
|
439
|
-
* The ID of the user that the session is for.
|
|
440
|
-
*/
|
|
441
|
-
userId: string;
|
|
442
|
-
/**
|
|
443
|
-
* The secret key that provides access for the session.
|
|
444
|
-
*/
|
|
445
|
-
sessionKey: string;
|
|
446
|
-
/**
|
|
447
|
-
* The connection key that provides websocket access for the session.
|
|
448
|
-
*/
|
|
449
|
-
connectionKey: string;
|
|
450
|
-
/**
|
|
451
|
-
* The unix timestamp in miliseconds that the session will expire at.
|
|
452
|
-
*/
|
|
453
|
-
expireTimeMs: number;
|
|
454
484
|
}
|
|
455
485
|
export interface CompleteLoginFailure {
|
|
456
486
|
success: false;
|
|
@@ -658,24 +688,8 @@ export interface ReplaceSessionRequest {
|
|
|
658
688
|
ipAddress: string;
|
|
659
689
|
}
|
|
660
690
|
export type ReplaceSessionResult = ReplaceSessionSuccess | ReplaceSessionFailure;
|
|
661
|
-
export interface ReplaceSessionSuccess {
|
|
691
|
+
export interface ReplaceSessionSuccess extends AuthSessionInfo {
|
|
662
692
|
success: true;
|
|
663
|
-
/**
|
|
664
|
-
* The ID of the user that the session is for.
|
|
665
|
-
*/
|
|
666
|
-
userId: string;
|
|
667
|
-
/**
|
|
668
|
-
* The secret key that provides access for the session.
|
|
669
|
-
*/
|
|
670
|
-
sessionKey: string;
|
|
671
|
-
/**
|
|
672
|
-
* The connection key that provides websocket access for the session.
|
|
673
|
-
*/
|
|
674
|
-
connectionKey: string;
|
|
675
|
-
/**
|
|
676
|
-
* The unix timestamp in miliseconds that the session will expire at.
|
|
677
|
-
*/
|
|
678
|
-
expireTimeMs: number;
|
|
679
693
|
}
|
|
680
694
|
export interface ReplaceSessionFailure {
|
|
681
695
|
success: false;
|