decane-connect-kit 2.20.0 → 2.21.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/index.cjs +13 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -229,6 +229,8 @@ interface ConnectResult {
|
|
|
229
229
|
isNewUser: boolean;
|
|
230
230
|
/** Present when the provider released a profile — see {@link AuthProfile}. */
|
|
231
231
|
profile?: AuthProfile;
|
|
232
|
+
/** See {@link AuthResult.providerSubject}. */
|
|
233
|
+
providerSubject?: string;
|
|
232
234
|
}
|
|
233
235
|
/** A recorded on-chain transaction in the user's history. */
|
|
234
236
|
interface TransactionRecord {
|
|
@@ -547,6 +549,16 @@ interface AuthProfile {
|
|
|
547
549
|
name?: string;
|
|
548
550
|
email?: string;
|
|
549
551
|
picture?: string;
|
|
552
|
+
/**
|
|
553
|
+
* The handle the user signs in under, where the provider has one. X sets it
|
|
554
|
+
* and releases no email at all, so for those accounts this is the only
|
|
555
|
+
* human-readable thing there is.
|
|
556
|
+
*
|
|
557
|
+
* Display only. A handle can be released by its owner and registered by
|
|
558
|
+
* somebody else, so never key an account, a lookup or access on it — use
|
|
559
|
+
* {@link AuthResult.providerSubject}, which cannot move.
|
|
560
|
+
*/
|
|
561
|
+
username?: string;
|
|
550
562
|
}
|
|
551
563
|
interface AuthResult {
|
|
552
564
|
jwt: string;
|
|
@@ -554,6 +566,15 @@ interface AuthResult {
|
|
|
554
566
|
hasShare: boolean;
|
|
555
567
|
userId: string;
|
|
556
568
|
profile?: AuthProfile;
|
|
569
|
+
/**
|
|
570
|
+
* The provider's own stable id for this user — X's numeric user id, for
|
|
571
|
+
* instance. Present only where the provider gives one.
|
|
572
|
+
*
|
|
573
|
+
* Unlike a handle or an email this cannot be reassigned, which is what makes
|
|
574
|
+
* it safe to match an account against: the same value identifies the same
|
|
575
|
+
* person on both sides of a migration.
|
|
576
|
+
*/
|
|
577
|
+
providerSubject?: string;
|
|
557
578
|
}
|
|
558
579
|
|
|
559
580
|
declare class ApiClient {
|
|
@@ -1229,6 +1250,15 @@ interface SocialAuthState {
|
|
|
1229
1250
|
* you need it in that state.
|
|
1230
1251
|
*/
|
|
1231
1252
|
profile: AuthProfile | null;
|
|
1253
|
+
/**
|
|
1254
|
+
* The provider's own stable id for this user, where it gives one — X's
|
|
1255
|
+
* numeric user id, for instance. Null for providers that do not.
|
|
1256
|
+
*
|
|
1257
|
+
* Unlike a handle or an email this cannot be reassigned, so it is the value
|
|
1258
|
+
* to match an account against. Like `profile` it comes from the sign-in and
|
|
1259
|
+
* cannot be re-fetched, so copy it if you need it after a reload.
|
|
1260
|
+
*/
|
|
1261
|
+
providerSubject: string | null;
|
|
1232
1262
|
isUnlocked: boolean;
|
|
1233
1263
|
sessionExpiresAt: number | null;
|
|
1234
1264
|
/**
|
|
@@ -1322,6 +1352,7 @@ declare function useSocialAuth(): {
|
|
|
1322
1352
|
sessionExpiresAt: number | null;
|
|
1323
1353
|
canUsePasskey: boolean;
|
|
1324
1354
|
profile: AuthProfile | null;
|
|
1355
|
+
providerSubject: string | null;
|
|
1325
1356
|
phase: "creating" | "unlocking" | null;
|
|
1326
1357
|
isCreatingWallet: boolean;
|
|
1327
1358
|
needsReconnect: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -229,6 +229,8 @@ interface ConnectResult {
|
|
|
229
229
|
isNewUser: boolean;
|
|
230
230
|
/** Present when the provider released a profile — see {@link AuthProfile}. */
|
|
231
231
|
profile?: AuthProfile;
|
|
232
|
+
/** See {@link AuthResult.providerSubject}. */
|
|
233
|
+
providerSubject?: string;
|
|
232
234
|
}
|
|
233
235
|
/** A recorded on-chain transaction in the user's history. */
|
|
234
236
|
interface TransactionRecord {
|
|
@@ -547,6 +549,16 @@ interface AuthProfile {
|
|
|
547
549
|
name?: string;
|
|
548
550
|
email?: string;
|
|
549
551
|
picture?: string;
|
|
552
|
+
/**
|
|
553
|
+
* The handle the user signs in under, where the provider has one. X sets it
|
|
554
|
+
* and releases no email at all, so for those accounts this is the only
|
|
555
|
+
* human-readable thing there is.
|
|
556
|
+
*
|
|
557
|
+
* Display only. A handle can be released by its owner and registered by
|
|
558
|
+
* somebody else, so never key an account, a lookup or access on it — use
|
|
559
|
+
* {@link AuthResult.providerSubject}, which cannot move.
|
|
560
|
+
*/
|
|
561
|
+
username?: string;
|
|
550
562
|
}
|
|
551
563
|
interface AuthResult {
|
|
552
564
|
jwt: string;
|
|
@@ -554,6 +566,15 @@ interface AuthResult {
|
|
|
554
566
|
hasShare: boolean;
|
|
555
567
|
userId: string;
|
|
556
568
|
profile?: AuthProfile;
|
|
569
|
+
/**
|
|
570
|
+
* The provider's own stable id for this user — X's numeric user id, for
|
|
571
|
+
* instance. Present only where the provider gives one.
|
|
572
|
+
*
|
|
573
|
+
* Unlike a handle or an email this cannot be reassigned, which is what makes
|
|
574
|
+
* it safe to match an account against: the same value identifies the same
|
|
575
|
+
* person on both sides of a migration.
|
|
576
|
+
*/
|
|
577
|
+
providerSubject?: string;
|
|
557
578
|
}
|
|
558
579
|
|
|
559
580
|
declare class ApiClient {
|
|
@@ -1229,6 +1250,15 @@ interface SocialAuthState {
|
|
|
1229
1250
|
* you need it in that state.
|
|
1230
1251
|
*/
|
|
1231
1252
|
profile: AuthProfile | null;
|
|
1253
|
+
/**
|
|
1254
|
+
* The provider's own stable id for this user, where it gives one — X's
|
|
1255
|
+
* numeric user id, for instance. Null for providers that do not.
|
|
1256
|
+
*
|
|
1257
|
+
* Unlike a handle or an email this cannot be reassigned, so it is the value
|
|
1258
|
+
* to match an account against. Like `profile` it comes from the sign-in and
|
|
1259
|
+
* cannot be re-fetched, so copy it if you need it after a reload.
|
|
1260
|
+
*/
|
|
1261
|
+
providerSubject: string | null;
|
|
1232
1262
|
isUnlocked: boolean;
|
|
1233
1263
|
sessionExpiresAt: number | null;
|
|
1234
1264
|
/**
|
|
@@ -1322,6 +1352,7 @@ declare function useSocialAuth(): {
|
|
|
1322
1352
|
sessionExpiresAt: number | null;
|
|
1323
1353
|
canUsePasskey: boolean;
|
|
1324
1354
|
profile: AuthProfile | null;
|
|
1355
|
+
providerSubject: string | null;
|
|
1325
1356
|
phase: "creating" | "unlocking" | null;
|
|
1326
1357
|
isCreatingWallet: boolean;
|
|
1327
1358
|
needsReconnect: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1956,10 +1956,13 @@ function readRedirectOutcome(search) {
|
|
|
1956
1956
|
const name = params.get("decane_name");
|
|
1957
1957
|
const email = params.get("decane_email");
|
|
1958
1958
|
const picture = params.get("decane_picture");
|
|
1959
|
+
const username = params.get("decane_username");
|
|
1960
|
+
const providerSubject = params.get("decane_provider_subject");
|
|
1959
1961
|
const profile = {
|
|
1960
1962
|
...name ? { name } : {},
|
|
1961
1963
|
...email ? { email } : {},
|
|
1962
|
-
...picture ? { picture } : {}
|
|
1964
|
+
...picture ? { picture } : {},
|
|
1965
|
+
...username ? { username } : {}
|
|
1963
1966
|
};
|
|
1964
1967
|
return {
|
|
1965
1968
|
kind: "result",
|
|
@@ -1972,7 +1975,8 @@ function readRedirectOutcome(search) {
|
|
|
1972
1975
|
// test `result.profile` rather than an object that is always present but
|
|
1973
1976
|
// sometimes empty. X never sends an email, so this is the normal case
|
|
1974
1977
|
// there rather than an edge one.
|
|
1975
|
-
...Object.keys(profile).length ? { profile } : {}
|
|
1978
|
+
...Object.keys(profile).length ? { profile } : {},
|
|
1979
|
+
...providerSubject ? { providerSubject } : {}
|
|
1976
1980
|
}
|
|
1977
1981
|
};
|
|
1978
1982
|
}
|
|
@@ -4368,7 +4372,8 @@ async function createDecaneConnect(config) {
|
|
|
4368
4372
|
return {
|
|
4369
4373
|
addresses,
|
|
4370
4374
|
isNewUser: result.isNewUser,
|
|
4371
|
-
...result.profile ? { profile: result.profile } : {}
|
|
4375
|
+
...result.profile ? { profile: result.profile } : {},
|
|
4376
|
+
...result.providerSubject ? { providerSubject: result.providerSubject } : {}
|
|
4372
4377
|
};
|
|
4373
4378
|
}
|
|
4374
4379
|
const client = {
|
|
@@ -7188,6 +7193,7 @@ var DEFAULT_SOCIAL = {
|
|
|
7188
7193
|
addresses: null,
|
|
7189
7194
|
isNewUser: false,
|
|
7190
7195
|
profile: null,
|
|
7196
|
+
providerSubject: null,
|
|
7191
7197
|
isUnlocked: false,
|
|
7192
7198
|
sessionExpiresAt: null,
|
|
7193
7199
|
needsReconnect: false,
|
|
@@ -7323,6 +7329,7 @@ function DecaneKit({ config, children }) {
|
|
|
7323
7329
|
addresses: result.addresses,
|
|
7324
7330
|
isNewUser: result.isNewUser,
|
|
7325
7331
|
profile: result.profile ?? null,
|
|
7332
|
+
providerSubject: result.providerSubject ?? null,
|
|
7326
7333
|
isUnlocked: sdk?.isUnlocked() ?? false,
|
|
7327
7334
|
sessionExpiresAt: sdk?.sessionExpiresAt() ?? null,
|
|
7328
7335
|
needsReconnect: false,
|
|
@@ -7855,6 +7862,9 @@ function useSocialAuth() {
|
|
|
7855
7862
|
// user first signed in, so it carries the same name and email a Google
|
|
7856
7863
|
// sign-in does rather than coming back anonymous.
|
|
7857
7864
|
profile: socialAuth.profile,
|
|
7865
|
+
// The provider's stable id, where it gives one. Null otherwise. Safe to
|
|
7866
|
+
// match an account on, unlike the handle in `profile.username`.
|
|
7867
|
+
providerSubject: socialAuth.providerSubject,
|
|
7858
7868
|
// Long-running work in progress, for driving your own status UI.
|
|
7859
7869
|
phase: socialAuth.phase,
|
|
7860
7870
|
isCreatingWallet: socialAuth.phase === "creating",
|