@lifeready/core 1.1.18 → 1.1.20

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 (38) hide show
  1. package/bundles/lifeready-core.umd.js +284 -204
  2. package/bundles/lifeready-core.umd.js.map +1 -1
  3. package/bundles/lifeready-core.umd.min.js +1 -1
  4. package/bundles/lifeready-core.umd.min.js.map +1 -1
  5. package/esm2015/lib/_common/utils.js +27 -3
  6. package/esm2015/lib/auth/auth.config.js +1 -1
  7. package/esm2015/lib/auth/auth.types.js +1 -1
  8. package/esm2015/lib/auth/life-ready-auth.service.js +83 -13
  9. package/esm2015/lib/file-upload/file-upload.service.js +12 -20
  10. package/esm2015/lib/idle/idle.service.js +8 -15
  11. package/esm2015/lib/key/key.service.js +4 -4
  12. package/esm2015/lib/lbop/lbop.service.js +4 -4
  13. package/esm2015/lib/life-ready.config.js +8 -12
  14. package/esm2015/lib/life-ready.module.js +5 -5
  15. package/esm2015/lib/password/password.service.js +11 -17
  16. package/esm2015/lib/profile/profile.service.js +4 -4
  17. package/esm2015/lib/register/register.service.js +4 -4
  18. package/esm2015/lib/time/time.service.js +4 -16
  19. package/esm2015/lib/tp-password-reset/tp-password-reset-user.service.js +4 -4
  20. package/fesm2015/lifeready-core.js +196 -146
  21. package/fesm2015/lifeready-core.js.map +1 -1
  22. package/lib/_common/utils.d.ts +10 -0
  23. package/lib/auth/auth.config.d.ts +2 -2
  24. package/lib/auth/auth.types.d.ts +0 -1
  25. package/lib/auth/life-ready-auth.service.d.ts +14 -5
  26. package/lib/file-upload/file-upload.service.d.ts +4 -4
  27. package/lib/idle/idle.service.d.ts +2 -2
  28. package/lib/key/key.service.d.ts +2 -2
  29. package/lib/lbop/lbop.service.d.ts +2 -2
  30. package/lib/life-ready.config.d.ts +6 -3
  31. package/lib/life-ready.module.d.ts +2 -2
  32. package/lib/password/password.service.d.ts +6 -5
  33. package/lib/profile/profile.service.d.ts +2 -2
  34. package/lib/register/register.service.d.ts +2 -2
  35. package/lib/time/time.service.d.ts +0 -1
  36. package/lib/tp-password-reset/tp-password-reset-user.service.d.ts +2 -2
  37. package/lifeready-core.metadata.json +1 -1
  38. package/package.json +1 -1
@@ -1,3 +1,5 @@
1
+ import { AuthClass } from '@aws-amplify/auth/lib-esm/Auth';
2
+ import { KcConfig } from '../life-ready.config';
1
3
  export declare function promiseAllMayAsync(values: any[]): Promise<any> | any;
2
4
  export declare function mapValuesMayAsync(obj: Record<string, any>, callback: (value: any, key: string, obj: Record<string, any>) => any | Promise<any>): Promise<any> | any;
3
5
  export declare function mapValuesAsync(obj: Record<string, any>, callback?: (value: any, key: string, obj: Record<string, any>) => any | Promise<any>): Promise<any>;
@@ -7,3 +9,11 @@ export declare function mapValuesAsync(obj: Record<string, any>, callback?: (val
7
9
  * @param defaultValue The value to return if value is undefined.
8
10
  */
9
11
  export declare function undefinedDefault(value: any, defaultValue: any): any;
12
+ export declare function getAccessJwtToken(auth: AuthClass): Promise<string>;
13
+ export declare function httpOptions(auth: AuthClass, config: KcConfig): Promise<{
14
+ withCredentials: boolean;
15
+ headers: {
16
+ 'x-kc-dev-user': string;
17
+ authorization: string;
18
+ };
19
+ }>;
@@ -1,5 +1,5 @@
1
1
  import { AuthClass } from '@aws-amplify/auth/lib-esm/Auth';
2
- import { LifeReadyConfig } from '../life-ready.config';
2
+ import { KcConfig } from '../life-ready.config';
3
3
  export declare function handleCognitoCallback<T>(method: (callback: (err?: Error, result?: T) => void) => void): Promise<T>;
4
4
  export declare const awsFetch: (authUrl: string) => (url: any, options: any) => Promise<Response>;
5
- export declare const configureAmplifyAuth: ({ authUrl: authUrl, userPoolId, userPoolWebClientId }: LifeReadyConfig, auth: AuthClass) => () => void;
5
+ export declare const configureAmplifyAuth: ({ authUrl: authUrl, userPoolId, userPoolWebClientId }: KcConfig, auth: AuthClass) => () => void;
@@ -35,7 +35,6 @@ export declare class CurrentUser {
35
35
  emailVerified: boolean;
36
36
  phone: string;
37
37
  phoneVerified: boolean;
38
- getAccessJwtToken: () => string;
39
38
  contactCard: MainContactCard;
40
39
  userDelete?: UserDeleteNode;
41
40
  userPlans: UserPlan[];
@@ -1,3 +1,4 @@
1
+ import { HttpClient } from '@angular/common/http';
1
2
  import { AuthClass } from '@aws-amplify/auth/lib-esm/Auth';
2
3
  import { ReplaySubject } from 'rxjs';
3
4
  import { LrGraphQLService } from '../api/lr-graphql';
@@ -7,7 +8,7 @@ import { IdleService } from '../idle/idle.service';
7
8
  import { KeyFactoryService } from '../key/key-factory.service';
8
9
  import { KeyGraphService } from '../key/key-graph.service';
9
10
  import { KeyService } from '../key/key.service';
10
- import { LifeReadyConfig } from '../life-ready.config';
11
+ import { KcConfig } from '../life-ready.config';
11
12
  import { PasswordService } from '../password/password.service';
12
13
  import { PersistService } from '../persist/persist.service';
13
14
  import { ProfileService } from '../profile/profile.service';
@@ -32,19 +33,27 @@ export declare class LifeReadyAuthService {
32
33
  private persistService;
33
34
  private encryptionService;
34
35
  private assemblyController;
36
+ private http;
35
37
  private hubSubject;
36
38
  private currentUser;
37
39
  private currentResetUser;
38
40
  private logoutListeners;
39
- constructor(config: LifeReadyConfig, auth: AuthClass, keyFactory: KeyFactoryService, keyService: KeyService, profileService: ProfileService, keyGraphService: KeyGraphService, passwordService: PasswordService, idleService: IdleService, lrGraphQL: LrGraphQLService, tpPasswordResetProcessorService: TpPasswordResetProcessorService, persistService: PersistService, encryptionService: EncryptionService, assemblyController: TpPasswordResetAssemblyController);
41
+ constructor(config: KcConfig, auth: AuthClass, keyFactory: KeyFactoryService, keyService: KeyService, profileService: ProfileService, keyGraphService: KeyGraphService, passwordService: PasswordService, idleService: IdleService, lrGraphQL: LrGraphQLService, tpPasswordResetProcessorService: TpPasswordResetProcessorService, persistService: PersistService, encryptionService: EncryptionService, assemblyController: TpPasswordResetAssemblyController, http: HttpClient);
40
42
  initialise(): Promise<void>;
43
+ debugLogin(username: string, password: CryptoKey): Promise<CurrentUser>;
44
+ /**
45
+ * Login using the server side session method.
46
+ */
47
+ private debugLoginUsingSession;
48
+ private debugLoadUser;
49
+ getAccessJwtToken(): Promise<string>;
41
50
  importPassword(plainPassword: string): Promise<CryptoKey>;
42
51
  addLogoutListener(callback: LogoutListener): void;
43
52
  removeLogoutListener(callback: LogoutListener): void;
44
53
  private loginIdpImpl;
45
54
  private loginIdp;
46
- protected handleSessionEncryptionKey(): Promise<void>;
47
- protected handlePostAuth(cognitoUser: CognitoChallengeUser): Promise<void>;
55
+ private handleSessionEncryptionKey;
56
+ private handlePostAuth;
48
57
  login(emailOrPhone: string, password: CryptoKey, { tpPasswordResetAutoComplete }?: LoginOptions): Promise<LoginResult>;
49
58
  loginImpl(emailOrPhone: string, password: CryptoKey): Promise<LoginResult>;
50
59
  verifyLogin(challenge: CognitoChallengeUser, password: CryptoKey, rememberMe: boolean, code: string): Promise<CurrentUser>;
@@ -57,7 +66,7 @@ export declare class LifeReadyAuthService {
57
66
  watchAuth(): ReplaySubject<any>;
58
67
  logout(): Promise<void>;
59
68
  private getUserAttribute;
60
- loadResetUser(password?: CryptoKey): Promise<TpPasswordResetUser>;
69
+ private loadResetUser;
61
70
  refreshAccessToken(): Promise<unknown>;
62
71
  completeRequest(newPassword: CryptoKey): Promise<void>;
63
72
  private recoverAssemblyKey;
@@ -1,13 +1,13 @@
1
1
  import { HttpClient } from '@angular/common/http';
2
+ import { AuthClass } from '@aws-amplify/auth/lib-esm/Auth';
2
3
  import { JSONObject } from '../api/types';
3
- import { LifeReadyAuthService } from '../auth/life-ready-auth.service';
4
- import { LifeReadyConfig } from '../life-ready.config';
4
+ import { KcConfig } from '../life-ready.config';
5
5
  import { UploadEncryptedFileOptions } from './file-upload.types';
6
6
  export declare class FileUploadService {
7
7
  private config;
8
8
  private http;
9
- private lrAuth;
10
- constructor(config: LifeReadyConfig, http: HttpClient, lrAuth: LifeReadyAuthService);
9
+ private auth;
10
+ constructor(config: KcConfig, http: HttpClient, auth: AuthClass);
11
11
  downloadEncryptedFile(fileStateNodeId: string): Promise<JSONObject>;
12
12
  downloadEncryptedFile2(fileStateNodeId: string): Promise<string>;
13
13
  loadFile(file: File): Promise<ArrayBuffer>;
@@ -4,7 +4,7 @@ import { Idle } from '@ng-idle/core';
4
4
  import { Keepalive } from '@ng-idle/keepalive';
5
5
  import { KeyService } from '../key/key.service';
6
6
  import { Key } from '../key/key.types';
7
- import { LifeReadyConfig } from '../life-ready.config';
7
+ import { KcConfig } from '../life-ready.config';
8
8
  import { KeepaliveResult } from './idle.types';
9
9
  export interface IdleServiceInit {
10
10
  onTimeout?: (() => void) | (() => Promise<void>) | null;
@@ -25,7 +25,7 @@ export declare class IdleService {
25
25
  private initCalled;
26
26
  private onTimeout;
27
27
  private onKeepalive;
28
- constructor(config: LifeReadyConfig, http: HttpClient, idle: Idle, keepalive: Keepalive, keyService: KeyService, auth: AuthClass);
28
+ constructor(config: KcConfig, http: HttpClient, idle: Idle, keepalive: Keepalive, keyService: KeyService, auth: AuthClass);
29
29
  private assertInit;
30
30
  init(params?: IdleServiceInit): Promise<void>;
31
31
  keepalivePost(): Promise<{
@@ -1,4 +1,4 @@
1
- import { LifeReadyConfig } from '../life-ready.config';
1
+ import { KcConfig } from '../life-ready.config';
2
2
  import { PersistService } from '../persist/persist.service';
3
3
  import { Key, PassKey } from './key.types';
4
4
  export declare class UserKeys {
@@ -20,7 +20,7 @@ export declare class KeyService {
20
20
  readonly DEFAULT_PASS_IDP_PBKDF_ITER = 100000;
21
21
  readonly DEFAULT_PASS_KEY_PBKDF_ITER = 100000;
22
22
  readonly DEFAULT_LBOP_KEY_PBKDF_ITER = 100000;
23
- constructor(config: LifeReadyConfig, persistService: PersistService);
23
+ constructor(config: KcConfig, persistService: PersistService);
24
24
  resetKeys(): void;
25
25
  purgeKeys(): void;
26
26
  populateKeys(keys: UserKeys): void;
@@ -8,7 +8,7 @@ import { KeyFactoryService as KFS } from '../key/key-factory.service';
8
8
  import { KeyGraphService } from '../key/key-graph.service';
9
9
  import { KeyService } from '../key/key.service';
10
10
  import { PassKeyParams } from '../key/key.types';
11
- import { LifeReadyConfig } from '../life-ready.config';
11
+ import { KcConfig } from '../life-ready.config';
12
12
  import { PasswordService } from '../password/password.service';
13
13
  export interface SetPasswordParams {
14
14
  lbopId: string;
@@ -84,7 +84,7 @@ export declare class LbopService {
84
84
  private passwordService;
85
85
  private readonly CLIENT_NONCE_LENGTH;
86
86
  private readonly LBOP_WORDS;
87
- constructor(config: LifeReadyConfig, http: HttpClient, lrApollo: LrApolloService, auth: AuthClass, authService: LifeReadyAuthService, keyFactory: KFS, keyService: KeyService, encryptionService: EncryptionService, keyGraph: KeyGraphService, passwordService: PasswordService);
87
+ constructor(config: KcConfig, http: HttpClient, lrApollo: LrApolloService, auth: AuthClass, authService: LifeReadyAuthService, keyFactory: KFS, keyService: KeyService, encryptionService: EncryptionService, keyGraph: KeyGraphService, passwordService: PasswordService);
88
88
  private getPartial;
89
89
  remove(id: string): Promise<string>;
90
90
  update({ id, name }: UpdateLbopParams): Promise<Lbop>;
@@ -1,8 +1,8 @@
1
1
  import { InjectionToken } from '@angular/core';
2
2
  import { ApolloClientOptions } from '@apollo/client/core';
3
3
  import { AuthClass } from '@aws-amplify/auth/lib-esm/Auth';
4
- export declare const LR_CONFIG: InjectionToken<LifeReadyConfig>;
5
- export interface LifeReadyConfig {
4
+ export declare const KC_CONFIG: InjectionToken<KcConfig>;
5
+ export interface KcConfig {
6
6
  authUrl: string;
7
7
  apiUrl: string;
8
8
  apolloUrl: string;
@@ -10,5 +10,8 @@ export interface LifeReadyConfig {
10
10
  userPoolWebClientId: string;
11
11
  apolloConfig?: ApolloClientOptions<any>;
12
12
  disableSessionEncryptionKey?: boolean;
13
+ debug?: {
14
+ username?: string;
15
+ };
13
16
  }
14
- export declare const configureApollo: (config: LifeReadyConfig, auth: AuthClass) => ApolloClientOptions<any>;
17
+ export declare const configureApollo: (config: KcConfig, auth: AuthClass) => ApolloClientOptions<any>;
@@ -1,5 +1,5 @@
1
1
  import { ModuleWithProviders } from '@angular/core';
2
- import { LifeReadyConfig } from './life-ready.config';
2
+ import { KcConfig } from './life-ready.config';
3
3
  export declare class LifeReadyModule {
4
- static forRoot(config: LifeReadyConfig): ModuleWithProviders<LifeReadyModule>;
4
+ static forRoot(config: KcConfig): ModuleWithProviders<LifeReadyModule>;
5
5
  }
@@ -4,10 +4,9 @@ import { Duration } from 'moment';
4
4
  import { JWK } from 'node-jose';
5
5
  import { PassKeyBundle } from '../auth/auth.types';
6
6
  import { EncryptionService } from '../encryption/encryption.service';
7
- import { IdleService } from '../idle/idle.service';
8
7
  import { KeyFactoryService as KFS } from '../key/key-factory.service';
9
8
  import { KeyGraphService } from '../key/key-graph.service';
10
- import { LifeReadyConfig } from '../life-ready.config';
9
+ import { KcConfig } from '../life-ready.config';
11
10
  import { ProfileService } from '../profile/profile.service';
12
11
  import { WebCryptoService } from '../web-crypto/web-crypto.service';
13
12
  import { LrApolloService } from './../api/lr-apollo.service';
@@ -31,9 +30,8 @@ export declare class PasswordService {
31
30
  private encryptionService;
32
31
  private keyGraph;
33
32
  private webCryptoService;
34
- private idleService;
35
33
  private readonly CLIENT_NONCE_LENGTH;
36
- constructor(config: LifeReadyConfig, http: HttpClient, apollo: LrApolloService, auth: AuthClass, profileService: ProfileService, keyFactory: KFS, encryptionService: EncryptionService, keyGraph: KeyGraphService, webCryptoService: WebCryptoService, idleService: IdleService);
34
+ constructor(config: KcConfig, http: HttpClient, apollo: LrApolloService, auth: AuthClass, profileService: ProfileService, keyFactory: KFS, encryptionService: EncryptionService, keyGraph: KeyGraphService, webCryptoService: WebCryptoService);
37
35
  checkPassword(plainPassword: string): Promise<PasswordCheck>;
38
36
  getExposureCount(plainPassword: string): Promise<number>;
39
37
  getPassIdpString(passIdp: JWK.Key): any;
@@ -66,7 +64,10 @@ export declare class PasswordService {
66
64
  */
67
65
  isLoginRequired(): Promise<boolean>;
68
66
  changePassword(password: CryptoKey, newPassword: CryptoKey): Promise<void>;
69
- changePasswordComplete(accessToken: string, useNewPassword: boolean, token?: string): Promise<Object>;
67
+ changePasswordComplete(options: {
68
+ useNewPassword: boolean;
69
+ token?: string;
70
+ }): Promise<Object>;
70
71
  private getVerifierPrK;
71
72
  private verifyPassword;
72
73
  private changePasswordMutation;
@@ -5,7 +5,7 @@ import { EncryptionService } from '../encryption/encryption.service';
5
5
  import { KeyGraphService } from '../key/key-graph.service';
6
6
  import { KeyMetaService } from '../key/key-meta.service';
7
7
  import { KeyService } from '../key/key.service';
8
- import { LifeReadyConfig } from '../life-ready.config';
8
+ import { KcConfig } from '../life-ready.config';
9
9
  import { UserPlan } from '../plan/plan.types';
10
10
  import { ApiContactCard, ApiCurrentUser, MainContactCard, MainContactCardFields, PassIdpApiResult } from './profile.types';
11
11
  export declare class ProfileService {
@@ -16,7 +16,7 @@ export declare class ProfileService {
16
16
  private keyMetaService;
17
17
  private keyGraph;
18
18
  private encryptionService;
19
- constructor(config: LifeReadyConfig, http: HttpClient, lrApollo: LrApolloService, keyService: KeyService, keyMetaService: KeyMetaService, keyGraph: KeyGraphService, encryptionService: EncryptionService);
19
+ constructor(config: KcConfig, http: HttpClient, lrApollo: LrApolloService, keyService: KeyService, keyMetaService: KeyMetaService, keyGraph: KeyGraphService, encryptionService: EncryptionService);
20
20
  getPassIdpParams(emailOrPhone: string): Promise<PassIdpApiResult>;
21
21
  getCurrentUser(): Promise<{
22
22
  currentUser: ApiCurrentUser;
@@ -3,7 +3,7 @@ import { AuthClass } from '@aws-amplify/auth/lib-esm/Auth';
3
3
  import { RegisterResult } from '../auth/auth.types';
4
4
  import { EncryptionService } from '../encryption/encryption.service';
5
5
  import { KeyFactoryService } from '../key/key-factory.service';
6
- import { LifeReadyConfig } from '../life-ready.config';
6
+ import { KcConfig } from '../life-ready.config';
7
7
  import { PasswordService } from '../password/password.service';
8
8
  export declare class RegisterService {
9
9
  private config;
@@ -12,7 +12,7 @@ export declare class RegisterService {
12
12
  private keyFactory;
13
13
  private encryptionService;
14
14
  private passwordService;
15
- constructor(config: LifeReadyConfig, auth: AuthClass, http: HttpClient, keyFactory: KeyFactoryService, encryptionService: EncryptionService, passwordService: PasswordService);
15
+ constructor(config: KcConfig, auth: AuthClass, http: HttpClient, keyFactory: KeyFactoryService, encryptionService: EncryptionService, passwordService: PasswordService);
16
16
  /**
17
17
  * Request a verification code to be sent out to an email.
18
18
  * @return Info needed to be submitted along with the verification code
@@ -9,7 +9,6 @@ export declare class TimeService {
9
9
  offsetMs: number;
10
10
  verified: boolean;
11
11
  constructor(auth: AuthClass, apollo: Apollo);
12
- private getAccessToken;
13
12
  private verifyCognito;
14
13
  private refresh;
15
14
  serverNow(): Promise<number>;
@@ -5,7 +5,7 @@ import { ISignUpResult } from 'amazon-cognito-identity-js';
5
5
  import { LrService } from '../api/lr-graphql';
6
6
  import { EncryptionService } from '../encryption/encryption.service';
7
7
  import { KeyFactoryService } from '../key/key-factory.service';
8
- import { LifeReadyConfig } from '../life-ready.config';
8
+ import { KcConfig } from '../life-ready.config';
9
9
  import { PasswordService } from '../password/password.service';
10
10
  import { RequestResetResult } from './tp-password-reset.types';
11
11
  export declare class TpPasswordResetUserService extends LrService {
@@ -17,7 +17,7 @@ export declare class TpPasswordResetUserService extends LrService {
17
17
  private passwordService;
18
18
  private http;
19
19
  private auth;
20
- constructor(ngZone: NgZone, injector: Injector, config: LifeReadyConfig, keyFactory: KeyFactoryService, encryptionService: EncryptionService, passwordService: PasswordService, http: HttpClient, auth: AuthClass);
20
+ constructor(ngZone: NgZone, injector: Injector, config: KcConfig, keyFactory: KeyFactoryService, encryptionService: EncryptionService, passwordService: PasswordService, http: HttpClient, auth: AuthClass);
21
21
  verifyEmailContact(email: any): Promise<{
22
22
  claimId: string;
23
23
  }>;