@umituz/react-native-firebase 2.6.2 → 2.6.4
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/package.json +1 -1
- package/src/application/auth/index.ts +2 -34
- package/src/application/auth/use-cases/index.ts +1 -21
- package/src/domains/account-deletion/domain/index.ts +1 -8
- package/src/domains/account-deletion/index.ts +0 -42
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionExecutor.ts +79 -0
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionTypes.ts +0 -1
- package/src/domains/account-deletion/infrastructure/services/account-deletion.service.ts +2 -14
- package/src/domains/auth/index.ts +3 -12
- package/src/domains/auth/infrastructure.ts +11 -0
- package/src/domains/firestore/domain/entities/Collection.ts +0 -2
- package/src/domains/firestore/domain/index.ts +8 -12
- package/src/domains/firestore/domain/value-objects/{QueryOptions.ts.bak → QueryOptions.ts} +20 -68
- package/src/domains/firestore/domain/value-objects/QueryOptionsFactory.ts +95 -0
- package/src/domains/firestore/domain/value-objects/QueryOptionsHelpers.ts +110 -0
- package/src/domains/firestore/domain/value-objects/WhereClause.ts +115 -0
- package/src/domains/firestore/domain/value-objects/WhereClauseFactory.ts +101 -0
- package/src/domains/firestore/domain/value-objects/WhereClauseHelpers.ts +123 -0
- package/src/domains/firestore/domain/value-objects/WhereClauseValidation.ts +83 -0
- package/src/domains/firestore/presentation/hooks/useFirestoreMutation.ts +1 -1
- package/src/domains/firestore/presentation/hooks/useFirestoreQuery.ts +1 -1
- package/src/shared/infrastructure/config/base/ServiceClientSingleton.ts +29 -0
- package/src/application/auth/ports/AuthPort.ts.bak +0 -164
- package/src/application/auth/ports/AuthPort_part_aa +0 -150
- package/src/application/auth/ports/AuthPort_part_ab +0 -14
- package/src/application/auth/use-cases/SignInUseCase.ts.bak +0 -253
- package/src/application/auth/use-cases/SignInUseCaseHelpers.ts +0 -0
- package/src/application/auth/use-cases/SignInUseCaseMain.ts +0 -0
- package/src/application/auth/use-cases/SignInUseCase_part_aa +0 -150
- package/src/application/auth/use-cases/SignInUseCase_part_ab +0 -103
- package/src/application/auth/use-cases/SignOutUseCase.ts.bak +0 -288
- package/src/application/auth/use-cases/SignOutUseCaseCleanup.ts +0 -0
- package/src/application/auth/use-cases/SignOutUseCaseMain.ts +0 -0
- package/src/application/auth/use-cases/SignOutUseCase_part_aa +0 -150
- package/src/application/auth/use-cases/SignOutUseCase_part_ab +0 -138
- package/src/domains/account-deletion/domain/services/UserValidationHelpers.ts.bak +0 -181
- package/src/domains/account-deletion/domain/services/UserValidationHelpers_part_aa +0 -150
- package/src/domains/account-deletion/domain/services/UserValidationHelpers_part_ab +0 -31
- package/src/domains/account-deletion/domain/services/UserValidationService.ts.bak +0 -286
- package/src/domains/account-deletion/domain/services/UserValidationService_part_aa +0 -150
- package/src/domains/account-deletion/domain/services/UserValidationService_part_ab +0 -136
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionExecutor.ts.bak +0 -230
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionExecutor_part_aa +0 -150
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionExecutor_part_ab +0 -80
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionReauthHandler.ts.bak +0 -174
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionReauthHandler_part_aa +0 -150
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionReauthHandler_part_ab +0 -24
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionRepository.ts.bak +0 -266
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionRepository_part_aa +0 -150
- package/src/domains/account-deletion/infrastructure/services/AccountDeletionRepository_part_ab +0 -116
- package/src/domains/account-deletion/infrastructure/services/reauthentication.service.ts.bak +0 -160
- package/src/domains/account-deletion/infrastructure/services/reauthentication.service_part_aa +0 -150
- package/src/domains/account-deletion/infrastructure/services/reauthentication.service_part_ab +0 -10
- package/src/domains/auth/infrastructure.ts.bak +0 -156
- package/src/domains/auth/infrastructure_part_aa +0 -150
- package/src/domains/auth/infrastructure_part_ab +0 -6
- package/src/domains/auth/presentation/hooks/GoogleOAuthHelpers.ts +0 -0
- package/src/domains/auth/presentation/hooks/GoogleOAuthHookService.ts.bak +0 -247
- package/src/domains/auth/presentation/hooks/GoogleOAuthHookService_part_aa +0 -150
- package/src/domains/auth/presentation/hooks/GoogleOAuthHookService_part_ab +0 -97
- package/src/domains/auth/presentation/hooks/GoogleOAuthService.ts +0 -0
- package/src/domains/firestore/domain/entities/Collection.ts.bak +0 -288
- package/src/domains/firestore/domain/entities/Collection_part_aa +0 -150
- package/src/domains/firestore/domain/entities/Collection_part_ab +0 -138
- package/src/domains/firestore/domain/entities/Document.ts.bak +0 -233
- package/src/domains/firestore/domain/entities/DocumentHelpers.ts +0 -0
- package/src/domains/firestore/domain/entities/DocumentMain.ts +0 -0
- package/src/domains/firestore/domain/entities/Document_part_aa +0 -150
- package/src/domains/firestore/domain/entities/Document_part_ab +0 -83
- package/src/domains/firestore/domain/services/QueryService.ts.bak +0 -182
- package/src/domains/firestore/domain/services/QueryServiceAnalysis.ts.bak +0 -169
- package/src/domains/firestore/domain/services/QueryServiceAnalysis_part_aa +0 -150
- package/src/domains/firestore/domain/services/QueryServiceAnalysis_part_ab +0 -19
- package/src/domains/firestore/domain/services/QueryServiceHelpers.ts.bak +0 -151
- package/src/domains/firestore/domain/services/QueryServiceHelpers_part_aa +0 -150
- package/src/domains/firestore/domain/services/QueryServiceHelpers_part_ab +0 -1
- package/src/domains/firestore/domain/services/QueryService_part_aa +0 -150
- package/src/domains/firestore/domain/services/QueryService_part_ab +0 -32
- package/src/domains/firestore/domain/value-objects/QueryOptionsSerialization.ts.bak +0 -207
- package/src/domains/firestore/domain/value-objects/QueryOptionsSerialization_part_aa +0 -150
- package/src/domains/firestore/domain/value-objects/QueryOptionsSerialization_part_ab +0 -57
- package/src/domains/firestore/domain/value-objects/QueryOptionsValidation.ts.bak +0 -182
- package/src/domains/firestore/domain/value-objects/QueryOptionsValidation_part_aa +0 -150
- package/src/domains/firestore/domain/value-objects/QueryOptionsValidation_part_ab +0 -32
- package/src/domains/firestore/domain/value-objects/QueryOptions_part_aa +0 -150
- package/src/domains/firestore/domain/value-objects/QueryOptions_part_ab +0 -41
- package/src/domains/firestore/domain/value-objects/WhereClause.ts.bak +0 -299
- package/src/domains/firestore/domain/value-objects/WhereClauseFactory.ts.bak +0 -207
- package/src/domains/firestore/domain/value-objects/WhereClauseFactory_part_aa +0 -150
- package/src/domains/firestore/domain/value-objects/WhereClauseFactory_part_ab +0 -57
- package/src/domains/firestore/domain/value-objects/WhereClause_part_aa +0 -150
- package/src/domains/firestore/domain/value-objects/WhereClause_part_ab +0 -149
- package/src/shared/infrastructure/base/ErrorHandler.ts.bak +0 -189
- package/src/shared/infrastructure/base/ErrorHandler_part_aa +0 -150
- package/src/shared/infrastructure/base/ErrorHandler_part_ab +0 -39
- package/src/shared/infrastructure/base/ServiceBase.ts.bak +0 -220
- package/src/shared/infrastructure/base/ServiceBase_part_aa +0 -150
- package/src/shared/infrastructure/base/ServiceBase_part_ab +0 -70
- package/src/shared/infrastructure/config/base/ServiceClientSingleton.ts.bak +0 -155
- package/src/shared/infrastructure/config/base/ServiceClientSingleton_part_aa +0 -150
- package/src/shared/infrastructure/config/base/ServiceClientSingleton_part_ab +0 -5
package/src/domains/account-deletion/infrastructure/services/reauthentication.service.ts.bak
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reauthentication Service
|
|
3
|
-
* Handles Firebase Auth reauthentication for sensitive operations
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
reauthenticateWithCredential,
|
|
8
|
-
GoogleAuthProvider,
|
|
9
|
-
OAuthProvider,
|
|
10
|
-
EmailAuthProvider,
|
|
11
|
-
type User,
|
|
12
|
-
} from "firebase/auth";
|
|
13
|
-
import { Platform } from "react-native";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Lazy-loads expo-apple-authentication (optional peer dependency).
|
|
17
|
-
* Returns null if the package is not installed.
|
|
18
|
-
*/
|
|
19
|
-
function getAppleAuthModule(): typeof import("expo-apple-authentication") | null {
|
|
20
|
-
try {
|
|
21
|
-
// Dynamic require needed for optional peer dependency
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
23
|
-
return require("expo-apple-authentication");
|
|
24
|
-
} catch {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
import { generateNonce, hashNonce } from "../../../auth/infrastructure/services/crypto.util";
|
|
29
|
-
import { executeOperation, failureResultFrom, toErrorInfo, ERROR_MESSAGES } from "../../../../shared/domain/utils";
|
|
30
|
-
import { isCancelledError } from "../../../../shared/domain/utils/error-handlers/error-checkers";
|
|
31
|
-
import type {
|
|
32
|
-
ReauthenticationResult,
|
|
33
|
-
AuthProviderType,
|
|
34
|
-
ReauthCredentialResult
|
|
35
|
-
} from "../../application/ports/reauthentication.types";
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Validates email format
|
|
39
|
-
*/
|
|
40
|
-
function isValidEmail(email: string): boolean {
|
|
41
|
-
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
42
|
-
return emailRegex.test(email);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Validates password (Firebase minimum is 6 characters)
|
|
47
|
-
*/
|
|
48
|
-
function isValidPassword(password: string): boolean {
|
|
49
|
-
return password.length >= 6;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function getUserAuthProvider(user: User): AuthProviderType {
|
|
53
|
-
if (user.isAnonymous) return "anonymous";
|
|
54
|
-
const data = user.providerData;
|
|
55
|
-
if (!data?.length) return "unknown";
|
|
56
|
-
if (data.find(p => p.providerId === "google.com")) return "google.com";
|
|
57
|
-
if (data.find(p => p.providerId === "apple.com")) return "apple.com";
|
|
58
|
-
if (data.find(p => p.providerId === "password")) return "password";
|
|
59
|
-
return "unknown";
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export async function reauthenticateWithGoogle(user: User, idToken: string): Promise<ReauthenticationResult> {
|
|
63
|
-
return executeOperation(async () => {
|
|
64
|
-
await reauthenticateWithCredential(user, GoogleAuthProvider.credential(idToken));
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export async function reauthenticateWithPassword(user: User, pass: string): Promise<ReauthenticationResult> {
|
|
69
|
-
const email = user.email;
|
|
70
|
-
if (!email) {
|
|
71
|
-
return failureResultFrom("auth/no-email", ERROR_MESSAGES.AUTH.NO_USER);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// FIX: Add email validation
|
|
75
|
-
if (!isValidEmail(email)) {
|
|
76
|
-
return failureResultFrom("auth/invalid-email", ERROR_MESSAGES.AUTH.INVALID_EMAIL);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// FIX: Add password validation
|
|
80
|
-
if (!isValidPassword(pass)) {
|
|
81
|
-
return failureResultFrom("auth/invalid-password", ERROR_MESSAGES.AUTH.INVALID_PASSWORD);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return executeOperation(async () => {
|
|
85
|
-
await reauthenticateWithCredential(user, EmailAuthProvider.credential(email, pass));
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export async function getAppleReauthCredential(): Promise<ReauthCredentialResult> {
|
|
90
|
-
if (Platform.OS !== "ios") {
|
|
91
|
-
return {
|
|
92
|
-
success: false,
|
|
93
|
-
error: { code: "auth/ios-only", message: "iOS only" }
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const AppleAuthentication = getAppleAuthModule();
|
|
98
|
-
if (!AppleAuthentication) {
|
|
99
|
-
return {
|
|
100
|
-
success: false,
|
|
101
|
-
error: { code: "auth/unavailable", message: "expo-apple-authentication is not installed" }
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
try {
|
|
106
|
-
const isAvailable = await AppleAuthentication.isAvailableAsync();
|
|
107
|
-
if (!isAvailable) {
|
|
108
|
-
return {
|
|
109
|
-
success: false,
|
|
110
|
-
error: { code: "auth/unavailable", message: "Unavailable" }
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const nonce = await generateNonce();
|
|
115
|
-
const hashed = await hashNonce(nonce);
|
|
116
|
-
const apple = await AppleAuthentication.signInAsync({
|
|
117
|
-
requestedScopes: [
|
|
118
|
-
AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
|
|
119
|
-
AppleAuthentication.AppleAuthenticationScope.EMAIL
|
|
120
|
-
],
|
|
121
|
-
nonce: hashed,
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
if (!apple.identityToken) {
|
|
125
|
-
return {
|
|
126
|
-
success: false,
|
|
127
|
-
error: { code: "auth/no-token", message: "No token" }
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const credential = new OAuthProvider("apple.com").credential({
|
|
132
|
-
idToken: apple.identityToken,
|
|
133
|
-
rawNonce: nonce
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
return {
|
|
137
|
-
success: true,
|
|
138
|
-
credential
|
|
139
|
-
};
|
|
140
|
-
} catch (error: unknown) {
|
|
141
|
-
const errorInfo = toErrorInfo(error, 'auth/failed');
|
|
142
|
-
const code = isCancelledError(errorInfo) ? "auth/cancelled" : errorInfo.code;
|
|
143
|
-
return {
|
|
144
|
-
success: false,
|
|
145
|
-
error: { code, message: errorInfo.message }
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export async function reauthenticateWithApple(user: User): Promise<ReauthenticationResult> {
|
|
151
|
-
const res = await getAppleReauthCredential();
|
|
152
|
-
if (!res.success || !res.credential) {
|
|
153
|
-
return { success: false, error: res.error ?? { code: "auth/failed", message: "Failed to get credential" } };
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const credential = res.credential;
|
|
157
|
-
return executeOperation(async () => {
|
|
158
|
-
await reauthenticateWithCredential(user, credential);
|
|
159
|
-
});
|
|
160
|
-
}
|
package/src/domains/account-deletion/infrastructure/services/reauthentication.service_part_aa
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reauthentication Service
|
|
3
|
-
* Handles Firebase Auth reauthentication for sensitive operations
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
reauthenticateWithCredential,
|
|
8
|
-
GoogleAuthProvider,
|
|
9
|
-
OAuthProvider,
|
|
10
|
-
EmailAuthProvider,
|
|
11
|
-
type User,
|
|
12
|
-
} from "firebase/auth";
|
|
13
|
-
import { Platform } from "react-native";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Lazy-loads expo-apple-authentication (optional peer dependency).
|
|
17
|
-
* Returns null if the package is not installed.
|
|
18
|
-
*/
|
|
19
|
-
function getAppleAuthModule(): typeof import("expo-apple-authentication") | null {
|
|
20
|
-
try {
|
|
21
|
-
// Dynamic require needed for optional peer dependency
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
23
|
-
return require("expo-apple-authentication");
|
|
24
|
-
} catch {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
import { generateNonce, hashNonce } from "../../../auth/infrastructure/services/crypto.util";
|
|
29
|
-
import { executeOperation, failureResultFrom, toErrorInfo, ERROR_MESSAGES } from "../../../../shared/domain/utils";
|
|
30
|
-
import { isCancelledError } from "../../../../shared/domain/utils/error-handlers/error-checkers";
|
|
31
|
-
import type {
|
|
32
|
-
ReauthenticationResult,
|
|
33
|
-
AuthProviderType,
|
|
34
|
-
ReauthCredentialResult
|
|
35
|
-
} from "../../application/ports/reauthentication.types";
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Validates email format
|
|
39
|
-
*/
|
|
40
|
-
function isValidEmail(email: string): boolean {
|
|
41
|
-
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
42
|
-
return emailRegex.test(email);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Validates password (Firebase minimum is 6 characters)
|
|
47
|
-
*/
|
|
48
|
-
function isValidPassword(password: string): boolean {
|
|
49
|
-
return password.length >= 6;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function getUserAuthProvider(user: User): AuthProviderType {
|
|
53
|
-
if (user.isAnonymous) return "anonymous";
|
|
54
|
-
const data = user.providerData;
|
|
55
|
-
if (!data?.length) return "unknown";
|
|
56
|
-
if (data.find(p => p.providerId === "google.com")) return "google.com";
|
|
57
|
-
if (data.find(p => p.providerId === "apple.com")) return "apple.com";
|
|
58
|
-
if (data.find(p => p.providerId === "password")) return "password";
|
|
59
|
-
return "unknown";
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export async function reauthenticateWithGoogle(user: User, idToken: string): Promise<ReauthenticationResult> {
|
|
63
|
-
return executeOperation(async () => {
|
|
64
|
-
await reauthenticateWithCredential(user, GoogleAuthProvider.credential(idToken));
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export async function reauthenticateWithPassword(user: User, pass: string): Promise<ReauthenticationResult> {
|
|
69
|
-
const email = user.email;
|
|
70
|
-
if (!email) {
|
|
71
|
-
return failureResultFrom("auth/no-email", ERROR_MESSAGES.AUTH.NO_USER);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// FIX: Add email validation
|
|
75
|
-
if (!isValidEmail(email)) {
|
|
76
|
-
return failureResultFrom("auth/invalid-email", ERROR_MESSAGES.AUTH.INVALID_EMAIL);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// FIX: Add password validation
|
|
80
|
-
if (!isValidPassword(pass)) {
|
|
81
|
-
return failureResultFrom("auth/invalid-password", ERROR_MESSAGES.AUTH.INVALID_PASSWORD);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return executeOperation(async () => {
|
|
85
|
-
await reauthenticateWithCredential(user, EmailAuthProvider.credential(email, pass));
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export async function getAppleReauthCredential(): Promise<ReauthCredentialResult> {
|
|
90
|
-
if (Platform.OS !== "ios") {
|
|
91
|
-
return {
|
|
92
|
-
success: false,
|
|
93
|
-
error: { code: "auth/ios-only", message: "iOS only" }
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const AppleAuthentication = getAppleAuthModule();
|
|
98
|
-
if (!AppleAuthentication) {
|
|
99
|
-
return {
|
|
100
|
-
success: false,
|
|
101
|
-
error: { code: "auth/unavailable", message: "expo-apple-authentication is not installed" }
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
try {
|
|
106
|
-
const isAvailable = await AppleAuthentication.isAvailableAsync();
|
|
107
|
-
if (!isAvailable) {
|
|
108
|
-
return {
|
|
109
|
-
success: false,
|
|
110
|
-
error: { code: "auth/unavailable", message: "Unavailable" }
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const nonce = await generateNonce();
|
|
115
|
-
const hashed = await hashNonce(nonce);
|
|
116
|
-
const apple = await AppleAuthentication.signInAsync({
|
|
117
|
-
requestedScopes: [
|
|
118
|
-
AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
|
|
119
|
-
AppleAuthentication.AppleAuthenticationScope.EMAIL
|
|
120
|
-
],
|
|
121
|
-
nonce: hashed,
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
if (!apple.identityToken) {
|
|
125
|
-
return {
|
|
126
|
-
success: false,
|
|
127
|
-
error: { code: "auth/no-token", message: "No token" }
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const credential = new OAuthProvider("apple.com").credential({
|
|
132
|
-
idToken: apple.identityToken,
|
|
133
|
-
rawNonce: nonce
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
return {
|
|
137
|
-
success: true,
|
|
138
|
-
credential
|
|
139
|
-
};
|
|
140
|
-
} catch (error: unknown) {
|
|
141
|
-
const errorInfo = toErrorInfo(error, 'auth/failed');
|
|
142
|
-
const code = isCancelledError(errorInfo) ? "auth/cancelled" : errorInfo.code;
|
|
143
|
-
return {
|
|
144
|
-
success: false,
|
|
145
|
-
error: { code, message: errorInfo.message }
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export async function reauthenticateWithApple(user: User): Promise<ReauthenticationResult> {
|
package/src/domains/account-deletion/infrastructure/services/reauthentication.service_part_ab
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const res = await getAppleReauthCredential();
|
|
2
|
-
if (!res.success || !res.credential) {
|
|
3
|
-
return { success: false, error: res.error ?? { code: "auth/failed", message: "Failed to get credential" } };
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const credential = res.credential;
|
|
7
|
-
return executeOperation(async () => {
|
|
8
|
-
await reauthenticateWithCredential(user, credential);
|
|
9
|
-
});
|
|
10
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Firebase Auth Infrastructure Layer
|
|
3
|
-
* Domain-Driven Design (DDD) - Infrastructure Exports
|
|
4
|
-
*
|
|
5
|
-
* Infrastructure implementation including:
|
|
6
|
-
* - Firebase Auth client configuration
|
|
7
|
-
* - Auth utilities and services
|
|
8
|
-
* - Social auth providers
|
|
9
|
-
* - Email/password authentication
|
|
10
|
-
* - User document management
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
// =============================================================================
|
|
14
|
-
// Firebase Auth Client
|
|
15
|
-
// =============================================================================
|
|
16
|
-
|
|
17
|
-
export {
|
|
18
|
-
getFirebaseAuth,
|
|
19
|
-
isFirebaseAuthInitialized,
|
|
20
|
-
getFirebaseAuthInitializationError,
|
|
21
|
-
resetFirebaseAuthClient,
|
|
22
|
-
firebaseAuthClient,
|
|
23
|
-
initializeFirebaseAuth,
|
|
24
|
-
} from './infrastructure/config/FirebaseAuthClient';
|
|
25
|
-
|
|
26
|
-
export type {
|
|
27
|
-
Auth,
|
|
28
|
-
} from './infrastructure/config/FirebaseAuthClient';
|
|
29
|
-
|
|
30
|
-
// =============================================================================
|
|
31
|
-
// Auth Utilities
|
|
32
|
-
// =============================================================================
|
|
33
|
-
|
|
34
|
-
export {
|
|
35
|
-
checkAuthState,
|
|
36
|
-
isAuthenticated,
|
|
37
|
-
isAnonymous,
|
|
38
|
-
getCurrentUserId,
|
|
39
|
-
getCurrentUser,
|
|
40
|
-
getCurrentUserIdFromGlobal,
|
|
41
|
-
getCurrentUserFromGlobal,
|
|
42
|
-
isCurrentUserAuthenticated,
|
|
43
|
-
isCurrentUserAnonymous,
|
|
44
|
-
verifyUserId,
|
|
45
|
-
isValidUser,
|
|
46
|
-
} from './infrastructure/services/auth-utils.service';
|
|
47
|
-
|
|
48
|
-
export type {
|
|
49
|
-
AuthCheckResult,
|
|
50
|
-
} from './infrastructure/services/auth-utils.service';
|
|
51
|
-
|
|
52
|
-
// =============================================================================
|
|
53
|
-
// Anonymous Auth Service
|
|
54
|
-
// =============================================================================
|
|
55
|
-
|
|
56
|
-
export {
|
|
57
|
-
AnonymousAuthService,
|
|
58
|
-
anonymousAuthService,
|
|
59
|
-
} from './infrastructure/services/anonymous-auth.service';
|
|
60
|
-
|
|
61
|
-
export type {
|
|
62
|
-
AnonymousAuthResult,
|
|
63
|
-
AnonymousAuthServiceInterface,
|
|
64
|
-
} from './infrastructure/services/anonymous-auth.service';
|
|
65
|
-
|
|
66
|
-
// =============================================================================
|
|
67
|
-
// Firestore Utilities
|
|
68
|
-
// =============================================================================
|
|
69
|
-
|
|
70
|
-
export {
|
|
71
|
-
shouldSkipFirestoreQuery,
|
|
72
|
-
createFirestoreQueryOptions,
|
|
73
|
-
} from './infrastructure/services/firestore-utils.service';
|
|
74
|
-
|
|
75
|
-
export type {
|
|
76
|
-
FirestoreQueryOptions,
|
|
77
|
-
FirestoreQueryResult,
|
|
78
|
-
FirestoreQuerySkipReason,
|
|
79
|
-
} from './infrastructure/services/firestore-utils.service';
|
|
80
|
-
|
|
81
|
-
// =============================================================================
|
|
82
|
-
// Social Auth Services
|
|
83
|
-
// =============================================================================
|
|
84
|
-
|
|
85
|
-
export {
|
|
86
|
-
GoogleAuthService,
|
|
87
|
-
googleAuthService,
|
|
88
|
-
} from './infrastructure/services/google-auth.service';
|
|
89
|
-
export type {
|
|
90
|
-
GoogleAuthConfig,
|
|
91
|
-
GoogleAuthResult,
|
|
92
|
-
} from './infrastructure/services/google-auth.types';
|
|
93
|
-
|
|
94
|
-
export {
|
|
95
|
-
GoogleOAuthService,
|
|
96
|
-
googleOAuthService,
|
|
97
|
-
} from './infrastructure/services/google-oauth.service';
|
|
98
|
-
export type {
|
|
99
|
-
GoogleOAuthConfig,
|
|
100
|
-
} from './infrastructure/services/google-oauth.service';
|
|
101
|
-
|
|
102
|
-
export {
|
|
103
|
-
AppleAuthService,
|
|
104
|
-
appleAuthService,
|
|
105
|
-
} from './infrastructure/services/apple-auth.service';
|
|
106
|
-
export type { AppleAuthResult } from './infrastructure/services/apple-auth.types';
|
|
107
|
-
|
|
108
|
-
// =============================================================================
|
|
109
|
-
// Email/Password Authentication
|
|
110
|
-
// =============================================================================
|
|
111
|
-
|
|
112
|
-
export {
|
|
113
|
-
signInWithEmail,
|
|
114
|
-
signUpWithEmail,
|
|
115
|
-
signOut,
|
|
116
|
-
linkAnonymousWithEmail,
|
|
117
|
-
} from './infrastructure/services/email-auth.service';
|
|
118
|
-
export type {
|
|
119
|
-
EmailCredentials,
|
|
120
|
-
EmailAuthResult,
|
|
121
|
-
} from './infrastructure/services/email-auth.service';
|
|
122
|
-
|
|
123
|
-
// =============================================================================
|
|
124
|
-
// Password Management
|
|
125
|
-
// =============================================================================
|
|
126
|
-
|
|
127
|
-
export {
|
|
128
|
-
updateUserPassword,
|
|
129
|
-
} from './infrastructure/services/password.service';
|
|
130
|
-
|
|
131
|
-
// =============================================================================
|
|
132
|
-
// Auth Listener
|
|
133
|
-
// =============================================================================
|
|
134
|
-
|
|
135
|
-
export {
|
|
136
|
-
setupAuthListener,
|
|
137
|
-
} from './infrastructure/services/auth-listener.service';
|
|
138
|
-
export type {
|
|
139
|
-
AuthListenerConfig,
|
|
140
|
-
AuthListenerResult,
|
|
141
|
-
} from './infrastructure/services/auth-listener.service';
|
|
142
|
-
|
|
143
|
-
// =============================================================================
|
|
144
|
-
// User Document Service
|
|
145
|
-
// =============================================================================
|
|
146
|
-
|
|
147
|
-
export {
|
|
148
|
-
ensureUserDocument,
|
|
149
|
-
markUserDeleted,
|
|
150
|
-
configureUserDocumentService,
|
|
151
|
-
} from './infrastructure/services/user-document.service';
|
|
152
|
-
export type {
|
|
153
|
-
UserDocumentUser,
|
|
154
|
-
UserDocumentConfig,
|
|
155
|
-
UserDocumentExtras,
|
|
156
|
-
} from './infrastructure/services/user-document.types';
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Firebase Auth Infrastructure Layer
|
|
3
|
-
* Domain-Driven Design (DDD) - Infrastructure Exports
|
|
4
|
-
*
|
|
5
|
-
* Infrastructure implementation including:
|
|
6
|
-
* - Firebase Auth client configuration
|
|
7
|
-
* - Auth utilities and services
|
|
8
|
-
* - Social auth providers
|
|
9
|
-
* - Email/password authentication
|
|
10
|
-
* - User document management
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
// =============================================================================
|
|
14
|
-
// Firebase Auth Client
|
|
15
|
-
// =============================================================================
|
|
16
|
-
|
|
17
|
-
export {
|
|
18
|
-
getFirebaseAuth,
|
|
19
|
-
isFirebaseAuthInitialized,
|
|
20
|
-
getFirebaseAuthInitializationError,
|
|
21
|
-
resetFirebaseAuthClient,
|
|
22
|
-
firebaseAuthClient,
|
|
23
|
-
initializeFirebaseAuth,
|
|
24
|
-
} from './infrastructure/config/FirebaseAuthClient';
|
|
25
|
-
|
|
26
|
-
export type {
|
|
27
|
-
Auth,
|
|
28
|
-
} from './infrastructure/config/FirebaseAuthClient';
|
|
29
|
-
|
|
30
|
-
// =============================================================================
|
|
31
|
-
// Auth Utilities
|
|
32
|
-
// =============================================================================
|
|
33
|
-
|
|
34
|
-
export {
|
|
35
|
-
checkAuthState,
|
|
36
|
-
isAuthenticated,
|
|
37
|
-
isAnonymous,
|
|
38
|
-
getCurrentUserId,
|
|
39
|
-
getCurrentUser,
|
|
40
|
-
getCurrentUserIdFromGlobal,
|
|
41
|
-
getCurrentUserFromGlobal,
|
|
42
|
-
isCurrentUserAuthenticated,
|
|
43
|
-
isCurrentUserAnonymous,
|
|
44
|
-
verifyUserId,
|
|
45
|
-
isValidUser,
|
|
46
|
-
} from './infrastructure/services/auth-utils.service';
|
|
47
|
-
|
|
48
|
-
export type {
|
|
49
|
-
AuthCheckResult,
|
|
50
|
-
} from './infrastructure/services/auth-utils.service';
|
|
51
|
-
|
|
52
|
-
// =============================================================================
|
|
53
|
-
// Anonymous Auth Service
|
|
54
|
-
// =============================================================================
|
|
55
|
-
|
|
56
|
-
export {
|
|
57
|
-
AnonymousAuthService,
|
|
58
|
-
anonymousAuthService,
|
|
59
|
-
} from './infrastructure/services/anonymous-auth.service';
|
|
60
|
-
|
|
61
|
-
export type {
|
|
62
|
-
AnonymousAuthResult,
|
|
63
|
-
AnonymousAuthServiceInterface,
|
|
64
|
-
} from './infrastructure/services/anonymous-auth.service';
|
|
65
|
-
|
|
66
|
-
// =============================================================================
|
|
67
|
-
// Firestore Utilities
|
|
68
|
-
// =============================================================================
|
|
69
|
-
|
|
70
|
-
export {
|
|
71
|
-
shouldSkipFirestoreQuery,
|
|
72
|
-
createFirestoreQueryOptions,
|
|
73
|
-
} from './infrastructure/services/firestore-utils.service';
|
|
74
|
-
|
|
75
|
-
export type {
|
|
76
|
-
FirestoreQueryOptions,
|
|
77
|
-
FirestoreQueryResult,
|
|
78
|
-
FirestoreQuerySkipReason,
|
|
79
|
-
} from './infrastructure/services/firestore-utils.service';
|
|
80
|
-
|
|
81
|
-
// =============================================================================
|
|
82
|
-
// Social Auth Services
|
|
83
|
-
// =============================================================================
|
|
84
|
-
|
|
85
|
-
export {
|
|
86
|
-
GoogleAuthService,
|
|
87
|
-
googleAuthService,
|
|
88
|
-
} from './infrastructure/services/google-auth.service';
|
|
89
|
-
export type {
|
|
90
|
-
GoogleAuthConfig,
|
|
91
|
-
GoogleAuthResult,
|
|
92
|
-
} from './infrastructure/services/google-auth.types';
|
|
93
|
-
|
|
94
|
-
export {
|
|
95
|
-
GoogleOAuthService,
|
|
96
|
-
googleOAuthService,
|
|
97
|
-
} from './infrastructure/services/google-oauth.service';
|
|
98
|
-
export type {
|
|
99
|
-
GoogleOAuthConfig,
|
|
100
|
-
} from './infrastructure/services/google-oauth.service';
|
|
101
|
-
|
|
102
|
-
export {
|
|
103
|
-
AppleAuthService,
|
|
104
|
-
appleAuthService,
|
|
105
|
-
} from './infrastructure/services/apple-auth.service';
|
|
106
|
-
export type { AppleAuthResult } from './infrastructure/services/apple-auth.types';
|
|
107
|
-
|
|
108
|
-
// =============================================================================
|
|
109
|
-
// Email/Password Authentication
|
|
110
|
-
// =============================================================================
|
|
111
|
-
|
|
112
|
-
export {
|
|
113
|
-
signInWithEmail,
|
|
114
|
-
signUpWithEmail,
|
|
115
|
-
signOut,
|
|
116
|
-
linkAnonymousWithEmail,
|
|
117
|
-
} from './infrastructure/services/email-auth.service';
|
|
118
|
-
export type {
|
|
119
|
-
EmailCredentials,
|
|
120
|
-
EmailAuthResult,
|
|
121
|
-
} from './infrastructure/services/email-auth.service';
|
|
122
|
-
|
|
123
|
-
// =============================================================================
|
|
124
|
-
// Password Management
|
|
125
|
-
// =============================================================================
|
|
126
|
-
|
|
127
|
-
export {
|
|
128
|
-
updateUserPassword,
|
|
129
|
-
} from './infrastructure/services/password.service';
|
|
130
|
-
|
|
131
|
-
// =============================================================================
|
|
132
|
-
// Auth Listener
|
|
133
|
-
// =============================================================================
|
|
134
|
-
|
|
135
|
-
export {
|
|
136
|
-
setupAuthListener,
|
|
137
|
-
} from './infrastructure/services/auth-listener.service';
|
|
138
|
-
export type {
|
|
139
|
-
AuthListenerConfig,
|
|
140
|
-
AuthListenerResult,
|
|
141
|
-
} from './infrastructure/services/auth-listener.service';
|
|
142
|
-
|
|
143
|
-
// =============================================================================
|
|
144
|
-
// User Document Service
|
|
145
|
-
// =============================================================================
|
|
146
|
-
|
|
147
|
-
export {
|
|
148
|
-
ensureUserDocument,
|
|
149
|
-
markUserDeleted,
|
|
150
|
-
configureUserDocumentService,
|
|
File without changes
|