@dubsdotapp/expo 0.2.20 → 0.2.21
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.d.mts +21 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.js +270 -226
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -2
- package/src/hooks/useAuth.ts +10 -3
- package/src/index.ts +2 -0
- package/src/types.ts +4 -0
- package/src/utils/device.ts +55 -0
package/dist/index.mjs
CHANGED
|
@@ -1369,7 +1369,7 @@ import {
|
|
|
1369
1369
|
StyleSheet as StyleSheet2,
|
|
1370
1370
|
Keyboard,
|
|
1371
1371
|
KeyboardAvoidingView,
|
|
1372
|
-
Platform as
|
|
1372
|
+
Platform as Platform3,
|
|
1373
1373
|
Image as Image2,
|
|
1374
1374
|
Animated,
|
|
1375
1375
|
ScrollView
|
|
@@ -1744,6 +1744,45 @@ import bs583 from "bs58";
|
|
|
1744
1744
|
import { createContext as createContext2 } from "react";
|
|
1745
1745
|
var AuthContext = createContext2(null);
|
|
1746
1746
|
|
|
1747
|
+
// src/utils/device.ts
|
|
1748
|
+
import { Platform as Platform2 } from "react-native";
|
|
1749
|
+
async function getDeviceInfo() {
|
|
1750
|
+
try {
|
|
1751
|
+
const Device = __require("expo-device");
|
|
1752
|
+
return {
|
|
1753
|
+
platform: Platform2.OS,
|
|
1754
|
+
modelName: Device.modelName,
|
|
1755
|
+
brand: Device.brand,
|
|
1756
|
+
manufacturer: Device.manufacturer,
|
|
1757
|
+
osName: Device.osName,
|
|
1758
|
+
osVersion: Device.osVersion,
|
|
1759
|
+
deviceType: Device.deviceType,
|
|
1760
|
+
deviceName: Device.deviceName,
|
|
1761
|
+
totalMemory: Device.totalMemory,
|
|
1762
|
+
modelId: Device.modelId,
|
|
1763
|
+
designName: Device.designName,
|
|
1764
|
+
productName: Device.productName,
|
|
1765
|
+
isDevice: Device.isDevice
|
|
1766
|
+
};
|
|
1767
|
+
} catch {
|
|
1768
|
+
return {
|
|
1769
|
+
platform: Platform2.OS,
|
|
1770
|
+
modelName: null,
|
|
1771
|
+
brand: null,
|
|
1772
|
+
manufacturer: null,
|
|
1773
|
+
osName: null,
|
|
1774
|
+
osVersion: null,
|
|
1775
|
+
deviceType: null,
|
|
1776
|
+
deviceName: null,
|
|
1777
|
+
totalMemory: null,
|
|
1778
|
+
modelId: null,
|
|
1779
|
+
designName: null,
|
|
1780
|
+
productName: null,
|
|
1781
|
+
isDevice: null
|
|
1782
|
+
};
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1747
1786
|
// src/hooks/useAuth.ts
|
|
1748
1787
|
function useAuth() {
|
|
1749
1788
|
const sharedAuth = useContext2(AuthContext);
|
|
@@ -1772,15 +1811,17 @@ function useAuth() {
|
|
|
1772
1811
|
setStatus("authenticating");
|
|
1773
1812
|
setError(null);
|
|
1774
1813
|
const walletAddress = wallet.publicKey.toBase58();
|
|
1814
|
+
const deviceInfo = await getDeviceInfo();
|
|
1815
|
+
console.log("[useAuth] Device info:", JSON.stringify(deviceInfo, null, 2));
|
|
1775
1816
|
const { nonce, message } = await client.getNonce(walletAddress);
|
|
1776
1817
|
setStatus("signing");
|
|
1777
1818
|
const messageBytes = new TextEncoder().encode(message);
|
|
1778
1819
|
const signatureBytes = await wallet.signMessage(messageBytes);
|
|
1779
1820
|
const signature = bs583.encode(signatureBytes);
|
|
1780
1821
|
setStatus("verifying");
|
|
1781
|
-
const result = await client.authenticate({ walletAddress, signature, nonce });
|
|
1822
|
+
const result = await client.authenticate({ walletAddress, signature, nonce, deviceInfo });
|
|
1782
1823
|
if (result.needsRegistration) {
|
|
1783
|
-
pendingAuth.current = { walletAddress, nonce, signature };
|
|
1824
|
+
pendingAuth.current = { walletAddress, nonce, signature, deviceInfo };
|
|
1784
1825
|
setStatus("needsRegistration");
|
|
1785
1826
|
return;
|
|
1786
1827
|
}
|
|
@@ -1806,7 +1847,8 @@ function useAuth() {
|
|
|
1806
1847
|
nonce: pending.nonce,
|
|
1807
1848
|
username,
|
|
1808
1849
|
referralCode,
|
|
1809
|
-
avatarUrl
|
|
1850
|
+
avatarUrl,
|
|
1851
|
+
deviceInfo: pending.deviceInfo
|
|
1810
1852
|
});
|
|
1811
1853
|
pendingAuth.current = null;
|
|
1812
1854
|
const user2 = avatarUrl && !result.user.avatar ? { ...result.user, avatar: avatarUrl } : result.user;
|
|
@@ -2277,7 +2319,7 @@ function DefaultRegistrationScreen({
|
|
|
2277
2319
|
KeyboardAvoidingView,
|
|
2278
2320
|
{
|
|
2279
2321
|
style: [s.container, { backgroundColor: t.background }],
|
|
2280
|
-
behavior:
|
|
2322
|
+
behavior: Platform3.OS === "ios" ? "padding" : void 0,
|
|
2281
2323
|
children: /* @__PURE__ */ jsx3(
|
|
2282
2324
|
ScrollView,
|
|
2283
2325
|
{
|
|
@@ -3251,7 +3293,7 @@ import {
|
|
|
3251
3293
|
Animated as Animated2,
|
|
3252
3294
|
StyleSheet as StyleSheet10,
|
|
3253
3295
|
KeyboardAvoidingView as KeyboardAvoidingView2,
|
|
3254
|
-
Platform as
|
|
3296
|
+
Platform as Platform4
|
|
3255
3297
|
} from "react-native";
|
|
3256
3298
|
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3257
3299
|
var STATUS_LABELS2 = {
|
|
@@ -3363,7 +3405,7 @@ function CreateCustomGameSheet({
|
|
|
3363
3405
|
KeyboardAvoidingView2,
|
|
3364
3406
|
{
|
|
3365
3407
|
style: styles9.keyboardView,
|
|
3366
|
-
behavior:
|
|
3408
|
+
behavior: Platform4.OS === "ios" ? "padding" : void 0,
|
|
3367
3409
|
children: /* @__PURE__ */ jsx12(View10, { style: styles9.sheetPositioner, children: /* @__PURE__ */ jsxs10(View10, { style: [styles9.sheet, { backgroundColor: t.background }], children: [
|
|
3368
3410
|
/* @__PURE__ */ jsx12(View10, { style: styles9.handleRow, children: /* @__PURE__ */ jsx12(View10, { style: [styles9.handle, { backgroundColor: t.textMuted }] }) }),
|
|
3369
3411
|
/* @__PURE__ */ jsxs10(View10, { style: styles9.header, children: [
|
|
@@ -3623,6 +3665,7 @@ export {
|
|
|
3623
3665
|
SettingsSheet,
|
|
3624
3666
|
UserProfileCard,
|
|
3625
3667
|
createSecureStoreStorage,
|
|
3668
|
+
getDeviceInfo,
|
|
3626
3669
|
mergeTheme,
|
|
3627
3670
|
parseSolanaError,
|
|
3628
3671
|
signAndSendBase64Transaction,
|