decane-connect-kit 2.6.2 → 2.7.1
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 +20 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +20 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -476,6 +476,8 @@ interface ConnectResult {
|
|
|
476
476
|
tron?: string;
|
|
477
477
|
};
|
|
478
478
|
isNewUser: boolean;
|
|
479
|
+
/** Present when the provider released a profile — see {@link AuthProfile}. */
|
|
480
|
+
profile?: AuthProfile;
|
|
479
481
|
}
|
|
480
482
|
/** A recorded on-chain transaction in the user's history. */
|
|
481
483
|
interface TransactionRecord {
|
|
@@ -701,11 +703,28 @@ interface WrappedShareMeta {
|
|
|
701
703
|
pinSalt?: string;
|
|
702
704
|
pinIterations?: number;
|
|
703
705
|
}
|
|
706
|
+
/**
|
|
707
|
+
* Who the user is, as the identity provider just described them.
|
|
708
|
+
*
|
|
709
|
+
* Passed through from the provider at sign-in and never stored by Decane — the
|
|
710
|
+
* backend keeps only an HMAC and a masked identifier, so there is no profile to
|
|
711
|
+
* look up later. Cache what you need at sign-in if you want to show a name
|
|
712
|
+
* after a page reload.
|
|
713
|
+
*
|
|
714
|
+
* Every field is optional because providers differ in what they release, and a
|
|
715
|
+
* user can withhold most of it. Email sign-in returns an empty profile.
|
|
716
|
+
*/
|
|
717
|
+
interface AuthProfile {
|
|
718
|
+
name?: string;
|
|
719
|
+
email?: string;
|
|
720
|
+
picture?: string;
|
|
721
|
+
}
|
|
704
722
|
interface AuthResult {
|
|
705
723
|
jwt: string;
|
|
706
724
|
isNewUser: boolean;
|
|
707
725
|
hasShare: boolean;
|
|
708
726
|
userId: string;
|
|
727
|
+
profile?: AuthProfile;
|
|
709
728
|
}
|
|
710
729
|
|
|
711
730
|
declare function createDecaneConnect(config: DecaneConnectConfig): Promise<DecaneConnect>;
|
|
@@ -951,6 +970,15 @@ interface SocialAuthState {
|
|
|
951
970
|
tron?: string;
|
|
952
971
|
} | null;
|
|
953
972
|
isNewUser: boolean;
|
|
973
|
+
/**
|
|
974
|
+
* Who the provider said the user is — `{ name?, email?, picture? }`.
|
|
975
|
+
*
|
|
976
|
+
* `null` until a sign-in returns one, and stays null for email sign-in and
|
|
977
|
+
* for providers the user withheld a profile from. It is not persisted across
|
|
978
|
+
* reloads: the backend stores no profile, so a restored session has an
|
|
979
|
+
* address but no name. Copy it somewhere durable if you need it to survive.
|
|
980
|
+
*/
|
|
981
|
+
profile: AuthProfile | null;
|
|
954
982
|
isUnlocked: boolean;
|
|
955
983
|
sessionExpiresAt: number | null;
|
|
956
984
|
/**
|
|
@@ -1210,4 +1238,4 @@ declare function useSignTypedData(): {
|
|
|
1210
1238
|
reset: () => void;
|
|
1211
1239
|
};
|
|
1212
1240
|
|
|
1213
|
-
export { type ActiveSession, AttestationError, type AuthResult, BUILT_IN_CHAINS, type BalanceResult, type CAIP25Method, type CAIP25SessionRequest, type CAIP25SessionResult, CHAINS, CallSequenceError, type Chain, type ChainDescriptor, type ChainId, type ChainScope, type ChainSupport, type ChainType, type ConnectMode, type ConnectResult, type DecaneConfig, type DecaneConnect, type DecaneConnectConfig, DecaneConnectError, DecaneError, DecaneErrorCode, DecaneKit, DecaneLogo, DecaneMark, type DecaneProvider, DecaneWordmark, type Eip1193Provider, type EthereumProviderOptions, ExportNotAuthorizedError, InvalidApiKeyError, InvalidPinError, InvalidRecoveryFileError, type KingsChatTokens, NetworkError, NewDeviceError, OriginNotAllowedError, type PortableBackup, PromptPinNotConfiguredError, ReconnectRequiredError, type RecordTransactionInput, RecoveryFailedError, type RecoveryProgress, type RecoveryShareFile, RecoveryWalletMismatchError, type SdkEvent, type SendTransactionRequest, SessionExpiredError, ShareCorruptedError, type SignMessageRequest, type SignTypedDataRequest, type SignedAuthorization, type SocialAuthState, type SocialConfig, SocialWalletModal, StaleDeviceShareError, type Theme, type TransactionRecord, type TxParams, type UnifiedWalletAccount, UnlockRequiredError, UserCancelledError, WalletSelector, WebAuthnNotSupportedError, type WrappedShareMeta, WrongPasswordError, createDecane, createDecaneConnect, createEthereumProvider, loginWithKingsChatPopup, startEmailAuth, useChainSwitch, useDecane, useEthereumProvider, useSendTransaction, useSignMessage, useSignTypedData, useSocialAuth, useSocialBalance, useSocialWallet, useWalletSelector, verifyEmailCode };
|
|
1241
|
+
export { type ActiveSession, AttestationError, type AuthProfile, type AuthResult, BUILT_IN_CHAINS, type BalanceResult, type CAIP25Method, type CAIP25SessionRequest, type CAIP25SessionResult, CHAINS, CallSequenceError, type Chain, type ChainDescriptor, type ChainId, type ChainScope, type ChainSupport, type ChainType, type ConnectMode, type ConnectResult, type DecaneConfig, type DecaneConnect, type DecaneConnectConfig, DecaneConnectError, DecaneError, DecaneErrorCode, DecaneKit, DecaneLogo, DecaneMark, type DecaneProvider, DecaneWordmark, type Eip1193Provider, type EthereumProviderOptions, ExportNotAuthorizedError, InvalidApiKeyError, InvalidPinError, InvalidRecoveryFileError, type KingsChatTokens, NetworkError, NewDeviceError, OriginNotAllowedError, type PortableBackup, PromptPinNotConfiguredError, ReconnectRequiredError, type RecordTransactionInput, RecoveryFailedError, type RecoveryProgress, type RecoveryShareFile, RecoveryWalletMismatchError, type SdkEvent, type SendTransactionRequest, SessionExpiredError, ShareCorruptedError, type SignMessageRequest, type SignTypedDataRequest, type SignedAuthorization, type SocialAuthState, type SocialConfig, SocialWalletModal, StaleDeviceShareError, type Theme, type TransactionRecord, type TxParams, type UnifiedWalletAccount, UnlockRequiredError, UserCancelledError, WalletSelector, WebAuthnNotSupportedError, type WrappedShareMeta, WrongPasswordError, createDecane, createDecaneConnect, createEthereumProvider, loginWithKingsChatPopup, startEmailAuth, useChainSwitch, useDecane, useEthereumProvider, useSendTransaction, useSignMessage, useSignTypedData, useSocialAuth, useSocialBalance, useSocialWallet, useWalletSelector, verifyEmailCode };
|
package/dist/index.d.ts
CHANGED
|
@@ -476,6 +476,8 @@ interface ConnectResult {
|
|
|
476
476
|
tron?: string;
|
|
477
477
|
};
|
|
478
478
|
isNewUser: boolean;
|
|
479
|
+
/** Present when the provider released a profile — see {@link AuthProfile}. */
|
|
480
|
+
profile?: AuthProfile;
|
|
479
481
|
}
|
|
480
482
|
/** A recorded on-chain transaction in the user's history. */
|
|
481
483
|
interface TransactionRecord {
|
|
@@ -701,11 +703,28 @@ interface WrappedShareMeta {
|
|
|
701
703
|
pinSalt?: string;
|
|
702
704
|
pinIterations?: number;
|
|
703
705
|
}
|
|
706
|
+
/**
|
|
707
|
+
* Who the user is, as the identity provider just described them.
|
|
708
|
+
*
|
|
709
|
+
* Passed through from the provider at sign-in and never stored by Decane — the
|
|
710
|
+
* backend keeps only an HMAC and a masked identifier, so there is no profile to
|
|
711
|
+
* look up later. Cache what you need at sign-in if you want to show a name
|
|
712
|
+
* after a page reload.
|
|
713
|
+
*
|
|
714
|
+
* Every field is optional because providers differ in what they release, and a
|
|
715
|
+
* user can withhold most of it. Email sign-in returns an empty profile.
|
|
716
|
+
*/
|
|
717
|
+
interface AuthProfile {
|
|
718
|
+
name?: string;
|
|
719
|
+
email?: string;
|
|
720
|
+
picture?: string;
|
|
721
|
+
}
|
|
704
722
|
interface AuthResult {
|
|
705
723
|
jwt: string;
|
|
706
724
|
isNewUser: boolean;
|
|
707
725
|
hasShare: boolean;
|
|
708
726
|
userId: string;
|
|
727
|
+
profile?: AuthProfile;
|
|
709
728
|
}
|
|
710
729
|
|
|
711
730
|
declare function createDecaneConnect(config: DecaneConnectConfig): Promise<DecaneConnect>;
|
|
@@ -951,6 +970,15 @@ interface SocialAuthState {
|
|
|
951
970
|
tron?: string;
|
|
952
971
|
} | null;
|
|
953
972
|
isNewUser: boolean;
|
|
973
|
+
/**
|
|
974
|
+
* Who the provider said the user is — `{ name?, email?, picture? }`.
|
|
975
|
+
*
|
|
976
|
+
* `null` until a sign-in returns one, and stays null for email sign-in and
|
|
977
|
+
* for providers the user withheld a profile from. It is not persisted across
|
|
978
|
+
* reloads: the backend stores no profile, so a restored session has an
|
|
979
|
+
* address but no name. Copy it somewhere durable if you need it to survive.
|
|
980
|
+
*/
|
|
981
|
+
profile: AuthProfile | null;
|
|
954
982
|
isUnlocked: boolean;
|
|
955
983
|
sessionExpiresAt: number | null;
|
|
956
984
|
/**
|
|
@@ -1210,4 +1238,4 @@ declare function useSignTypedData(): {
|
|
|
1210
1238
|
reset: () => void;
|
|
1211
1239
|
};
|
|
1212
1240
|
|
|
1213
|
-
export { type ActiveSession, AttestationError, type AuthResult, BUILT_IN_CHAINS, type BalanceResult, type CAIP25Method, type CAIP25SessionRequest, type CAIP25SessionResult, CHAINS, CallSequenceError, type Chain, type ChainDescriptor, type ChainId, type ChainScope, type ChainSupport, type ChainType, type ConnectMode, type ConnectResult, type DecaneConfig, type DecaneConnect, type DecaneConnectConfig, DecaneConnectError, DecaneError, DecaneErrorCode, DecaneKit, DecaneLogo, DecaneMark, type DecaneProvider, DecaneWordmark, type Eip1193Provider, type EthereumProviderOptions, ExportNotAuthorizedError, InvalidApiKeyError, InvalidPinError, InvalidRecoveryFileError, type KingsChatTokens, NetworkError, NewDeviceError, OriginNotAllowedError, type PortableBackup, PromptPinNotConfiguredError, ReconnectRequiredError, type RecordTransactionInput, RecoveryFailedError, type RecoveryProgress, type RecoveryShareFile, RecoveryWalletMismatchError, type SdkEvent, type SendTransactionRequest, SessionExpiredError, ShareCorruptedError, type SignMessageRequest, type SignTypedDataRequest, type SignedAuthorization, type SocialAuthState, type SocialConfig, SocialWalletModal, StaleDeviceShareError, type Theme, type TransactionRecord, type TxParams, type UnifiedWalletAccount, UnlockRequiredError, UserCancelledError, WalletSelector, WebAuthnNotSupportedError, type WrappedShareMeta, WrongPasswordError, createDecane, createDecaneConnect, createEthereumProvider, loginWithKingsChatPopup, startEmailAuth, useChainSwitch, useDecane, useEthereumProvider, useSendTransaction, useSignMessage, useSignTypedData, useSocialAuth, useSocialBalance, useSocialWallet, useWalletSelector, verifyEmailCode };
|
|
1241
|
+
export { type ActiveSession, AttestationError, type AuthProfile, type AuthResult, BUILT_IN_CHAINS, type BalanceResult, type CAIP25Method, type CAIP25SessionRequest, type CAIP25SessionResult, CHAINS, CallSequenceError, type Chain, type ChainDescriptor, type ChainId, type ChainScope, type ChainSupport, type ChainType, type ConnectMode, type ConnectResult, type DecaneConfig, type DecaneConnect, type DecaneConnectConfig, DecaneConnectError, DecaneError, DecaneErrorCode, DecaneKit, DecaneLogo, DecaneMark, type DecaneProvider, DecaneWordmark, type Eip1193Provider, type EthereumProviderOptions, ExportNotAuthorizedError, InvalidApiKeyError, InvalidPinError, InvalidRecoveryFileError, type KingsChatTokens, NetworkError, NewDeviceError, OriginNotAllowedError, type PortableBackup, PromptPinNotConfiguredError, ReconnectRequiredError, type RecordTransactionInput, RecoveryFailedError, type RecoveryProgress, type RecoveryShareFile, RecoveryWalletMismatchError, type SdkEvent, type SendTransactionRequest, SessionExpiredError, ShareCorruptedError, type SignMessageRequest, type SignTypedDataRequest, type SignedAuthorization, type SocialAuthState, type SocialConfig, SocialWalletModal, StaleDeviceShareError, type Theme, type TransactionRecord, type TxParams, type UnifiedWalletAccount, UnlockRequiredError, UserCancelledError, WalletSelector, WebAuthnNotSupportedError, type WrappedShareMeta, WrongPasswordError, createDecane, createDecaneConnect, createEthereumProvider, loginWithKingsChatPopup, startEmailAuth, useChainSwitch, useDecane, useEthereumProvider, useSendTransaction, useSignMessage, useSignTypedData, useSocialAuth, useSocialBalance, useSocialWallet, useWalletSelector, verifyEmailCode };
|
package/dist/index.js
CHANGED
|
@@ -3837,7 +3837,11 @@ async function createDecaneConnect(config) {
|
|
|
3837
3837
|
savePersisted(PERSIST_KEY, persisted);
|
|
3838
3838
|
events.emit("connected");
|
|
3839
3839
|
persistLiveSession();
|
|
3840
|
-
return {
|
|
3840
|
+
return {
|
|
3841
|
+
addresses,
|
|
3842
|
+
isNewUser: result.isNewUser,
|
|
3843
|
+
...result.profile ? { profile: result.profile } : {}
|
|
3844
|
+
};
|
|
3841
3845
|
}
|
|
3842
3846
|
const client = {
|
|
3843
3847
|
async connect() {
|
|
@@ -3872,11 +3876,23 @@ async function createDecaneConnect(config) {
|
|
|
3872
3876
|
throw new CallSequenceError(`Google sign-in failed: ${decaneError}`);
|
|
3873
3877
|
}
|
|
3874
3878
|
if (decaneJwt) {
|
|
3879
|
+
const name = params.get("decane_name");
|
|
3880
|
+
const email = params.get("decane_email");
|
|
3881
|
+
const picture = params.get("decane_picture");
|
|
3882
|
+
const profile = {
|
|
3883
|
+
...name ? { name } : {},
|
|
3884
|
+
...email ? { email } : {},
|
|
3885
|
+
...picture ? { picture } : {}
|
|
3886
|
+
};
|
|
3875
3887
|
const result = {
|
|
3876
3888
|
jwt: decaneJwt,
|
|
3877
3889
|
userId: params.get("decane_user_id") ?? "",
|
|
3878
3890
|
isNewUser: params.get("decane_is_new_user") === "true",
|
|
3879
|
-
hasShare: params.get("decane_has_share") === "true"
|
|
3891
|
+
hasShare: params.get("decane_has_share") === "true",
|
|
3892
|
+
// Omitted entirely when Google released nothing, so callers can test
|
|
3893
|
+
// `result.profile` rather than an object that is always present but
|
|
3894
|
+
// sometimes empty.
|
|
3895
|
+
...Object.keys(profile).length ? { profile } : {}
|
|
3880
3896
|
};
|
|
3881
3897
|
window.history.replaceState({}, "", window.location.pathname);
|
|
3882
3898
|
return handleAuthResult(result);
|
|
@@ -6152,6 +6168,7 @@ function WalletStatusOverlay({
|
|
|
6152
6168
|
var DEFAULT_SOCIAL = {
|
|
6153
6169
|
addresses: null,
|
|
6154
6170
|
isNewUser: false,
|
|
6171
|
+
profile: null,
|
|
6155
6172
|
isUnlocked: false,
|
|
6156
6173
|
sessionExpiresAt: null,
|
|
6157
6174
|
needsReconnect: false,
|
|
@@ -6265,6 +6282,7 @@ function DecaneKit({ config, children }) {
|
|
|
6265
6282
|
setSocialAuth({
|
|
6266
6283
|
addresses: result.addresses,
|
|
6267
6284
|
isNewUser: result.isNewUser,
|
|
6285
|
+
profile: result.profile ?? null,
|
|
6268
6286
|
isUnlocked: sdk?.isUnlocked() ?? false,
|
|
6269
6287
|
sessionExpiresAt: sdk?.sessionExpiresAt() ?? null,
|
|
6270
6288
|
needsReconnect: false,
|