@rhinestone/1auth 0.7.4 → 0.7.5
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/{chunk-IHBVEU33.mjs → chunk-6AHEN3FA.mjs} +1 -1
- package/dist/chunk-6AHEN3FA.mjs.map +1 -0
- package/dist/{chunk-UXBBB7AV.mjs → chunk-6MUQKHAT.mjs} +7 -31
- package/dist/chunk-6MUQKHAT.mjs.map +1 -0
- package/dist/{client-CuASptX3.d.ts → client-BqKAd2RZ.d.mts} +17 -17
- package/dist/{client-D4HVy1KF.d.mts → client-C9mcj5jN.d.ts} +17 -17
- package/dist/headless.d.mts +2 -2
- package/dist/headless.d.ts +2 -2
- package/dist/headless.js +4 -6
- package/dist/headless.js.map +1 -1
- package/dist/headless.mjs +4 -6
- package/dist/headless.mjs.map +1 -1
- package/dist/index.d.mts +12 -21
- package/dist/index.d.ts +12 -21
- package/dist/index.js +44 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -71
- package/dist/index.mjs.map +1 -1
- package/dist/{provider-6JoziYDq.d.ts → provider-CCyUBseo.d.ts} +3 -3
- package/dist/{provider-CAQT7Gqx.d.mts → provider-CRhZVLg8.d.mts} +3 -3
- package/dist/react.d.mts +9 -4
- package/dist/react.d.ts +9 -4
- package/dist/react.js +4 -7
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +4 -7
- package/dist/react.mjs.map +1 -1
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +1 -1
- package/dist/{types-C0jKNT_t.d.mts → types-CbhPRY5s.d.mts} +23 -50
- package/dist/{types-C0jKNT_t.d.ts → types-CbhPRY5s.d.ts} +23 -50
- package/dist/{verify-CnOwPq78.d.ts → verify-DPJR_foR.d.ts} +4 -6
- package/dist/{verify-aWdi5O2z.d.mts → verify-DVYDJgOS.d.mts} +4 -6
- package/dist/wagmi.d.mts +3 -3
- package/dist/wagmi.d.ts +3 -3
- package/dist/wagmi.js +6 -30
- package/dist/wagmi.js.map +1 -1
- package/dist/wagmi.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-IHBVEU33.mjs.map +0 -1
- package/dist/chunk-UXBBB7AV.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
ETHEREUM_MESSAGE_PREFIX,
|
|
6
6
|
hashMessage,
|
|
7
7
|
verifyMessageHash
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6AHEN3FA.mjs";
|
|
9
9
|
import {
|
|
10
10
|
createOneAuthProvider
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-6MUQKHAT.mjs";
|
|
12
12
|
import {
|
|
13
13
|
buildTransactionReview,
|
|
14
14
|
encodeWebAuthnSignature,
|
|
@@ -750,7 +750,6 @@ var OneAuthClient = class {
|
|
|
750
750
|
* call — the modal shows the appropriate flow based on whether the user
|
|
751
751
|
* has a passkey registered.
|
|
752
752
|
*
|
|
753
|
-
* @param options.username - Pre-fill the username field
|
|
754
753
|
* @param options.theme - Override the theme for this modal invocation
|
|
755
754
|
* @param options.oauthEnabled - Set to false to hide OAuth sign-in buttons
|
|
756
755
|
* @param options.flow - Force the login or account-creation route instead
|
|
@@ -762,7 +761,7 @@ var OneAuthClient = class {
|
|
|
762
761
|
* const result = await client.authWithModal();
|
|
763
762
|
*
|
|
764
763
|
* if (result.success) {
|
|
765
|
-
* console.log('Signed in as:', result.user?.
|
|
764
|
+
* console.log('Signed in as:', result.user?.address);
|
|
766
765
|
* console.log('Address:', result.user?.address); // typed `0x${string}`
|
|
767
766
|
* } else if (result.error?.code === 'USER_CANCELLED') {
|
|
768
767
|
* // User closed the modal
|
|
@@ -780,7 +779,6 @@ var OneAuthClient = class {
|
|
|
780
779
|
* is creating a login session, for example after an app-level "Log in"
|
|
781
780
|
* button. The result intentionally matches {@link authWithModal}.
|
|
782
781
|
*
|
|
783
|
-
* @param options.username - Optional account hint for the sign-in ceremony
|
|
784
782
|
* @param options.theme - Override the theme for this modal invocation
|
|
785
783
|
* @returns {@link AuthResult} with user details and typed address
|
|
786
784
|
*/
|
|
@@ -810,8 +808,7 @@ var OneAuthClient = class {
|
|
|
810
808
|
*/
|
|
811
809
|
async openAuthModal(options) {
|
|
812
810
|
const telemetry = this.createTelemetryOperation("auth", {
|
|
813
|
-
flow: options?.flow ?? "auto"
|
|
814
|
-
hasUsernameHint: !!options?.username
|
|
811
|
+
flow: options?.flow ?? "auto"
|
|
815
812
|
});
|
|
816
813
|
const dialogUrl = this.getDialogUrl();
|
|
817
814
|
const requestId = this.createDialogRequestId();
|
|
@@ -822,9 +819,6 @@ var OneAuthClient = class {
|
|
|
822
819
|
if (this.config.clientId) {
|
|
823
820
|
params.set("clientId", this.config.clientId);
|
|
824
821
|
}
|
|
825
|
-
if (options?.username) {
|
|
826
|
-
params.set("username", options.username);
|
|
827
|
-
}
|
|
828
822
|
if (options?.oauthEnabled === false) {
|
|
829
823
|
params.set("oauth", "0");
|
|
830
824
|
}
|
|
@@ -896,7 +890,7 @@ var OneAuthClient = class {
|
|
|
896
890
|
* const result = await client.connectWithModal();
|
|
897
891
|
*
|
|
898
892
|
* if (result.success) {
|
|
899
|
-
* console.log('Connected as:', result.user?.
|
|
893
|
+
* console.log('Connected as:', result.user?.address);
|
|
900
894
|
* } else if (result.action === 'switch') {
|
|
901
895
|
* // User needs to sign in first
|
|
902
896
|
* const authResult = await client.authWithModal();
|
|
@@ -981,14 +975,14 @@ var OneAuthClient = class {
|
|
|
981
975
|
* `{ success: false, action: "cancel", error: { code: "USER_CANCELLED", … } }`.
|
|
982
976
|
*
|
|
983
977
|
* @param options - Forwarded to whichever underlying modal is shown.
|
|
984
|
-
* `
|
|
978
|
+
* `oauthEnabled` only applies to the auth-modal fallback path.
|
|
985
979
|
* @returns A {@link ConnectResult} discriminated union.
|
|
986
980
|
*
|
|
987
981
|
* @example
|
|
988
982
|
* ```typescript
|
|
989
983
|
* const result = await client.connect();
|
|
990
984
|
* if (result.success) {
|
|
991
|
-
* console.log("Connected as", result.user?.
|
|
985
|
+
* console.log("Connected as", result.user?.address);
|
|
992
986
|
* }
|
|
993
987
|
* ```
|
|
994
988
|
*/
|
|
@@ -1003,7 +997,6 @@ var OneAuthClient = class {
|
|
|
1003
997
|
return {
|
|
1004
998
|
success: true,
|
|
1005
999
|
user: {
|
|
1006
|
-
username: authResult.user.username,
|
|
1007
1000
|
address: authResult.user.address
|
|
1008
1001
|
},
|
|
1009
1002
|
autoConnected: false
|
|
@@ -1173,17 +1166,17 @@ var OneAuthClient = class {
|
|
|
1173
1166
|
targetChains: normalizeGrantTargetChains(options).join(","),
|
|
1174
1167
|
sponsor: options.sponsor !== false
|
|
1175
1168
|
});
|
|
1176
|
-
if (!options.
|
|
1169
|
+
if (!options.accountAddress) {
|
|
1177
1170
|
this.emitTelemetry("grant_permission.failed", telemetry, {
|
|
1178
1171
|
outcome: "failure",
|
|
1179
1172
|
errorCode: "INVALID_OPTIONS",
|
|
1180
|
-
errorMessage: "
|
|
1173
|
+
errorMessage: "accountAddress is required"
|
|
1181
1174
|
});
|
|
1182
1175
|
return {
|
|
1183
1176
|
success: false,
|
|
1184
1177
|
error: {
|
|
1185
1178
|
code: "INVALID_OPTIONS",
|
|
1186
|
-
message: "
|
|
1179
|
+
message: "accountAddress is required"
|
|
1187
1180
|
}
|
|
1188
1181
|
};
|
|
1189
1182
|
}
|
|
@@ -1247,7 +1240,6 @@ var OneAuthClient = class {
|
|
|
1247
1240
|
mode: "iframe",
|
|
1248
1241
|
clientId: this.config.clientId,
|
|
1249
1242
|
grant: cloneGrantPayload({
|
|
1250
|
-
username: options.username,
|
|
1251
1243
|
accountAddress: options.accountAddress,
|
|
1252
1244
|
targetChain: targetChains[0],
|
|
1253
1245
|
targetChains,
|
|
@@ -1302,17 +1294,16 @@ var OneAuthClient = class {
|
|
|
1302
1294
|
* not send `clientId` for this lookup because grants are origin-scoped.
|
|
1303
1295
|
*/
|
|
1304
1296
|
async listSessionGrants(options) {
|
|
1305
|
-
if (!options.
|
|
1297
|
+
if (!options.accountAddress) {
|
|
1306
1298
|
return {
|
|
1307
1299
|
success: false,
|
|
1308
1300
|
error: {
|
|
1309
1301
|
code: "INVALID_OPTIONS",
|
|
1310
|
-
message: "
|
|
1302
|
+
message: "accountAddress is required"
|
|
1311
1303
|
}
|
|
1312
1304
|
};
|
|
1313
1305
|
}
|
|
1314
1306
|
const params = new URLSearchParams();
|
|
1315
|
-
if (options.username) params.set("username", options.username);
|
|
1316
1307
|
if (options.accountAddress) params.set("accountAddress", options.accountAddress);
|
|
1317
1308
|
if (options.includeRevoked) params.set("includeRevoked", "true");
|
|
1318
1309
|
try {
|
|
@@ -1365,7 +1356,7 @@ var OneAuthClient = class {
|
|
|
1365
1356
|
* if (result.success && result.challenge) {
|
|
1366
1357
|
* // Verify signature server-side
|
|
1367
1358
|
* const isValid = await verifyOnServer(
|
|
1368
|
-
* result.user?.
|
|
1359
|
+
* result.user?.address,
|
|
1369
1360
|
* result.challenge.signature,
|
|
1370
1361
|
* result.challenge.signedHash
|
|
1371
1362
|
* );
|
|
@@ -1396,15 +1387,14 @@ var OneAuthClient = class {
|
|
|
1396
1387
|
return authResult;
|
|
1397
1388
|
}
|
|
1398
1389
|
const accountAddress = authResult.user?.address;
|
|
1399
|
-
|
|
1400
|
-
if (!accountAddress && !username) {
|
|
1390
|
+
if (!accountAddress) {
|
|
1401
1391
|
const result2 = {
|
|
1402
1392
|
success: false,
|
|
1403
1393
|
user: authResult.user,
|
|
1404
1394
|
signerType: authResult.signerType,
|
|
1405
1395
|
error: {
|
|
1406
1396
|
code: "AUTHENTICATE_USER_MISSING",
|
|
1407
|
-
message: "Authentication succeeded but no
|
|
1397
|
+
message: "Authentication succeeded but no account address was returned for challenge signing"
|
|
1408
1398
|
}
|
|
1409
1399
|
};
|
|
1410
1400
|
this.emitTelemetry("auth.failed", telemetry, {
|
|
@@ -1414,7 +1404,6 @@ var OneAuthClient = class {
|
|
|
1414
1404
|
return result2;
|
|
1415
1405
|
}
|
|
1416
1406
|
const signResult = await this.signMessage({
|
|
1417
|
-
username,
|
|
1418
1407
|
accountAddress,
|
|
1419
1408
|
message: options.challenge,
|
|
1420
1409
|
description: "Verify your identity",
|
|
@@ -1482,7 +1471,6 @@ var OneAuthClient = class {
|
|
|
1482
1471
|
const ready = await this.waitForDialogReady(dialog, iframe, cleanup, {
|
|
1483
1472
|
mode: "iframe",
|
|
1484
1473
|
challenge: options.challenge,
|
|
1485
|
-
username: options.username,
|
|
1486
1474
|
accountAddress: options.accountAddress,
|
|
1487
1475
|
description: options.description,
|
|
1488
1476
|
transaction: options.transaction,
|
|
@@ -1534,7 +1522,7 @@ var OneAuthClient = class {
|
|
|
1534
1522
|
* @example
|
|
1535
1523
|
* ```typescript
|
|
1536
1524
|
* const result = await client.sendIntent({
|
|
1537
|
-
*
|
|
1525
|
+
* accountAddress: '0x...',
|
|
1538
1526
|
* targetChain: 8453, // Base
|
|
1539
1527
|
* calls: [
|
|
1540
1528
|
* {
|
|
@@ -1552,7 +1540,7 @@ var OneAuthClient = class {
|
|
|
1552
1540
|
* ```
|
|
1553
1541
|
*/
|
|
1554
1542
|
async sendIntent(options) {
|
|
1555
|
-
const {
|
|
1543
|
+
const { accountAddress, targetChain } = options;
|
|
1556
1544
|
const calls = capCallLabels(options.calls);
|
|
1557
1545
|
const sponsor = options.sponsor !== false;
|
|
1558
1546
|
const telemetry = this.createTelemetryOperation("intent", {
|
|
@@ -1577,11 +1565,11 @@ var OneAuthClient = class {
|
|
|
1577
1565
|
}
|
|
1578
1566
|
};
|
|
1579
1567
|
}
|
|
1580
|
-
if (!
|
|
1568
|
+
if (!accountAddress) {
|
|
1581
1569
|
this.emitTelemetry("intent.completed", telemetry, {
|
|
1582
1570
|
outcome: "failure",
|
|
1583
1571
|
errorCode: "INVALID_OPTIONS",
|
|
1584
|
-
errorMessage: "
|
|
1572
|
+
errorMessage: "accountAddress is required"
|
|
1585
1573
|
});
|
|
1586
1574
|
return {
|
|
1587
1575
|
success: false,
|
|
@@ -1589,7 +1577,7 @@ var OneAuthClient = class {
|
|
|
1589
1577
|
status: "failed",
|
|
1590
1578
|
error: {
|
|
1591
1579
|
code: "INVALID_OPTIONS",
|
|
1592
|
-
message: "
|
|
1580
|
+
message: "accountAddress is required"
|
|
1593
1581
|
}
|
|
1594
1582
|
};
|
|
1595
1583
|
}
|
|
@@ -1739,7 +1727,6 @@ var OneAuthClient = class {
|
|
|
1739
1727
|
}
|
|
1740
1728
|
let accessToken = accessTokenResult.ok ? accessTokenResult.accessToken : "";
|
|
1741
1729
|
const requestBody = {
|
|
1742
|
-
username,
|
|
1743
1730
|
accountAddress,
|
|
1744
1731
|
targetChain,
|
|
1745
1732
|
calls,
|
|
@@ -1981,7 +1968,6 @@ var OneAuthClient = class {
|
|
|
1981
1968
|
chainId: targetChain,
|
|
1982
1969
|
transaction: prepareResponse.transaction,
|
|
1983
1970
|
challenge: prepareResponse.challenge,
|
|
1984
|
-
username,
|
|
1985
1971
|
accountAddress: prepareResponse.accountAddress,
|
|
1986
1972
|
originMessages: prepareResponse.originMessages,
|
|
1987
1973
|
tokenRequests: serializedTokenRequests,
|
|
@@ -2036,7 +2022,6 @@ var OneAuthClient = class {
|
|
|
2036
2022
|
signingMode: "transaction",
|
|
2037
2023
|
calls,
|
|
2038
2024
|
chainId: targetChain,
|
|
2039
|
-
username,
|
|
2040
2025
|
accountAddress: options.accountAddress,
|
|
2041
2026
|
tokenRequests: serializedTokenRequests,
|
|
2042
2027
|
telemetry: this.telemetryPayload(telemetry)
|
|
@@ -2112,7 +2097,6 @@ var OneAuthClient = class {
|
|
|
2112
2097
|
chainId: targetChain,
|
|
2113
2098
|
transaction: prepareResponse.transaction,
|
|
2114
2099
|
challenge: prepareResponse.challenge,
|
|
2115
|
-
username,
|
|
2116
2100
|
accountAddress: prepareResponse.accountAddress,
|
|
2117
2101
|
originMessages: prepareResponse.originMessages,
|
|
2118
2102
|
tokenRequests: serializedTokenRequests,
|
|
@@ -2507,7 +2491,7 @@ var OneAuthClient = class {
|
|
|
2507
2491
|
* @example
|
|
2508
2492
|
* ```typescript
|
|
2509
2493
|
* const result = await client.sendBatchIntent({
|
|
2510
|
-
*
|
|
2494
|
+
* accountAddress: '0x...',
|
|
2511
2495
|
* intents: [
|
|
2512
2496
|
* {
|
|
2513
2497
|
* targetChain: 8453, // Base
|
|
@@ -2544,11 +2528,11 @@ var OneAuthClient = class {
|
|
|
2544
2528
|
error: "Batch intents are not supported for EOA sessions. Use the connected wallet's native RPC instead."
|
|
2545
2529
|
};
|
|
2546
2530
|
}
|
|
2547
|
-
if (!options.
|
|
2531
|
+
if (!options.accountAddress) {
|
|
2548
2532
|
this.emitTelemetry("batch.completed", telemetry, {
|
|
2549
2533
|
outcome: "failure",
|
|
2550
2534
|
errorCode: "INVALID_OPTIONS",
|
|
2551
|
-
errorMessage: "
|
|
2535
|
+
errorMessage: "accountAddress is required"
|
|
2552
2536
|
});
|
|
2553
2537
|
return {
|
|
2554
2538
|
success: false,
|
|
@@ -2613,7 +2597,6 @@ var OneAuthClient = class {
|
|
|
2613
2597
|
moduleInstall: intent.moduleInstall
|
|
2614
2598
|
}));
|
|
2615
2599
|
const requestBody = {
|
|
2616
|
-
...options.username && { username: options.username },
|
|
2617
2600
|
...options.accountAddress && { accountAddress: options.accountAddress },
|
|
2618
2601
|
intents: serializedIntents,
|
|
2619
2602
|
auth: { accessToken },
|
|
@@ -2739,7 +2722,6 @@ var OneAuthClient = class {
|
|
|
2739
2722
|
batchFailedIntents: prepareResponse.failedIntents,
|
|
2740
2723
|
challenge: prepareResponse.challenge,
|
|
2741
2724
|
binding: prepareResponse.binding,
|
|
2742
|
-
username: options.username,
|
|
2743
2725
|
accountAddress: prepareResponse.accountAddress,
|
|
2744
2726
|
userId: prepareResponse.userId,
|
|
2745
2727
|
expiresAt: prepareResponse.expiresAt,
|
|
@@ -2758,7 +2740,6 @@ var OneAuthClient = class {
|
|
|
2758
2740
|
calls: JSON.stringify(intent.calls)
|
|
2759
2741
|
// No: transaction, intentOp, expiresAt, originMessages
|
|
2760
2742
|
})),
|
|
2761
|
-
username: options.username,
|
|
2762
2743
|
accountAddress: options.accountAddress,
|
|
2763
2744
|
telemetry: this.telemetryPayload(telemetry)
|
|
2764
2745
|
};
|
|
@@ -2783,7 +2764,6 @@ var OneAuthClient = class {
|
|
|
2783
2764
|
batchFailedIntents: prepareResponse.failedIntents,
|
|
2784
2765
|
challenge: prepareResponse.challenge,
|
|
2785
2766
|
binding: prepareResponse.binding,
|
|
2786
|
-
username: options.username,
|
|
2787
2767
|
accountAddress: prepareResponse.accountAddress,
|
|
2788
2768
|
userId: prepareResponse.userId,
|
|
2789
2769
|
expiresAt: prepareResponse.expiresAt,
|
|
@@ -3835,7 +3815,7 @@ var OneAuthClient = class {
|
|
|
3835
3815
|
* ```typescript
|
|
3836
3816
|
* // Sign a login challenge
|
|
3837
3817
|
* const result = await client.signMessage({
|
|
3838
|
-
*
|
|
3818
|
+
* accountAddress: '0x...',
|
|
3839
3819
|
* message: `Sign in to MyApp\nTimestamp: ${Date.now()}\nNonce: ${crypto.randomUUID()}`,
|
|
3840
3820
|
* description: 'Verify your identity to continue',
|
|
3841
3821
|
* });
|
|
@@ -3897,7 +3877,6 @@ var OneAuthClient = class {
|
|
|
3897
3877
|
mode: "iframe",
|
|
3898
3878
|
message: options.message,
|
|
3899
3879
|
challenge: options.challenge || options.message,
|
|
3900
|
-
username: options.username,
|
|
3901
3880
|
accountAddress: options.accountAddress,
|
|
3902
3881
|
description: options.description,
|
|
3903
3882
|
metadata: options.metadata,
|
|
@@ -3957,7 +3936,7 @@ var OneAuthClient = class {
|
|
|
3957
3936
|
* ```typescript
|
|
3958
3937
|
* // Sign an ERC-2612 Permit
|
|
3959
3938
|
* const result = await client.signTypedData({
|
|
3960
|
-
*
|
|
3939
|
+
* accountAddress: '0x...',
|
|
3961
3940
|
* domain: {
|
|
3962
3941
|
* name: 'Dai Stablecoin',
|
|
3963
3942
|
* version: '1',
|
|
@@ -4046,7 +4025,6 @@ var OneAuthClient = class {
|
|
|
4046
4025
|
message: options.message
|
|
4047
4026
|
},
|
|
4048
4027
|
challenge: signedHash,
|
|
4049
|
-
username: options.username,
|
|
4050
4028
|
accountAddress: options.accountAddress,
|
|
4051
4029
|
description: options.description,
|
|
4052
4030
|
telemetry: this.telemetryPayload(telemetry)
|
|
@@ -4311,11 +4289,14 @@ var OneAuthClient = class {
|
|
|
4311
4289
|
return this.fetchSigningResult(requestId);
|
|
4312
4290
|
}
|
|
4313
4291
|
/**
|
|
4314
|
-
* Fetch passkeys for a user from the auth provider
|
|
4292
|
+
* Fetch passkeys for a user from the auth provider.
|
|
4293
|
+
*
|
|
4294
|
+
* The account address is the sole identity; the backend `resolveUserWhere`
|
|
4295
|
+
* accepts an address as a globally-unique path identifier.
|
|
4315
4296
|
*/
|
|
4316
|
-
async getPasskeys(
|
|
4297
|
+
async getPasskeys(accountAddress) {
|
|
4317
4298
|
const response = await fetch(
|
|
4318
|
-
`${this.config.providerUrl}/api/users/${encodeURIComponent(
|
|
4299
|
+
`${this.config.providerUrl}/api/users/${encodeURIComponent(accountAddress)}/passkeys`,
|
|
4319
4300
|
{
|
|
4320
4301
|
headers: this.config.clientId ? { "x-client-id": this.config.clientId } : {}
|
|
4321
4302
|
}
|
|
@@ -4336,7 +4317,7 @@ var OneAuthClient = class {
|
|
|
4336
4317
|
* them by `requestId` without relying on URL parameters alone. This avoids
|
|
4337
4318
|
* exposing potentially large challenge payloads in query strings.
|
|
4338
4319
|
*
|
|
4339
|
-
* @param options - The signing options (challenge,
|
|
4320
|
+
* @param options - The signing options (challenge, accountAddress, description, etc.).
|
|
4340
4321
|
* @param mode - How the dialog will be opened (`"popup"`, `"redirect"`, or `"embed"`).
|
|
4341
4322
|
* @param redirectUrl - Only required for `"redirect"` mode; the URL the dialog
|
|
4342
4323
|
* will navigate back to after signing.
|
|
@@ -4353,7 +4334,6 @@ var OneAuthClient = class {
|
|
|
4353
4334
|
},
|
|
4354
4335
|
body: JSON.stringify({
|
|
4355
4336
|
...this.config.clientId && { clientId: this.config.clientId },
|
|
4356
|
-
username: options.username,
|
|
4357
4337
|
accountAddress: options.accountAddress,
|
|
4358
4338
|
challenge: options.challenge,
|
|
4359
4339
|
description: options.description,
|
|
@@ -4845,7 +4825,6 @@ var OneAuthClient = class {
|
|
|
4845
4825
|
success: true,
|
|
4846
4826
|
user: {
|
|
4847
4827
|
id: data.data?.user?.id,
|
|
4848
|
-
username: data.data?.username,
|
|
4849
4828
|
address: data.data?.address
|
|
4850
4829
|
},
|
|
4851
4830
|
signerType: data.data?.signerType ?? "passkey"
|
|
@@ -4899,7 +4878,6 @@ var OneAuthClient = class {
|
|
|
4899
4878
|
success: true,
|
|
4900
4879
|
user: {
|
|
4901
4880
|
id: data.data?.user?.id,
|
|
4902
|
-
username: data.data?.username,
|
|
4903
4881
|
address: data.data?.address
|
|
4904
4882
|
},
|
|
4905
4883
|
signerType: data.data?.signerType ?? "passkey"
|
|
@@ -4931,7 +4909,7 @@ var OneAuthClient = class {
|
|
|
4931
4909
|
*
|
|
4932
4910
|
* The connect flow is a lightweight "are you still you?" confirmation that
|
|
4933
4911
|
* does not require a new passkey ceremony. On success, the dialog returns the
|
|
4934
|
-
* user's
|
|
4912
|
+
* user's address and an `autoConnected` flag indicating whether the
|
|
4935
4913
|
* user had previously enabled auto-connect (in which case no UI was shown).
|
|
4936
4914
|
*
|
|
4937
4915
|
* On failure with `action: "switch"`, the caller should redirect to the full
|
|
@@ -4955,7 +4933,6 @@ var OneAuthClient = class {
|
|
|
4955
4933
|
resolve({
|
|
4956
4934
|
success: true,
|
|
4957
4935
|
user: {
|
|
4958
|
-
username: data.data?.username,
|
|
4959
4936
|
address: data.data?.address
|
|
4960
4937
|
},
|
|
4961
4938
|
autoConnected: data.data?.autoConnected
|
|
@@ -5333,7 +5310,7 @@ import {
|
|
|
5333
5310
|
} from "viem";
|
|
5334
5311
|
import { toAccount } from "viem/accounts";
|
|
5335
5312
|
function createPasskeyAccount(client, params) {
|
|
5336
|
-
const { address
|
|
5313
|
+
const { address } = params;
|
|
5337
5314
|
const normalizeMessage = (message) => {
|
|
5338
5315
|
if (typeof message === "string") return message;
|
|
5339
5316
|
const raw = message.raw;
|
|
@@ -5350,7 +5327,6 @@ function createPasskeyAccount(client, params) {
|
|
|
5350
5327
|
address,
|
|
5351
5328
|
signMessage: async ({ message }) => {
|
|
5352
5329
|
const result = await client.signMessage({
|
|
5353
|
-
username: username || void 0,
|
|
5354
5330
|
accountAddress: address,
|
|
5355
5331
|
message: normalizeMessage(message)
|
|
5356
5332
|
});
|
|
@@ -5386,7 +5362,6 @@ function createPasskeyAccount(client, params) {
|
|
|
5386
5362
|
])
|
|
5387
5363
|
);
|
|
5388
5364
|
const result = await client.signTypedData({
|
|
5389
|
-
username: username || void 0,
|
|
5390
5365
|
accountAddress: address,
|
|
5391
5366
|
domain,
|
|
5392
5367
|
types: normalizedTypes,
|
|
@@ -5401,7 +5376,6 @@ function createPasskeyAccount(client, params) {
|
|
|
5401
5376
|
});
|
|
5402
5377
|
return {
|
|
5403
5378
|
...account,
|
|
5404
|
-
...username ? { username } : {},
|
|
5405
5379
|
accountAddress: address
|
|
5406
5380
|
};
|
|
5407
5381
|
}
|
|
@@ -5415,7 +5389,6 @@ import {
|
|
|
5415
5389
|
import { toAccount as toAccount2 } from "viem/accounts";
|
|
5416
5390
|
function createPasskeyWalletClient(config) {
|
|
5417
5391
|
const identity = {
|
|
5418
|
-
...config.username ? { username: config.username } : {},
|
|
5419
5392
|
accountAddress: config.accountAddress
|
|
5420
5393
|
};
|
|
5421
5394
|
const provider = new OneAuthClient({
|
|
@@ -5510,7 +5483,6 @@ function createPasskeyWalletClient(config) {
|
|
|
5510
5483
|
abi: call.abi
|
|
5511
5484
|
}));
|
|
5512
5485
|
return {
|
|
5513
|
-
...config.username ? { username: config.username } : {},
|
|
5514
5486
|
accountAddress: config.accountAddress,
|
|
5515
5487
|
targetChain,
|
|
5516
5488
|
calls: intentCalls
|
|
@@ -5594,21 +5566,19 @@ function generateId() {
|
|
|
5594
5566
|
return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
5595
5567
|
}
|
|
5596
5568
|
function getStorageKey(identity) {
|
|
5597
|
-
const key = identity?.accountAddress
|
|
5569
|
+
const key = identity?.accountAddress;
|
|
5598
5570
|
return key ? `1auth_batch_queue_${key.toLowerCase()}` : "1auth_batch_queue_anonymous";
|
|
5599
5571
|
}
|
|
5600
5572
|
function resolveIdentity(passedIdentity, providerIdentity) {
|
|
5601
5573
|
if (typeof passedIdentity === "string") {
|
|
5602
|
-
return {
|
|
5574
|
+
return { accountAddress: passedIdentity };
|
|
5603
5575
|
}
|
|
5604
5576
|
return {
|
|
5605
|
-
username: passedIdentity?.username ?? providerIdentity.username,
|
|
5606
5577
|
accountAddress: passedIdentity?.accountAddress ?? providerIdentity.accountAddress
|
|
5607
5578
|
};
|
|
5608
5579
|
}
|
|
5609
5580
|
function BatchQueueProvider({
|
|
5610
5581
|
client,
|
|
5611
|
-
username,
|
|
5612
5582
|
accountAddress,
|
|
5613
5583
|
children
|
|
5614
5584
|
}) {
|
|
@@ -5617,8 +5587,8 @@ function BatchQueueProvider({
|
|
|
5617
5587
|
const [isSigning, setIsSigning] = React.useState(false);
|
|
5618
5588
|
const [animationTrigger, setAnimationTrigger] = React.useState(0);
|
|
5619
5589
|
const providerIdentity = React.useMemo(
|
|
5620
|
-
() => ({
|
|
5621
|
-
[
|
|
5590
|
+
() => ({ accountAddress }),
|
|
5591
|
+
[accountAddress]
|
|
5622
5592
|
);
|
|
5623
5593
|
const batchChainId = queue.length > 0 ? queue[0].targetChain : null;
|
|
5624
5594
|
React.useEffect(() => {
|
|
@@ -5684,14 +5654,14 @@ function BatchQueueProvider({
|
|
|
5684
5654
|
};
|
|
5685
5655
|
}
|
|
5686
5656
|
const signer = resolveIdentity(identity, providerIdentity);
|
|
5687
|
-
if (!signer.
|
|
5657
|
+
if (!signer.accountAddress) {
|
|
5688
5658
|
return {
|
|
5689
5659
|
success: false,
|
|
5690
5660
|
intentId: "",
|
|
5691
5661
|
status: "failed",
|
|
5692
5662
|
error: {
|
|
5693
5663
|
code: "MISSING_IDENTITY",
|
|
5694
|
-
message: "Batch signing requires an accountAddress
|
|
5664
|
+
message: "Batch signing requires an accountAddress"
|
|
5695
5665
|
}
|
|
5696
5666
|
};
|
|
5697
5667
|
}
|
|
@@ -5700,7 +5670,6 @@ function BatchQueueProvider({
|
|
|
5700
5670
|
setIsSigning(true);
|
|
5701
5671
|
try {
|
|
5702
5672
|
const result = await client.sendIntent({
|
|
5703
|
-
username: signer.username,
|
|
5704
5673
|
accountAddress: signer.accountAddress,
|
|
5705
5674
|
targetChain,
|
|
5706
5675
|
calls
|