capacitor-auth-manager 2.2.0 → 2.3.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/dist/angular.cjs.js +99 -80
- package/dist/angular.cjs.js.map +1 -1
- package/dist/core.cjs.js +99 -80
- package/dist/core.cjs.js.map +1 -1
- package/dist/esm/providers/base-provider.d.ts +11 -0
- package/dist/esm/providers/base-provider.js +30 -3
- package/dist/esm/providers/base-provider.js.map +1 -1
- package/dist/esm/providers/web/biometric-provider.d.ts +6 -7
- package/dist/esm/providers/web/biometric-provider.js +10 -7
- package/dist/esm/providers/web/biometric-provider.js.map +1 -1
- package/dist/esm/providers/web/email-code-provider.d.ts +5 -7
- package/dist/esm/providers/web/email-code-provider.js +10 -11
- package/dist/esm/providers/web/email-code-provider.js.map +1 -1
- package/dist/esm/providers/web/email-password-provider.d.ts +4 -7
- package/dist/esm/providers/web/email-password-provider.js +12 -13
- package/dist/esm/providers/web/email-password-provider.js.map +1 -1
- package/dist/esm/providers/web/magic-link-provider.d.ts +5 -7
- package/dist/esm/providers/web/magic-link-provider.js +12 -13
- package/dist/esm/providers/web/magic-link-provider.js.map +1 -1
- package/dist/esm/providers/web/phone-password-provider.d.ts +5 -8
- package/dist/esm/providers/web/phone-password-provider.js +18 -16
- package/dist/esm/providers/web/phone-password-provider.js.map +1 -1
- package/dist/esm/providers/web/sms-provider.d.ts +5 -7
- package/dist/esm/providers/web/sms-provider.js +11 -13
- package/dist/esm/providers/web/sms-provider.js.map +1 -1
- package/dist/esm/providers/web/username-password-provider.d.ts +4 -7
- package/dist/esm/providers/web/username-password-provider.js +12 -11
- package/dist/esm/providers/web/username-password-provider.js.map +1 -1
- package/dist/plugin.cjs.js +99 -80
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +99 -80
- package/dist/plugin.js.map +1 -1
- package/dist/react.cjs.js +99 -80
- package/dist/react.cjs.js.map +1 -1
- package/dist/vue.cjs.js +99 -80
- package/dist/vue.cjs.js.map +1 -1
- package/package.json +2 -2
package/dist/vue.cjs.js
CHANGED
|
@@ -2124,6 +2124,31 @@ function useAuthConfig() {
|
|
|
2124
2124
|
};
|
|
2125
2125
|
}
|
|
2126
2126
|
|
|
2127
|
+
/**
|
|
2128
|
+
* Normalize a provider constructor argument into a full {@link BaseProviderConfig}.
|
|
2129
|
+
*
|
|
2130
|
+
* The standalone providers are public (exported from `capacitor-auth-manager/providers/web`) and
|
|
2131
|
+
* get constructed two ways: the factory/registry pass a full {@link BaseProviderConfig}, while
|
|
2132
|
+
* tests and direct consumers pass the provider's own bare options object. This helper accepts
|
|
2133
|
+
* either — a bare object is wrapped with an in-memory storage (`AuthPersistence.NONE`, so it never
|
|
2134
|
+
* touches `window` and stays safe under SSR / Node test environments) plus the shared
|
|
2135
|
+
* {@link defaultLogger}. Callers that pass a full config keep their injected storage/logger.
|
|
2136
|
+
*/
|
|
2137
|
+
function resolveProviderConfig(provider, input) {
|
|
2138
|
+
if (typeof input === 'object' &&
|
|
2139
|
+
input !== null &&
|
|
2140
|
+
'storage' in input &&
|
|
2141
|
+
'logger' in input &&
|
|
2142
|
+
'options' in input) {
|
|
2143
|
+
return input;
|
|
2144
|
+
}
|
|
2145
|
+
return {
|
|
2146
|
+
provider,
|
|
2147
|
+
options: (input !== null && input !== void 0 ? input : {}),
|
|
2148
|
+
storage: new WebStorage(AuthPersistence.NONE),
|
|
2149
|
+
logger: defaultLogger,
|
|
2150
|
+
};
|
|
2151
|
+
}
|
|
2127
2152
|
class BaseAuthProvider {
|
|
2128
2153
|
get name() {
|
|
2129
2154
|
return this.provider;
|
|
@@ -2143,13 +2168,13 @@ class BaseAuthProvider {
|
|
|
2143
2168
|
// across every provider (see AuthProviderInterface, where they are optional). Marking them
|
|
2144
2169
|
// abstract previously forced every subclass to re-implement them just to throw.
|
|
2145
2170
|
async linkAccount(_options) {
|
|
2146
|
-
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, `
|
|
2171
|
+
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, `Account linking is not supported by provider ${this.provider}`, this.provider);
|
|
2147
2172
|
}
|
|
2148
2173
|
async unlinkAccount(_options) {
|
|
2149
|
-
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, `
|
|
2174
|
+
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, `Account unlinking is not supported by provider ${this.provider}`, this.provider);
|
|
2150
2175
|
}
|
|
2151
2176
|
async revokeAccess(_token) {
|
|
2152
|
-
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, `
|
|
2177
|
+
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, `Access revocation is not supported by provider ${this.provider}`, this.provider);
|
|
2153
2178
|
}
|
|
2154
2179
|
async getCurrentUser() {
|
|
2155
2180
|
if (!this.isInitialized) {
|
|
@@ -4464,16 +4489,19 @@ class PendingVerificationStore {
|
|
|
4464
4489
|
}
|
|
4465
4490
|
}
|
|
4466
4491
|
|
|
4467
|
-
class MagicLinkProvider {
|
|
4468
|
-
|
|
4469
|
-
|
|
4492
|
+
class MagicLinkProvider extends BaseAuthProvider {
|
|
4493
|
+
get name() {
|
|
4494
|
+
return 'magic-link';
|
|
4495
|
+
}
|
|
4496
|
+
constructor(input) {
|
|
4497
|
+
super(resolveProviderConfig(AuthProvider.EMAIL_MAGIC_LINK, input));
|
|
4470
4498
|
// Persisted (SSR-guarded localStorage) so a magic link clicked from an email — which opens a
|
|
4471
4499
|
// FRESH page load with empty in-memory state — can still find its pending entry to verify
|
|
4472
4500
|
// against. Keyed by the link token (already present in the callback URL); we store only the
|
|
4473
4501
|
// email + expiry, never any additional secret (see PendingVerificationStore + F-11).
|
|
4474
4502
|
this.pendingVerification = new PendingVerificationStore('magic-link');
|
|
4475
|
-
//
|
|
4476
|
-
this.config =
|
|
4503
|
+
// Magic link uses its config as-is (no defaults to merge).
|
|
4504
|
+
this.config = this.options;
|
|
4477
4505
|
// Check for magic link callback on initialization
|
|
4478
4506
|
this.checkForMagicLinkCallback();
|
|
4479
4507
|
}
|
|
@@ -4723,14 +4751,9 @@ class MagicLinkProvider {
|
|
|
4723
4751
|
// Magic link auth is supported if we have the required config
|
|
4724
4752
|
return !!this.config.sendLinkUrl;
|
|
4725
4753
|
}
|
|
4726
|
-
|
|
4727
|
-
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, 'Account linking is not supported for magic link authentication');
|
|
4728
|
-
}
|
|
4729
|
-
async unlinkAccount(_options) {
|
|
4730
|
-
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, 'Account unlinking is not supported for magic link authentication');
|
|
4731
|
-
}
|
|
4754
|
+
// linkAccount + unlinkAccount inherit BaseAuthProvider's OPERATION_NOT_ALLOWED defaults (F-44).
|
|
4732
4755
|
async revokeAccess(_token) {
|
|
4733
|
-
// Magic link doesn't have persistent access to revoke
|
|
4756
|
+
// Magic link doesn't have persistent access to revoke; clear any pending verification.
|
|
4734
4757
|
this.pendingVerification.clear();
|
|
4735
4758
|
}
|
|
4736
4759
|
}
|
|
@@ -4740,16 +4763,18 @@ var magicLinkProvider = /*#__PURE__*/Object.freeze({
|
|
|
4740
4763
|
MagicLinkProvider: MagicLinkProvider
|
|
4741
4764
|
});
|
|
4742
4765
|
|
|
4743
|
-
class SMSProvider {
|
|
4744
|
-
|
|
4745
|
-
|
|
4766
|
+
class SMSProvider extends BaseAuthProvider {
|
|
4767
|
+
get name() {
|
|
4768
|
+
return 'sms';
|
|
4769
|
+
}
|
|
4770
|
+
constructor(input) {
|
|
4771
|
+
super(resolveProviderConfig(AuthProvider.SMS, input));
|
|
4746
4772
|
// Pending verifications are persisted (SSR-guarded localStorage) so they survive a reload /
|
|
4747
4773
|
// page change between sending and verifying the code. Only non-secret metadata is stored —
|
|
4748
4774
|
// never the SMS code itself (see PendingVerificationStore + F-11).
|
|
4749
4775
|
this.pendingVerifications = new PendingVerificationStore('sms');
|
|
4750
4776
|
this.MAX_ATTEMPTS = 3;
|
|
4751
|
-
|
|
4752
|
-
this.config = Object.assign({ countryCode: '+1', codeLength: 6, resendDelay: 60000 }, config);
|
|
4777
|
+
this.config = Object.assign({ countryCode: '+1', codeLength: 6, resendDelay: 60000 }, this.options);
|
|
4753
4778
|
}
|
|
4754
4779
|
async signIn(options) {
|
|
4755
4780
|
if (!(options === null || options === void 0 ? void 0 : options.phoneNumber)) {
|
|
@@ -4987,14 +5012,9 @@ class SMSProvider {
|
|
|
4987
5012
|
// SMS auth is supported if we have the required config
|
|
4988
5013
|
return !!(this.config.sendCodeUrl && this.config.verifyCodeUrl);
|
|
4989
5014
|
}
|
|
4990
|
-
|
|
4991
|
-
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, 'Account linking is not supported for SMS authentication');
|
|
4992
|
-
}
|
|
4993
|
-
async unlinkAccount(_options) {
|
|
4994
|
-
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, 'Account unlinking is not supported for SMS authentication');
|
|
4995
|
-
}
|
|
5015
|
+
// linkAccount + unlinkAccount inherit BaseAuthProvider's OPERATION_NOT_ALLOWED defaults (F-44).
|
|
4996
5016
|
async revokeAccess(_token) {
|
|
4997
|
-
// SMS auth doesn't have persistent access to revoke
|
|
5017
|
+
// SMS auth doesn't have persistent access to revoke; clear any pending verification.
|
|
4998
5018
|
this.pendingVerifications.clear();
|
|
4999
5019
|
}
|
|
5000
5020
|
}
|
|
@@ -5004,20 +5024,23 @@ var smsProvider = /*#__PURE__*/Object.freeze({
|
|
|
5004
5024
|
SMSProvider: SMSProvider
|
|
5005
5025
|
});
|
|
5006
5026
|
|
|
5007
|
-
class EmailPasswordProvider {
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5027
|
+
class EmailPasswordProvider extends BaseAuthProvider {
|
|
5028
|
+
get name() {
|
|
5029
|
+
return 'email-password';
|
|
5030
|
+
}
|
|
5031
|
+
constructor(input) {
|
|
5032
|
+
super(resolveProviderConfig(AuthProvider.EMAIL_PASSWORD, input));
|
|
5033
|
+
// currentUser is the inherited (in-memory) field from BaseAuthProvider; assigned directly here
|
|
5034
|
+
// so email/password sessions stay in-memory exactly as before (no new storage persistence).
|
|
5011
5035
|
this.authToken = null;
|
|
5012
5036
|
this.refreshTokenValue = null;
|
|
5013
|
-
// Initialize with config
|
|
5014
5037
|
this.config = Object.assign({ allowSignUp: true, passwordRequirements: {
|
|
5015
5038
|
minLength: 8,
|
|
5016
5039
|
requireUppercase: true,
|
|
5017
5040
|
requireLowercase: true,
|
|
5018
5041
|
requireNumbers: true,
|
|
5019
5042
|
requireSpecialChars: false,
|
|
5020
|
-
} },
|
|
5043
|
+
} }, this.options);
|
|
5021
5044
|
}
|
|
5022
5045
|
async signIn(options) {
|
|
5023
5046
|
if (!(options === null || options === void 0 ? void 0 : options.email) || !(options === null || options === void 0 ? void 0 : options.password)) {
|
|
@@ -5363,12 +5386,7 @@ class EmailPasswordProvider {
|
|
|
5363
5386
|
// Email/Password auth is supported if we have the required config
|
|
5364
5387
|
return !!this.config.apiUrl;
|
|
5365
5388
|
}
|
|
5366
|
-
|
|
5367
|
-
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, 'Account linking is not supported for email/password authentication');
|
|
5368
|
-
}
|
|
5369
|
-
async unlinkAccount(_options) {
|
|
5370
|
-
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, 'Account unlinking is not supported for email/password authentication');
|
|
5371
|
-
}
|
|
5389
|
+
// linkAccount + unlinkAccount inherit BaseAuthProvider's OPERATION_NOT_ALLOWED defaults (F-44).
|
|
5372
5390
|
async revokeAccess(_token) {
|
|
5373
5391
|
// For email/password auth, revoking access means signing out
|
|
5374
5392
|
await this.signOut();
|
|
@@ -5380,11 +5398,15 @@ var emailPasswordProvider = /*#__PURE__*/Object.freeze({
|
|
|
5380
5398
|
EmailPasswordProvider: EmailPasswordProvider
|
|
5381
5399
|
});
|
|
5382
5400
|
|
|
5383
|
-
class BiometricProvider {
|
|
5384
|
-
|
|
5385
|
-
|
|
5401
|
+
class BiometricProvider extends BaseAuthProvider {
|
|
5402
|
+
get name() {
|
|
5403
|
+
return 'biometric';
|
|
5404
|
+
}
|
|
5405
|
+
constructor(input = {}) {
|
|
5406
|
+
super(resolveProviderConfig(AuthProvider.BIOMETRIC, input));
|
|
5386
5407
|
this.biometricAuth = null;
|
|
5387
5408
|
this.cryptoKeyPromise = null;
|
|
5409
|
+
const config = this.options;
|
|
5388
5410
|
this.config = Object.assign({ reason: 'Authenticate to access your account', title: 'Authentication Required', subtitle: 'Access your account securely', fallbackTitle: 'Use Passcode', requireRecentAuth: true, recentAuthTimeout: 5 * 60 * 1000 }, config);
|
|
5389
5411
|
this.storageKey =
|
|
5390
5412
|
config.storageKey || 'capacitor-auth-biometric-credentials';
|
|
@@ -5668,9 +5690,7 @@ class BiometricProvider {
|
|
|
5668
5690
|
const result = await this.isAvailable();
|
|
5669
5691
|
return result.available;
|
|
5670
5692
|
}
|
|
5671
|
-
|
|
5672
|
-
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, 'Account linking is not supported for biometric authentication');
|
|
5673
|
-
}
|
|
5693
|
+
// linkAccount inherits BaseAuthProvider's OPERATION_NOT_ALLOWED default (F-44).
|
|
5674
5694
|
async unlinkAccount(_options) {
|
|
5675
5695
|
// Unlinking biometric auth means clearing stored credentials
|
|
5676
5696
|
await this.clearStoredCredentials();
|
|
@@ -5947,12 +5967,17 @@ var linkedinProvider = /*#__PURE__*/Object.freeze({
|
|
|
5947
5967
|
LinkedInProvider: LinkedInProvider
|
|
5948
5968
|
});
|
|
5949
5969
|
|
|
5950
|
-
class UsernamePasswordProvider {
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5970
|
+
class UsernamePasswordProvider extends BaseAuthProvider {
|
|
5971
|
+
get name() {
|
|
5972
|
+
return 'username-password';
|
|
5973
|
+
}
|
|
5974
|
+
constructor(input) {
|
|
5975
|
+
super(resolveProviderConfig(AuthProvider.USERNAME_PASSWORD, input));
|
|
5976
|
+
// currentUser is the inherited (in-memory) field from BaseAuthProvider; assigned directly here
|
|
5977
|
+
// so username/password sessions stay in-memory exactly as before (no new storage persistence).
|
|
5954
5978
|
this.authToken = null;
|
|
5955
5979
|
this.refreshTokenValue = null;
|
|
5980
|
+
const config = this.options;
|
|
5956
5981
|
this.config = Object.assign({ allowSignUp: true, usernameRequirements: Object.assign({ minLength: 3, maxLength: 20, allowedCharacters: /^[a-zA-Z0-9_-]+$/, reservedUsernames: ['admin', 'root', 'system', 'user'] }, config.usernameRequirements), passwordRequirements: Object.assign({ minLength: 8, requireUppercase: true, requireLowercase: true, requireNumbers: true, requireSpecialChars: false }, config.passwordRequirements) }, config);
|
|
5957
5982
|
}
|
|
5958
5983
|
async signIn(options) {
|
|
@@ -6297,12 +6322,7 @@ class UsernamePasswordProvider {
|
|
|
6297
6322
|
// Username/Password auth is supported if we have the required config
|
|
6298
6323
|
return !!this.config.apiUrl;
|
|
6299
6324
|
}
|
|
6300
|
-
|
|
6301
|
-
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, 'Account linking is not supported for username/password authentication');
|
|
6302
|
-
}
|
|
6303
|
-
async unlinkAccount(_options) {
|
|
6304
|
-
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, 'Account unlinking is not supported for username/password authentication');
|
|
6305
|
-
}
|
|
6325
|
+
// linkAccount + unlinkAccount inherit BaseAuthProvider's OPERATION_NOT_ALLOWED defaults (F-44).
|
|
6306
6326
|
async revokeAccess(_token) {
|
|
6307
6327
|
// For username/password auth, revoking access means signing out
|
|
6308
6328
|
await this.signOut();
|
|
@@ -6314,15 +6334,18 @@ var usernamePasswordProvider = /*#__PURE__*/Object.freeze({
|
|
|
6314
6334
|
UsernamePasswordProvider: UsernamePasswordProvider
|
|
6315
6335
|
});
|
|
6316
6336
|
|
|
6317
|
-
class EmailCodeProvider {
|
|
6318
|
-
|
|
6319
|
-
|
|
6337
|
+
class EmailCodeProvider extends BaseAuthProvider {
|
|
6338
|
+
get name() {
|
|
6339
|
+
return 'email-code';
|
|
6340
|
+
}
|
|
6341
|
+
constructor(input) {
|
|
6342
|
+
super(resolveProviderConfig(AuthProvider.EMAIL_CODE, input));
|
|
6320
6343
|
// Pending verifications are persisted (SSR-guarded localStorage) so they survive a reload /
|
|
6321
6344
|
// page change between sending and verifying the code. Only non-secret metadata is stored —
|
|
6322
6345
|
// never the verification code itself (see PendingVerificationStore + F-11).
|
|
6323
6346
|
this.pendingVerifications = new PendingVerificationStore('email-code');
|
|
6324
6347
|
this.MAX_ATTEMPTS = 3;
|
|
6325
|
-
this.config = Object.assign({ codeLength: 6, resendDelay: 60000, codeExpiration: 10 * 60 * 1000 },
|
|
6348
|
+
this.config = Object.assign({ codeLength: 6, resendDelay: 60000, codeExpiration: 10 * 60 * 1000 }, this.options);
|
|
6326
6349
|
}
|
|
6327
6350
|
async signIn(options) {
|
|
6328
6351
|
if (!(options === null || options === void 0 ? void 0 : options.email)) {
|
|
@@ -6517,12 +6540,7 @@ class EmailCodeProvider {
|
|
|
6517
6540
|
async isSupported() {
|
|
6518
6541
|
return !!(this.config.sendCodeUrl && this.config.verifyCodeUrl);
|
|
6519
6542
|
}
|
|
6520
|
-
|
|
6521
|
-
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, 'Account linking is not supported for email code authentication');
|
|
6522
|
-
}
|
|
6523
|
-
async unlinkAccount(_options) {
|
|
6524
|
-
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, 'Account unlinking is not supported for email code authentication');
|
|
6525
|
-
}
|
|
6543
|
+
// linkAccount + unlinkAccount inherit BaseAuthProvider's OPERATION_NOT_ALLOWED defaults (F-44).
|
|
6526
6544
|
async revokeAccess(_token) {
|
|
6527
6545
|
this.pendingVerifications.clear();
|
|
6528
6546
|
}
|
|
@@ -6567,11 +6585,15 @@ var emailCodeProvider = /*#__PURE__*/Object.freeze({
|
|
|
6567
6585
|
EmailCodeProvider: EmailCodeProvider
|
|
6568
6586
|
});
|
|
6569
6587
|
|
|
6570
|
-
class PhonePasswordProvider {
|
|
6571
|
-
|
|
6572
|
-
|
|
6588
|
+
class PhonePasswordProvider extends BaseAuthProvider {
|
|
6589
|
+
get name() {
|
|
6590
|
+
return 'phone-password';
|
|
6591
|
+
}
|
|
6592
|
+
constructor(input) {
|
|
6593
|
+
super(resolveProviderConfig(AuthProvider.PHONE_PASSWORD, input));
|
|
6573
6594
|
this.pendingVerifications = new Map();
|
|
6574
|
-
|
|
6595
|
+
// currentUser is the inherited (in-memory) field from BaseAuthProvider; assigned directly here
|
|
6596
|
+
// so phone/password sessions stay in-memory exactly as before (no new storage persistence).
|
|
6575
6597
|
this.storedAccessToken = null;
|
|
6576
6598
|
this.storedRefreshToken = null;
|
|
6577
6599
|
this.config = Object.assign({ countryCode: '+1', requirePhoneVerification: false, passwordStrength: {
|
|
@@ -6580,7 +6602,7 @@ class PhonePasswordProvider {
|
|
|
6580
6602
|
requireLowercase: true,
|
|
6581
6603
|
requireNumbers: true,
|
|
6582
6604
|
requireSpecialChars: false,
|
|
6583
|
-
} },
|
|
6605
|
+
} }, this.options);
|
|
6584
6606
|
}
|
|
6585
6607
|
async signIn(options) {
|
|
6586
6608
|
const credentials = options === null || options === void 0 ? void 0 : options.credentials;
|
|
@@ -6623,7 +6645,7 @@ class PhonePasswordProvider {
|
|
|
6623
6645
|
throw new AuthError(AuthErrorCode.SIGN_IN_FAILED, error.message || 'Sign in failed');
|
|
6624
6646
|
}
|
|
6625
6647
|
const data = await response.json();
|
|
6626
|
-
return this.
|
|
6648
|
+
return this.buildAuthResult(data, phoneNumber);
|
|
6627
6649
|
}
|
|
6628
6650
|
catch (error) {
|
|
6629
6651
|
if (error instanceof AuthError)
|
|
@@ -6687,7 +6709,7 @@ class PhonePasswordProvider {
|
|
|
6687
6709
|
},
|
|
6688
6710
|
};
|
|
6689
6711
|
}
|
|
6690
|
-
return this.
|
|
6712
|
+
return this.buildAuthResult(data, phoneNumber, true);
|
|
6691
6713
|
}
|
|
6692
6714
|
catch (error) {
|
|
6693
6715
|
if (error instanceof AuthError)
|
|
@@ -6755,7 +6777,7 @@ class PhonePasswordProvider {
|
|
|
6755
6777
|
}
|
|
6756
6778
|
const data = await response.json();
|
|
6757
6779
|
this.pendingVerifications.delete(phoneNumber);
|
|
6758
|
-
return this.
|
|
6780
|
+
return this.buildAuthResult(data, phoneNumber);
|
|
6759
6781
|
}
|
|
6760
6782
|
catch (error) {
|
|
6761
6783
|
if (error instanceof AuthError)
|
|
@@ -6825,12 +6847,7 @@ class PhonePasswordProvider {
|
|
|
6825
6847
|
async isSupported() {
|
|
6826
6848
|
return !!(this.config.signInUrl && this.config.signUpUrl);
|
|
6827
6849
|
}
|
|
6828
|
-
|
|
6829
|
-
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, 'Account linking is not supported for phone/password authentication');
|
|
6830
|
-
}
|
|
6831
|
-
async unlinkAccount(_options) {
|
|
6832
|
-
throw new AuthError(AuthErrorCode.OPERATION_NOT_ALLOWED, 'Account unlinking is not supported for phone/password authentication');
|
|
6833
|
-
}
|
|
6850
|
+
// linkAccount + unlinkAccount inherit BaseAuthProvider's OPERATION_NOT_ALLOWED defaults (F-44).
|
|
6834
6851
|
async revokeAccess(_token) {
|
|
6835
6852
|
await this.signOut();
|
|
6836
6853
|
}
|
|
@@ -6857,7 +6874,9 @@ class PhonePasswordProvider {
|
|
|
6857
6874
|
throw new AuthError(AuthErrorCode.SERVER_ERROR, error.message || 'Failed to send password reset');
|
|
6858
6875
|
}
|
|
6859
6876
|
}
|
|
6860
|
-
createAuthResult
|
|
6877
|
+
// Renamed from createAuthResult to avoid colliding with BaseAuthProvider.createAuthResult,
|
|
6878
|
+
// which has a different signature (this builds a phone-specific result from a backend payload).
|
|
6879
|
+
buildAuthResult(data, phoneNumber, isNewUser = false) {
|
|
6861
6880
|
const user = {
|
|
6862
6881
|
uid: data.uid || this.generateUid(phoneNumber),
|
|
6863
6882
|
email: data.email || null,
|