@sendoracloud/sdk-react-native 1.0.2 → 1.0.3
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/index.cjs +24 -4
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +24 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -485,16 +485,30 @@ var Auth = class {
|
|
|
485
485
|
signInWithDiscord(code, redirectUri) {
|
|
486
486
|
return this.loginSocial({ provider: "discord", code, redirectUri });
|
|
487
487
|
}
|
|
488
|
+
/**
|
|
489
|
+
* Read the stored anon refresh token if (and only if) the local
|
|
490
|
+
* subject is currently anonymous. Used by every identified-session
|
|
491
|
+
* mint path so the backend can run device-takeover (s58.111 +
|
|
492
|
+
* s58.112). Returns `undefined` when not anonymous — never forward
|
|
493
|
+
* an identified user's own refresh token.
|
|
494
|
+
*/
|
|
495
|
+
readPrevAnonRefreshToken() {
|
|
496
|
+
if (!this.user?.isAnonymous) return void 0;
|
|
497
|
+
return this.hooks.storage.get(REFRESH_KEY) ?? void 0;
|
|
498
|
+
}
|
|
488
499
|
/**
|
|
489
500
|
* Exchange the MFA challenge token from `signIn` for a real session
|
|
490
501
|
* by submitting a TOTP or recovery code from the user's authenticator.
|
|
491
502
|
*/
|
|
492
503
|
challengeMfa(mfaChallengeToken, code) {
|
|
493
504
|
return this.serialize(async () => {
|
|
494
|
-
const
|
|
505
|
+
const prevAnonRefreshToken = this.readPrevAnonRefreshToken();
|
|
506
|
+
const body = {
|
|
495
507
|
challengeToken: mfaChallengeToken,
|
|
496
508
|
code
|
|
497
|
-
}
|
|
509
|
+
};
|
|
510
|
+
if (prevAnonRefreshToken) body.prevAnonRefreshToken = prevAnonRefreshToken;
|
|
511
|
+
const data = await this.callAuth("/api/v1/auth-service/mfa/challenge", body);
|
|
498
512
|
this.persist(data);
|
|
499
513
|
return data.user;
|
|
500
514
|
});
|
|
@@ -514,8 +528,11 @@ var Auth = class {
|
|
|
514
528
|
}
|
|
515
529
|
verifyMagicLink(token) {
|
|
516
530
|
return this.serialize(async () => {
|
|
531
|
+
const prevAnonRefreshToken = this.readPrevAnonRefreshToken();
|
|
517
532
|
if (this.user !== null) await this.wipeLocalIdentity();
|
|
518
|
-
const
|
|
533
|
+
const body = { token };
|
|
534
|
+
if (prevAnonRefreshToken) body.prevAnonRefreshToken = prevAnonRefreshToken;
|
|
535
|
+
const data = await this.callAuth("/api/v1/auth-service/magic-link/verify", body);
|
|
519
536
|
this.persist(data);
|
|
520
537
|
return data.user;
|
|
521
538
|
});
|
|
@@ -535,8 +552,11 @@ var Auth = class {
|
|
|
535
552
|
}
|
|
536
553
|
verifyEmailOtp(email, code) {
|
|
537
554
|
return this.serialize(async () => {
|
|
555
|
+
const prevAnonRefreshToken = this.readPrevAnonRefreshToken();
|
|
538
556
|
if (this.user !== null) await this.wipeLocalIdentity();
|
|
539
|
-
const
|
|
557
|
+
const body = { email, code };
|
|
558
|
+
if (prevAnonRefreshToken) body.prevAnonRefreshToken = prevAnonRefreshToken;
|
|
559
|
+
const data = await this.callAuth("/api/v1/auth-service/email-otp/verify", body);
|
|
540
560
|
this.persist(data);
|
|
541
561
|
return data.user;
|
|
542
562
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -220,6 +220,14 @@ declare class Auth {
|
|
|
220
220
|
signInWithLinkedIn(code: string, redirectUri: string): Promise<AuthUser>;
|
|
221
221
|
signInWithFacebook(code: string, redirectUri: string): Promise<AuthUser>;
|
|
222
222
|
signInWithDiscord(code: string, redirectUri: string): Promise<AuthUser>;
|
|
223
|
+
/**
|
|
224
|
+
* Read the stored anon refresh token if (and only if) the local
|
|
225
|
+
* subject is currently anonymous. Used by every identified-session
|
|
226
|
+
* mint path so the backend can run device-takeover (s58.111 +
|
|
227
|
+
* s58.112). Returns `undefined` when not anonymous — never forward
|
|
228
|
+
* an identified user's own refresh token.
|
|
229
|
+
*/
|
|
230
|
+
private readPrevAnonRefreshToken;
|
|
223
231
|
/**
|
|
224
232
|
* Exchange the MFA challenge token from `signIn` for a real session
|
|
225
233
|
* by submitting a TOTP or recovery code from the user's authenticator.
|
package/dist/index.d.ts
CHANGED
|
@@ -220,6 +220,14 @@ declare class Auth {
|
|
|
220
220
|
signInWithLinkedIn(code: string, redirectUri: string): Promise<AuthUser>;
|
|
221
221
|
signInWithFacebook(code: string, redirectUri: string): Promise<AuthUser>;
|
|
222
222
|
signInWithDiscord(code: string, redirectUri: string): Promise<AuthUser>;
|
|
223
|
+
/**
|
|
224
|
+
* Read the stored anon refresh token if (and only if) the local
|
|
225
|
+
* subject is currently anonymous. Used by every identified-session
|
|
226
|
+
* mint path so the backend can run device-takeover (s58.111 +
|
|
227
|
+
* s58.112). Returns `undefined` when not anonymous — never forward
|
|
228
|
+
* an identified user's own refresh token.
|
|
229
|
+
*/
|
|
230
|
+
private readPrevAnonRefreshToken;
|
|
223
231
|
/**
|
|
224
232
|
* Exchange the MFA challenge token from `signIn` for a real session
|
|
225
233
|
* by submitting a TOTP or recovery code from the user's authenticator.
|
package/dist/index.js
CHANGED
|
@@ -442,16 +442,30 @@ var Auth = class {
|
|
|
442
442
|
signInWithDiscord(code, redirectUri) {
|
|
443
443
|
return this.loginSocial({ provider: "discord", code, redirectUri });
|
|
444
444
|
}
|
|
445
|
+
/**
|
|
446
|
+
* Read the stored anon refresh token if (and only if) the local
|
|
447
|
+
* subject is currently anonymous. Used by every identified-session
|
|
448
|
+
* mint path so the backend can run device-takeover (s58.111 +
|
|
449
|
+
* s58.112). Returns `undefined` when not anonymous — never forward
|
|
450
|
+
* an identified user's own refresh token.
|
|
451
|
+
*/
|
|
452
|
+
readPrevAnonRefreshToken() {
|
|
453
|
+
if (!this.user?.isAnonymous) return void 0;
|
|
454
|
+
return this.hooks.storage.get(REFRESH_KEY) ?? void 0;
|
|
455
|
+
}
|
|
445
456
|
/**
|
|
446
457
|
* Exchange the MFA challenge token from `signIn` for a real session
|
|
447
458
|
* by submitting a TOTP or recovery code from the user's authenticator.
|
|
448
459
|
*/
|
|
449
460
|
challengeMfa(mfaChallengeToken, code) {
|
|
450
461
|
return this.serialize(async () => {
|
|
451
|
-
const
|
|
462
|
+
const prevAnonRefreshToken = this.readPrevAnonRefreshToken();
|
|
463
|
+
const body = {
|
|
452
464
|
challengeToken: mfaChallengeToken,
|
|
453
465
|
code
|
|
454
|
-
}
|
|
466
|
+
};
|
|
467
|
+
if (prevAnonRefreshToken) body.prevAnonRefreshToken = prevAnonRefreshToken;
|
|
468
|
+
const data = await this.callAuth("/api/v1/auth-service/mfa/challenge", body);
|
|
455
469
|
this.persist(data);
|
|
456
470
|
return data.user;
|
|
457
471
|
});
|
|
@@ -471,8 +485,11 @@ var Auth = class {
|
|
|
471
485
|
}
|
|
472
486
|
verifyMagicLink(token) {
|
|
473
487
|
return this.serialize(async () => {
|
|
488
|
+
const prevAnonRefreshToken = this.readPrevAnonRefreshToken();
|
|
474
489
|
if (this.user !== null) await this.wipeLocalIdentity();
|
|
475
|
-
const
|
|
490
|
+
const body = { token };
|
|
491
|
+
if (prevAnonRefreshToken) body.prevAnonRefreshToken = prevAnonRefreshToken;
|
|
492
|
+
const data = await this.callAuth("/api/v1/auth-service/magic-link/verify", body);
|
|
476
493
|
this.persist(data);
|
|
477
494
|
return data.user;
|
|
478
495
|
});
|
|
@@ -492,8 +509,11 @@ var Auth = class {
|
|
|
492
509
|
}
|
|
493
510
|
verifyEmailOtp(email, code) {
|
|
494
511
|
return this.serialize(async () => {
|
|
512
|
+
const prevAnonRefreshToken = this.readPrevAnonRefreshToken();
|
|
495
513
|
if (this.user !== null) await this.wipeLocalIdentity();
|
|
496
|
-
const
|
|
514
|
+
const body = { email, code };
|
|
515
|
+
if (prevAnonRefreshToken) body.prevAnonRefreshToken = prevAnonRefreshToken;
|
|
516
|
+
const data = await this.callAuth("/api/v1/auth-service/email-otp/verify", body);
|
|
497
517
|
this.persist(data);
|
|
498
518
|
return data.user;
|
|
499
519
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendoracloud/sdk-react-native",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Sendora Cloud React Native + Expo SDK — analytics, identity, push-token registration, auth, deep links (Branch / Firebase Dynamic Links parity). Auth + analytics + deep links work in Expo Go; push token registration requires a Dev Client (EAS Build or `npx expo prebuild`).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|