@tech4good/platform-auth 0.0.0-stage → 0.1.0-alpha.0
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/EXTRACTION-CHANGES.md +159 -0
- package/FUTURE-WORK.md +73 -0
- package/MIGRATION.md +89 -0
- package/README.md +213 -2
- package/fesm2022/tech4good-platform-auth-firebase.mjs +254 -0
- package/fesm2022/tech4good-platform-auth-firebase.mjs.map +1 -0
- package/fesm2022/tech4good-platform-auth-profiles.mjs +72 -0
- package/fesm2022/tech4good-platform-auth-profiles.mjs.map +1 -0
- package/fesm2022/tech4good-platform-auth-testing.mjs +198 -0
- package/fesm2022/tech4good-platform-auth-testing.mjs.map +1 -0
- package/fesm2022/tech4good-platform-auth.mjs +390 -0
- package/fesm2022/tech4good-platform-auth.mjs.map +1 -0
- package/package.json +45 -3
- package/types/tech4good-platform-auth-firebase.d.ts +99 -0
- package/types/tech4good-platform-auth-firebase.d.ts.map +1 -0
- package/types/tech4good-platform-auth-profiles.d.ts +55 -0
- package/types/tech4good-platform-auth-profiles.d.ts.map +1 -0
- package/types/tech4good-platform-auth-testing.d.ts +87 -0
- package/types/tech4good-platform-auth-testing.d.ts.map +1 -0
- package/types/tech4good-platform-auth.d.ts +164 -0
- package/types/tech4good-platform-auth.d.ts.map +1 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Provider } from '@angular/core';
|
|
3
|
+
import { DataEntity, NewDataEntity } from '@tech4good/platform-data';
|
|
4
|
+
import { AuthSession, ProfileProvisioner } from '@tech4good/platform-auth';
|
|
5
|
+
|
|
6
|
+
/** Default lab fields; each app extends this with its own access states and roles. */
|
|
7
|
+
interface LabProfile extends DataEntity {
|
|
8
|
+
name: string;
|
|
9
|
+
isAdmin: boolean;
|
|
10
|
+
consented: boolean;
|
|
11
|
+
photoURL?: string | null;
|
|
12
|
+
}
|
|
13
|
+
type ProfileRecord = DataEntity & Record<string, any>;
|
|
14
|
+
interface ProfileChanges {
|
|
15
|
+
/** New fields when absent; only changed fields when present; null means no write. */
|
|
16
|
+
profile: Record<string, unknown> | null;
|
|
17
|
+
privateProfile: Record<string, unknown> | null;
|
|
18
|
+
}
|
|
19
|
+
/** Atomic read/decide/write boundary. A get followed by an unconditional set is insufficient. */
|
|
20
|
+
interface ProfilePersistence {
|
|
21
|
+
ensure(profileCollection: string, privateCollection: string | null, uid: string, changes: (profile: ProfileRecord | null, privateProfile: ProfileRecord | null) => ProfileChanges): Promise<ProfileRecord>;
|
|
22
|
+
}
|
|
23
|
+
declare const PROFILE_PERSISTENCE: InjectionToken<ProfilePersistence>;
|
|
24
|
+
interface UserProfileOptions<T extends LabProfile> {
|
|
25
|
+
profileCollection?: string;
|
|
26
|
+
/** Set null when this app does not keep a separate private email record. */
|
|
27
|
+
privateCollection?: string | null;
|
|
28
|
+
/** Called only for a missing profile. Must be pure: Firestore can retry it. */
|
|
29
|
+
createProfile: (session: AuthSession) => NewDataEntity<T>;
|
|
30
|
+
/** Override the default generated-name/avatar synchronization for existing records. */
|
|
31
|
+
reconcileProfile?: (profile: T, session: AuthSession) => Partial<NewDataEntity<T>>;
|
|
32
|
+
generatedNames?: readonly string[];
|
|
33
|
+
}
|
|
34
|
+
declare const USER_PROFILE_OPTIONS: InjectionToken<UserProfileOptions<any>>;
|
|
35
|
+
/** Default new-user fields. App access state is deliberately supplied by the caller. */
|
|
36
|
+
declare function defaultLabProfile(session: AuthSession, fallbackName?: string): NewDataEntity<LabProfile>;
|
|
37
|
+
declare class UserProfileService implements ProfileProvisioner {
|
|
38
|
+
private readonly persistence;
|
|
39
|
+
private readonly options;
|
|
40
|
+
/**
|
|
41
|
+
* Ensure users/{uid} and userPrivates/{uid} exist for an authenticated user.
|
|
42
|
+
* Initialize missing profiles with app-configured defaults. For an existing
|
|
43
|
+
* profile, only update a generated name or changed avatar unless the app
|
|
44
|
+
* explicitly supplies another reconciliation policy. Existing consent, roles
|
|
45
|
+
* and access state must not be replaced with new-user defaults on each login.
|
|
46
|
+
*/
|
|
47
|
+
ensureUserProfile(session: AuthSession): Promise<ProfileRecord>;
|
|
48
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UserProfileService, never>;
|
|
49
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<UserProfileService>;
|
|
50
|
+
}
|
|
51
|
+
declare function provideUserProfiles<T extends LabProfile>(options: UserProfileOptions<T>): Provider[];
|
|
52
|
+
|
|
53
|
+
export { PROFILE_PERSISTENCE, USER_PROFILE_OPTIONS, UserProfileService, defaultLabProfile, provideUserProfiles };
|
|
54
|
+
export type { LabProfile, ProfileChanges, ProfilePersistence, ProfileRecord, UserProfileOptions };
|
|
55
|
+
//# sourceMappingURL=tech4good-platform-auth-profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tech4good-platform-auth-profiles.d.ts","sources":["../../profiles/public-api.ts"],"mappings":";;;;;AAIA;AACM,UAAW,UAAW,SAAQ,UAAU;;;;AAI5C;AACD;AACK,KAAM,aAAa,GAAG,UAAU,GAAG,MAAM;UAC9B,cAAc;;aAEpB,MAAM;oBACC,MAAM;AACvB;AACD;UACiB,kBAAkB;AACjC,wGACqB,aAAa,yBAAyB,aAAa,YAAY,cAAc,GAC/F,OAAO,CAAC,aAAa;AACzB;AACD,cAAa,mBAAmB,EAAA,cAAA,CAAA,kBAAA;AAE1B,UAAW,kBAAkB,WAAW,UAAU;;;AAGtD;;6BAEyB,WAAW,KAAK,aAAa;;AAEtD,6CAAyC,WAAW,KAAK,OAAO,CAAC,aAAa;AAC9E;AACD;AACD,cAAa,oBAAoB,EAAA,cAAA,CAAA,kBAAA;AAEjC;AACA,iBAAgB,iBAAiB,UAAU,WAAW,0BAA6B,aAAa,CAAC,UAAU;AAS3G,cACa,kBAAmB,YAAW,kBAAkB;AAC3D;AACA;AAEA;;;;;;AAMG;+BACwB,WAAW,GAAG,OAAO,CAAC,aAAa;yCAXnD,kBAAkB;6CAAlB,kBAAkB;AAsC9B;AACD,iBAAgB,mBAAmB,WAAW,UAAU,WAAW,kBAAkB,MAAM,QAAQ;;","names":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as _ngrx_signals from '@ngrx/signals';
|
|
2
|
+
import * as rxjs from 'rxjs';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { InjectionToken, Provider } from '@angular/core';
|
|
5
|
+
import { AuthSession, AuthAccess, AuthStatus } from '@tech4good/platform-auth';
|
|
6
|
+
import { ProfilePersistence, ProfileRecord, ProfileChanges } from '@tech4good/platform-auth/profiles';
|
|
7
|
+
|
|
8
|
+
interface MockAuthOptions {
|
|
9
|
+
initialSession?: AuthSession | null;
|
|
10
|
+
googleSession?: AuthSession;
|
|
11
|
+
emailSession?: AuthSession;
|
|
12
|
+
anonymousUid?: string;
|
|
13
|
+
/** Opt-in browser persistence, matching the app's former mockUser key. */
|
|
14
|
+
persistSession?: boolean;
|
|
15
|
+
storageKey?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const MOCK_AUTH_OPTIONS: InjectionToken<MockAuthOptions>;
|
|
18
|
+
/** Generic fixture identity; apps supply their own seeded user's identity. */
|
|
19
|
+
declare function createMockAuthSession(overrides?: Partial<AuthSession>): AuthSession;
|
|
20
|
+
/** In-memory auth simulator. It never contacts an identity provider or sends email. */
|
|
21
|
+
declare class MockAuthService implements AuthAccess {
|
|
22
|
+
private document;
|
|
23
|
+
private context;
|
|
24
|
+
private options;
|
|
25
|
+
private sessions;
|
|
26
|
+
/** Configure a rejection for a particular operation, then remove it to retry. */
|
|
27
|
+
readonly failures: Partial<Record<keyof AuthAccess, unknown>>;
|
|
28
|
+
constructor(options?: MockAuthOptions);
|
|
29
|
+
afUser(): rxjs.Observable<AuthSession | null>;
|
|
30
|
+
get session(): AuthSession | null;
|
|
31
|
+
/** Simulate restoration, another tab signing out, or an external UID change. */
|
|
32
|
+
setSession(session: AuthSession | null): void;
|
|
33
|
+
private check;
|
|
34
|
+
private complete;
|
|
35
|
+
signInWithGoogle(): Promise<AuthSession>;
|
|
36
|
+
signInAnonymously(): Promise<AuthSession>;
|
|
37
|
+
linkGoogle(): Promise<AuthSession>;
|
|
38
|
+
sendEmailSignInLink(email: string): Promise<void>;
|
|
39
|
+
sendEmailLinkForCurrentAccount(): Promise<void>;
|
|
40
|
+
getStoredEmailForEmailLink(): string | null;
|
|
41
|
+
completeEmailSignInLink(url: string, email: string): Promise<AuthSession>;
|
|
42
|
+
logout(): Promise<void>;
|
|
43
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MockAuthService, never>;
|
|
44
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MockAuthService>;
|
|
45
|
+
}
|
|
46
|
+
declare function provideMockAuth(options?: MockAuthOptions): Provider[];
|
|
47
|
+
/**
|
|
48
|
+
* Lightweight UI-test store feature: skips profile loading deliberately. Use
|
|
49
|
+
* withAuthSession + provideMockAuth to test the actual provisioning lifecycle.
|
|
50
|
+
* Apps add their user selector over their own profile fixtures.
|
|
51
|
+
*/
|
|
52
|
+
declare function withMockAuthSession(options?: MockAuthOptions): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
|
|
53
|
+
state: {
|
|
54
|
+
afUser: AuthSession | null;
|
|
55
|
+
isLoadingLogin: boolean;
|
|
56
|
+
authStatus: AuthStatus;
|
|
57
|
+
authError: unknown;
|
|
58
|
+
};
|
|
59
|
+
props: {};
|
|
60
|
+
methods: {
|
|
61
|
+
loadAuth: () => void;
|
|
62
|
+
signInWithGoogle: () => Promise<void>;
|
|
63
|
+
loginAnonymously: () => Promise<void>;
|
|
64
|
+
linkGoogle: () => Promise<void>;
|
|
65
|
+
sendEmailSignInLink: (email: string) => Promise<void>;
|
|
66
|
+
sendEmailLinkForCurrentAccount: () => Promise<void>;
|
|
67
|
+
getStoredEmailForEmailLink: () => string | null;
|
|
68
|
+
completeEmailSignInLink: (url: string, email: string) => Promise<AuthSession>;
|
|
69
|
+
deleteAnonymousAccount: () => Promise<void>;
|
|
70
|
+
logout: () => Promise<void>;
|
|
71
|
+
whenReady: () => Promise<AuthSession | null>;
|
|
72
|
+
};
|
|
73
|
+
}>;
|
|
74
|
+
|
|
75
|
+
/** Same profile decisions as Firestore, with serialized mock read/decide/write operations. */
|
|
76
|
+
declare class MockProfilePersistence implements ProfilePersistence {
|
|
77
|
+
private readonly db;
|
|
78
|
+
private pending;
|
|
79
|
+
ensure(collection: string, privateCollection: string | null, uid: string, decide: (profile: ProfileRecord | null, privateProfile: ProfileRecord | null) => ProfileChanges): Promise<ProfileRecord>;
|
|
80
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MockProfilePersistence, never>;
|
|
81
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MockProfilePersistence>;
|
|
82
|
+
}
|
|
83
|
+
declare function provideMockProfiles(): Provider[];
|
|
84
|
+
|
|
85
|
+
export { MOCK_AUTH_OPTIONS, MockAuthService, MockProfilePersistence, createMockAuthSession, provideMockAuth, provideMockProfiles, withMockAuthSession };
|
|
86
|
+
export type { MockAuthOptions };
|
|
87
|
+
//# sourceMappingURL=tech4good-platform-auth-testing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tech4good-platform-auth-testing.d.ts","sources":["../../testing/auth.ts","../../testing/profiles.ts"],"mappings":";;;;;;;UAMiB,eAAe;AAC9B,qBAAiB,WAAW;oBACZ,WAAW;mBACZ,WAAW;;;;;AAK3B;AACD,cAAa,iBAAiB,EAAA,cAAA,CAAA,eAAA;AAI9B;AACA,iBAAgB,qBAAqB,aAAY,OAAO,CAAC,WAAW,IAAS,WAAW;AAOxF;AACA,cACa,eAAgB,YAAW,UAAU;;;;;;AAMhD,uBAAmB,OAAO,CAAC,MAAM,OAAO,UAAU;AAEX,0BAAS,eAA2C;cAWrF,IAAA,CAAA,UAAA,CAAA,WAAA;AACN,mBAAe,WAAW;;AAE1B,wBAAoB,WAAW;AAU/B;AAGA;AACM,wBAAoB,OAAO,CAAC,WAAW;AAIvC,yBAAqB,OAAO,CAAC,WAAW;AAKxC,kBAAc,OAAO,CAAC,WAAW;wCAUG,OAAO;AAK3C,sCAAkC,OAAO;;AAMzC,yDAAqD,OAAO,CAAC,WAAW;AAexE,cAAU,OAAO;yCAjFZ,eAAe;6CAAf,eAAe;AAkF3B;AACD,iBAAgB,eAAe,WAAU,eAAoB,GAAG,QAAQ;AAIxE;;;;AAIG;AACH,iBAAgB,mBAAmB,WAAU,eAAoB,GAAA,aAAA,CAAA,kBAAA,CAAA,aAAA,CAAA,kBAAA;;AAEjC,gBAAA,WAAW;;oBAA8D,UAAU;;;;;;;;;gDAUpE,OAAA;;;AAGJ,iEAAqB,OAAA,CAAA,WAAA;;;;;AAO/D;;AC1ID;AACA,cACa,sBAAuB,YAAW,kBAAkB;AAC/D;;AAEA,gGACoB,aAAa,yBAAyB,aAAa,YAAY,cAAc,GAC9F,OAAO,CAAC,aAAa;yCALb,sBAAsB;6CAAtB,sBAAsB;AA4BlC;AACD,iBAAgB,mBAAmB,IAAI,QAAQ;;","names":[]}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Provider } from '@angular/core';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import * as _ngrx_signals_rxjs_interop from '@ngrx/signals/rxjs-interop';
|
|
5
|
+
import * as _ngrx_signals from '@ngrx/signals';
|
|
6
|
+
|
|
7
|
+
/** Normalized authentication identity, independent of any backend SDK. */
|
|
8
|
+
interface AuthSession {
|
|
9
|
+
uid: string;
|
|
10
|
+
email: string | null;
|
|
11
|
+
displayName: string | null;
|
|
12
|
+
photoURL: string | null;
|
|
13
|
+
isAnonymous: boolean;
|
|
14
|
+
emailVerified: boolean;
|
|
15
|
+
emailLinkEnabled: boolean;
|
|
16
|
+
providerIds: string[];
|
|
17
|
+
}
|
|
18
|
+
/** Auth operations used by the current lab apps. Firebase-specific objects stay in the adapter. */
|
|
19
|
+
interface AuthAccess {
|
|
20
|
+
afUser(): Observable<AuthSession | null>;
|
|
21
|
+
signInWithGoogle(): Promise<AuthSession>;
|
|
22
|
+
signInAnonymously(): Promise<AuthSession>;
|
|
23
|
+
linkGoogle(): Promise<AuthSession>;
|
|
24
|
+
sendEmailSignInLink(email: string): Promise<void>;
|
|
25
|
+
sendEmailLinkForCurrentAccount(): Promise<void>;
|
|
26
|
+
getStoredEmailForEmailLink(): string | null;
|
|
27
|
+
completeEmailSignInLink(url: string, email: string): Promise<AuthSession>;
|
|
28
|
+
logout(): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
declare const AUTH_ACCESS: InjectionToken<AuthAccess>;
|
|
31
|
+
/** Every ready authenticated session must have an application profile. */
|
|
32
|
+
interface ProfileProvisioner {
|
|
33
|
+
ensureUserProfile(session: AuthSession): Promise<unknown>;
|
|
34
|
+
}
|
|
35
|
+
declare const PROFILE_PROVISIONER: InjectionToken<ProfileProvisioner>;
|
|
36
|
+
/** App-owned integration, not a registry of all domain stores. */
|
|
37
|
+
interface AuthLifecycle {
|
|
38
|
+
loadProfile(session: AuthSession): Promise<void>;
|
|
39
|
+
streamProfile(session: AuthSession): void;
|
|
40
|
+
/** Stop global listeners; reset explicitly selected auth/profile stores and their history. */
|
|
41
|
+
clearSessionState(): void;
|
|
42
|
+
/** Delete app-owned guest records and the account. The app supplies its deletion graph. */
|
|
43
|
+
deleteAnonymousAccount(): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
declare const AUTH_LIFECYCLE: InjectionToken<AuthLifecycle>;
|
|
46
|
+
|
|
47
|
+
interface PlatformAuthOptions {
|
|
48
|
+
/** Browser callback path or absolute URL; app routing remains app-owned. */
|
|
49
|
+
emailActionUrl?: string;
|
|
50
|
+
/** Existing applications retain app.email-link.* storage keys by default. */
|
|
51
|
+
storagePrefix?: string;
|
|
52
|
+
/** Cookie fallback lifetime; localStorage retains the original persistent behavior. */
|
|
53
|
+
emailContextMaxAgeSeconds?: number;
|
|
54
|
+
}
|
|
55
|
+
declare const PLATFORM_AUTH_OPTIONS: InjectionToken<PlatformAuthOptions>;
|
|
56
|
+
declare function providePlatformAuth(options?: PlatformAuthOptions): Provider[];
|
|
57
|
+
|
|
58
|
+
/** Supported email magic link authentication workflows. */
|
|
59
|
+
type EmailLinkFlow = 'sign-in' | 'guest-upgrade' | 'link-email';
|
|
60
|
+
/**
|
|
61
|
+
* Encapsulates the same-browser state required to complete an email link authentication request.
|
|
62
|
+
*/
|
|
63
|
+
type EmailLinkContext = {
|
|
64
|
+
/** The target email address the magic link was sent to. */
|
|
65
|
+
email: string;
|
|
66
|
+
/** The intended authentication workflow. */
|
|
67
|
+
flow: EmailLinkFlow;
|
|
68
|
+
/** The current user's Firebase UID if upgrading a guest or linking email to an existing account. */
|
|
69
|
+
uid: string | null;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Manages same-browser context persistence for passwordless email magic link sign-in flows.
|
|
73
|
+
*
|
|
74
|
+
* When a user requests a magic link, Firebase Auth redirects them out of the app to their email client.
|
|
75
|
+
* Upon clicking the link in the email, the user lands back on the `/auth/action` route.
|
|
76
|
+
* To securely process the callback, the application must verify the originating email address,
|
|
77
|
+
* flow type, and originating user UID (for account upgrades/linking).
|
|
78
|
+
*
|
|
79
|
+
* To remain resilient against browser storage restrictions (e.g., Safari ITP, private browsing mode),
|
|
80
|
+
* this service uses a dual-layer strategy:
|
|
81
|
+
* 1. Primary storage in `localStorage`.
|
|
82
|
+
* 2. Fallback in a short-lived (30-minute), `SameSite=Lax` cookie.
|
|
83
|
+
*/
|
|
84
|
+
declare class EmailLinkContextService {
|
|
85
|
+
private readonly document;
|
|
86
|
+
private readonly options;
|
|
87
|
+
private readonly prefix;
|
|
88
|
+
private readonly emailKey;
|
|
89
|
+
private readonly flowKey;
|
|
90
|
+
private readonly uidKey;
|
|
91
|
+
private readonly maxAgeSeconds;
|
|
92
|
+
/**
|
|
93
|
+
* Persists email magic link context into localStorage and fallback cookies before sending the email.
|
|
94
|
+
*
|
|
95
|
+
* @param context The email, flow type, and optional originating UID to store.
|
|
96
|
+
*/
|
|
97
|
+
remember(context: EmailLinkContext): void;
|
|
98
|
+
/** Retrieves the stored target email address, or `null` if not found or expired. */
|
|
99
|
+
getEmail(): string | null;
|
|
100
|
+
/** Retrieves the stored email link flow type (`sign-in`, `guest-upgrade`, or `link-email`). */
|
|
101
|
+
getFlow(): EmailLinkFlow | null;
|
|
102
|
+
/** Retrieves the originating UID for account upgrading/linking flows. */
|
|
103
|
+
getUid(): string | null;
|
|
104
|
+
/**
|
|
105
|
+
* Clears the persisted context if all fields match the completed context.
|
|
106
|
+
*/
|
|
107
|
+
clearIfMatches(context: EmailLinkContext): void;
|
|
108
|
+
/** Clears all stored email link context from both localStorage and cookies. */
|
|
109
|
+
clear(): void;
|
|
110
|
+
/** Safe getter for `localStorage` that handles SSR or restricted window contexts. */
|
|
111
|
+
private get storage();
|
|
112
|
+
/** Reads a stored value from localStorage with cookie fallback. */
|
|
113
|
+
private get;
|
|
114
|
+
/** Writes a value to both localStorage and a short-lived cookie. */
|
|
115
|
+
private set;
|
|
116
|
+
/** Removes a key from both localStorage and cookies. */
|
|
117
|
+
private remove;
|
|
118
|
+
/** Reads a cookie by key. */
|
|
119
|
+
private getCookie;
|
|
120
|
+
/** Writes a cookie with 30-minute max-age and SameSite=Lax. */
|
|
121
|
+
private setCookie;
|
|
122
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmailLinkContextService, never>;
|
|
123
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<EmailLinkContextService>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
type AuthStatus = 'initializing' | 'signed-out' | 'loading-profile' | 'ready' | 'error';
|
|
127
|
+
interface AuthState {
|
|
128
|
+
afUser: AuthSession | null;
|
|
129
|
+
isLoadingLogin: boolean;
|
|
130
|
+
authStatus: AuthStatus;
|
|
131
|
+
authError: unknown | null;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Shared part of an application's root AuthStore. Call loadAuth() once at startup.
|
|
135
|
+
* The app adds its user selector, navigation, guest dialog and lifecycle providers.
|
|
136
|
+
*/
|
|
137
|
+
declare function withAuthSession(): _ngrx_signals.SignalStoreFeature<_ngrx_signals.EmptyFeatureResult, {
|
|
138
|
+
state: {
|
|
139
|
+
afUser: AuthSession | null;
|
|
140
|
+
isLoadingLogin: boolean;
|
|
141
|
+
authStatus: AuthStatus;
|
|
142
|
+
authError: unknown | null;
|
|
143
|
+
};
|
|
144
|
+
props: {};
|
|
145
|
+
methods: {
|
|
146
|
+
loadAuth: _ngrx_signals_rxjs_interop.RxMethod<void>;
|
|
147
|
+
signInWithGoogle: () => Promise<void>;
|
|
148
|
+
loginAnonymously: () => Promise<void>;
|
|
149
|
+
linkGoogle: () => Promise<void>;
|
|
150
|
+
sendEmailSignInLink: (email: string) => Promise<void>;
|
|
151
|
+
sendEmailLinkForCurrentAccount: () => Promise<void>;
|
|
152
|
+
getStoredEmailForEmailLink: () => string | null;
|
|
153
|
+
completeEmailSignInLink: (url: string, email: string) => Promise<AuthSession>;
|
|
154
|
+
retryProfile: () => Promise<void>;
|
|
155
|
+
whenReady: () => Promise<AuthSession | null>;
|
|
156
|
+
clearSessionState: () => void;
|
|
157
|
+
signOut: () => Promise<void>;
|
|
158
|
+
deleteGuestAccount: () => Promise<void>;
|
|
159
|
+
};
|
|
160
|
+
}>;
|
|
161
|
+
|
|
162
|
+
export { AUTH_ACCESS, AUTH_LIFECYCLE, EmailLinkContextService, PLATFORM_AUTH_OPTIONS, PROFILE_PROVISIONER, providePlatformAuth, withAuthSession };
|
|
163
|
+
export type { AuthAccess, AuthLifecycle, AuthSession, AuthState, AuthStatus, EmailLinkContext, EmailLinkFlow, PlatformAuthOptions, ProfileProvisioner };
|
|
164
|
+
//# sourceMappingURL=tech4good-platform-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tech4good-platform-auth.d.ts","sources":["../../src/auth-access.ts","../../src/config.ts","../../src/email-link-context.ts","../../src/auth-session.ts"],"mappings":";;;;;;AAGA;UACiB,WAAW;;AAE1B;AACA;AACA;;;;;AAKD;AAED;UACiB,UAAU;AACzB,cAAU,UAAU,CAAC,WAAW;AAChC,wBAAoB,OAAO,CAAC,WAAW;AACvC,yBAAqB,OAAO,CAAC,WAAW;AACxC,kBAAc,OAAO,CAAC,WAAW;wCACG,OAAO;AAC3C,sCAAkC,OAAO;AACzC;AACA,yDAAqD,OAAO,CAAC,WAAW;AACxE,cAAU,OAAO;AAClB;AACD,cAAa,WAAW,EAAA,cAAA,CAAA,UAAA;AAExB;UACiB,kBAAkB;+BACN,WAAW,GAAG,OAAO;AACjD;AACD,cAAa,mBAAmB,EAAA,cAAA,CAAA,kBAAA;AAEhC;UACiB,aAAa;yBACP,WAAW,GAAG,OAAO;AAC1C,2BAAuB,WAAW;;;;AAIlC,8BAA0B,OAAO;AAClC;AACD,cAAa,cAAc,EAAA,cAAA,CAAA,aAAA;;UC1CV,mBAAmB;;;;;;;AAOnC;AACD,cAAa,qBAAqB,EAAA,cAAA,CAAA,mBAAA;AAGlC,iBAAgB,mBAAmB,WAAU,mBAAwB,GAAG,QAAQ;;ACThF;AACM,KAAM,aAAa;AAEzB;;AAEG;AACG,KAAM,gBAAgB;;;;UAIpB,aAAa;;AAEnB;;AAGF;;;;;;;;;;;;AAYG;AACH,cAGa,uBAAuB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;AAIG;AACH,sBAAkB,gBAAgB;;;;eAavB,aAAa;;;AAUxB;;AAEG;AACH,4BAAwB,gBAAgB;;AAWxC;;;;AAgBA;;AAWA;;AAUA;;AAUA;;AAWA;yCA7GW,uBAAuB;6CAAvB,uBAAuB;AAmHnC;;AC9IK,KAAM,UAAU;UACL,SAAS;AACxB,YAAQ,WAAW;;gBAEP,UAAU;AACtB;AACD;AAKD;;;AAGG;AACH,iBAAgB,eAAe,IAAA,aAAA,CAAA,kBAAA,CAAA,aAAA,CAAA,kBAAA;;AAbrB,gBAAA,WAAW;;oBAEP,UAAU;AACX;;;;;gCA4KqB,OAAO;gCAIP,OAAO;0BAIb,OAAO;AAIM,gDAAS,OAAO;8CAKT,OAAO;AACjB;AACK,iEAAwB,OAAO,CAAC,WAAW;4BAGxD,OAAO;AAOV,yBAAA,OAAO,CAAC,WAAW;;uBAOrB,OAAO;kCACI,OAAO;;AAO1C;;","names":[]}
|