@turnkey/sdk-react 5.0.1 → 5.1.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/CHANGELOG.md +19 -0
- package/dist/components/auth/Apple.d.ts.map +1 -1
- package/dist/components/auth/Apple.js +58 -51
- package/dist/components/auth/Apple.js.map +1 -1
- package/dist/components/auth/Apple.mjs +108 -90
- package/dist/components/auth/Apple.mjs.map +1 -1
- package/dist/components/auth/Auth.d.ts +0 -4
- package/dist/components/auth/Auth.d.ts.map +1 -1
- package/dist/components/auth/Auth.js +7 -12
- package/dist/components/auth/Auth.js.map +1 -1
- package/dist/components/auth/Auth.mjs +51 -57
- package/dist/components/auth/Auth.mjs.map +1 -1
- package/dist/components/auth/Facebook.d.ts.map +1 -1
- package/dist/components/auth/Facebook.js +75 -46
- package/dist/components/auth/Facebook.js.map +1 -1
- package/dist/components/auth/Facebook.mjs +150 -111
- package/dist/components/auth/Facebook.mjs.map +1 -1
- package/dist/components/auth/Google.d.ts.map +1 -1
- package/dist/components/auth/Google.js +67 -56
- package/dist/components/auth/Google.js.map +1 -1
- package/dist/components/auth/Google.mjs +113 -89
- package/dist/components/auth/Google.mjs.map +1 -1
- package/dist/components/auth/OtpVerification.d.ts.map +1 -1
- package/dist/components/auth/OtpVerification.js +1 -0
- package/dist/components/auth/OtpVerification.js.map +1 -1
- package/dist/components/auth/OtpVerification.mjs +30 -27
- package/dist/components/auth/OtpVerification.mjs.map +1 -1
- package/dist/hooks/use-session.d.ts +2 -1
- package/dist/hooks/use-session.d.ts.map +1 -1
- package/package.json +4 -3
|
@@ -21,12 +21,8 @@ var useTurnkey = require('../../hooks/use-turnkey.js');
|
|
|
21
21
|
var constants = require('./constants.js');
|
|
22
22
|
var sdkServer = require('@turnkey/sdk-server');
|
|
23
23
|
var parsePhoneNumberFromString = require('libphonenumber-js');
|
|
24
|
+
var sdkTypes = require('@turnkey/sdk-types');
|
|
24
25
|
|
|
25
|
-
exports.SessionType = void 0;
|
|
26
|
-
(function (SessionType) {
|
|
27
|
-
SessionType["READ_ONLY"] = "SESSION_TYPE_READ_ONLY";
|
|
28
|
-
SessionType["READ_WRITE"] = "SESSION_TYPE_READ_WRITE";
|
|
29
|
-
})(exports.SessionType || (exports.SessionType = {}));
|
|
30
26
|
const passkeyIcon = jsxRuntime.jsxs("svg", {
|
|
31
27
|
xmlns: "http://www.w3.org/2000/svg",
|
|
32
28
|
width: "43",
|
|
@@ -100,10 +96,6 @@ const Auth = ({
|
|
|
100
96
|
React.useEffect(() => {
|
|
101
97
|
const manageClient = async () => {
|
|
102
98
|
if (indexedDbClient && turnkey$1) {
|
|
103
|
-
const session = await turnkey$1.getSession();
|
|
104
|
-
if (!session) {
|
|
105
|
-
await indexedDbClient.resetKeyPair();
|
|
106
|
-
}
|
|
107
99
|
const retrievedPublicKey = await indexedDbClient.getPublicKey();
|
|
108
100
|
if (retrievedPublicKey) {
|
|
109
101
|
setComponentReady(true);
|
|
@@ -175,9 +167,10 @@ const Auth = ({
|
|
|
175
167
|
constants.authErrors.passkey.createFailed;
|
|
176
168
|
}
|
|
177
169
|
}
|
|
170
|
+
await indexedDbClient.resetKeyPair();
|
|
178
171
|
const pubKey = await indexedDbClient.getPublicKey();
|
|
179
172
|
await passkeyClient?.loginWithPasskey({
|
|
180
|
-
sessionType:
|
|
173
|
+
sessionType: sdkTypes.SessionType.READ_WRITE,
|
|
181
174
|
publicKey: pubKey,
|
|
182
175
|
expirationSeconds: authConfig.sessionLengthSeconds?.toString()
|
|
183
176
|
});
|
|
@@ -190,9 +183,10 @@ const Auth = ({
|
|
|
190
183
|
const handleLoginWithPasskey = async () => {
|
|
191
184
|
try {
|
|
192
185
|
setLoading("passkey");
|
|
186
|
+
await indexedDbClient?.resetKeyPair();
|
|
193
187
|
const pubKey = await indexedDbClient.getPublicKey();
|
|
194
188
|
await passkeyClient?.loginWithPasskey({
|
|
195
|
-
sessionType:
|
|
189
|
+
sessionType: sdkTypes.SessionType.READ_WRITE,
|
|
196
190
|
publicKey: pubKey,
|
|
197
191
|
expirationSeconds: authConfig.sessionLengthSeconds?.toString()
|
|
198
192
|
});
|
|
@@ -299,9 +293,10 @@ const Auth = ({
|
|
|
299
293
|
onError(constants.authErrors.wallet.loginFailed);
|
|
300
294
|
return;
|
|
301
295
|
}
|
|
296
|
+
await indexedDbClient.resetKeyPair();
|
|
302
297
|
const pubKey = await indexedDbClient.getPublicKey();
|
|
303
298
|
await walletClient.loginWithWallet({
|
|
304
|
-
sessionType:
|
|
299
|
+
sessionType: sdkTypes.SessionType.READ_WRITE,
|
|
305
300
|
publicKey: pubKey,
|
|
306
301
|
expirationSeconds: authConfig.sessionLengthSeconds?.toString()
|
|
307
302
|
});
|