decane-connect-kit 2.6.1 → 2.7.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 +19 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +19 -3
- 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>;
|
|
@@ -1210,4 +1229,4 @@ declare function useSignTypedData(): {
|
|
|
1210
1229
|
reset: () => void;
|
|
1211
1230
|
};
|
|
1212
1231
|
|
|
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 };
|
|
1232
|
+
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>;
|
|
@@ -1210,4 +1229,4 @@ declare function useSignTypedData(): {
|
|
|
1210
1229
|
reset: () => void;
|
|
1211
1230
|
};
|
|
1212
1231
|
|
|
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 };
|
|
1232
|
+
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
|
@@ -2833,7 +2833,7 @@ function buildAuthUrl(clientId, scopes) {
|
|
|
2833
2833
|
return url.toString();
|
|
2834
2834
|
}
|
|
2835
2835
|
function loginWithKingsChatPopup(opts) {
|
|
2836
|
-
const scopes = opts.scopes ?? ["
|
|
2836
|
+
const scopes = opts.scopes ?? ["profile"];
|
|
2837
2837
|
const popup = window.open(
|
|
2838
2838
|
buildAuthUrl(opts.clientId, scopes),
|
|
2839
2839
|
"decane-kingschat",
|
|
@@ -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);
|