Note:The Web and Mobile SDKs preserve the user keyshare with the individual, giving
them complete control. You must use the SDKs with the user-controlled wallet
product. Additionally, the Web and Mobile SDKs support only the user-controlled
wallet product.
Install the SDKs
Install using npm:Shell
SDK architecture
You must use Web, iOS, or Android SDKs to access the user-controlled Programmable Wallet product. The SDK secures, manages, and communicates with your server to ensure your user’s keyshare, always stays with them and is not exposed to your servers. To learn more, see SDK Architecture for User-Controlled Wallets.SDK API references: enums
The Web SDK supports the API reference enums listed in the following sections.ChallengeType
Enumerates the types of challenges supported.Javascript
ChallengeStatus
Enumerates the possible status for a challenge.Javascript
QuestionType
Enumerates the types of security questions.Javascript
ErrorCode
Enumerates the types of error code.Javascript
SDK API references: interfaces
The Web SDK supports the interfaces listed in the following sections.Configs
appSettings<AppSettings> Application settings objectauthentication<Authentication> Authentication objectsocialLoginConfig<SocialLoginConfig> Social login configuration object
AppSettings
Holds application settings.appId<string> Application ID, retrieved from Circle Developer Services Console
Authentication
Holds authentication information.LoginConfigs
Holds login configuration information.google<object> | undefined (optional) Configuration object for Google login.clientId<string> Client ID for Google loginredirectUri<string> Redirect URI for Google loginselectAccountPrompt<boolean> | undefined Turn on/off the Google prompt for account selection
facebook<object> | undefined Configuration for Facebook login.apple<FirebaseOptions> | undefined (optional) Configuration for Apple login, using Firebase.deviceToken<string> Token used to identify the devicedeviceEncryptionKey<string> Encryption key used for the deviceotpToken<string> | undefined (optional) OTP token for verification
Definitions
- google: Configuration object for Google login.
- clientId: The Client ID for Google login.
- redirectUri: The Redirect URI for Google login.
- selectAccountPrompt: Whether to prompt the user to select an account
when signing in.
Learn more about how prompt works in the Google OAuth API documentation (keyword: prompt).
- facebook: Configuration object for Facebook login.
- appId: The App ID for Facebook login.
- redirectUri: The Redirect URI for Facebook login.
- apple: Configuration for Apple login, using Firebase.
- FirebaseOptions: The Firebase configuration object.
- deviceToken: The token used to identify the device.
- deviceEncryptionKey: The encryption key used for the device.
- otpToken: The optional OTP token for verification.
SocialLoginProvider
APPLE<string> Apple login providerFACEBOOK<string> Facebook login providerGOOGLE<string> Google login provider
Challenge
Holds information about a challenge.challengeId<string> Challenge Id
ChallengeResult
Holds the result of a challenge.type<ChallengeType> Challenge typestatus<ChallengeStatus> Challenge statusdata<SignMessageResult | undefined> Sign message response
SignMessageResult
Holds the result of a sign message or sign typed-data challenge.signature<string> Signature result after signing
SignTransactionResult
Holds the result of a sign transaction challenge.signature<string> Signature result after signingtxHash<string> Transaction hashsignedTransaction<string> Signed transaction
SocialLoginResult
Holds the result of a social login.- userToken <string> User token
- encryptionKey <string> Encryption key
- refreshToken <string> Refresh token
- oAuthInfo <object> OAuth information
EmailLoginResult
Holds the result of an email login.- userToken <string> User token
- encryptionKey <string> Encryption key
- refreshToken <string> Refresh token
OauthInfo
Holds the OAuth information.- provider <SocialLoginProvider> Social login
- scope <string[]> OAuth scope
- socialUserUUID <string> Social user UUID
- socialUserInfo <object> Social user information
Error
Holds error information.code<integer | undefined> Internal error codemessage<string> Error message
SocialLoginCompleteCallback
Callback function for social login completion.error<Error> Presents if error occursresult<SocialLoginResult> | /<EmailLoginResult> | undefined > Presents and contains the result of the social login when the login is completed
SecurityQuestion
Holds information about a custom security question.question<string> Custom security questiontype<QuestionType> Type of the question
Localizations
Holds localization settings.common<Common | undefined> The settings for common textsconfirmInitPincode<ConfirmPincode | undefined> The settings forConfirmInitPincodescreenconfirmNewPincode<ConfirmPincode | undefined> The settings forConfirmNewPincodescreenenterPincode<EnterPincode | undefined> The settings forEnterPincodescreeninitPincode<NewPincode | undefined> The settings forInitPincodescreennewPincode<NewPincode | undefined> The settings forNewPincodescreenrecoverPincode<RecoverPincode | undefined> The settings forRecoverPincodescreensecurityConfirm<SecurityConfirm | undefined> The settings forSecurityConfirmscreensecurityIntros<SecurityIntros | undefined> The settings forSecurityIntrosscreensecurityQuestions<SecurityQuestions | undefined> The settings forSecurityQuestionsscreensecuritySummary<SecuritySummary | undefined> The settings forSecuritySummaryscreensocialEmailConfirmationUI<SocialEmailConfirmationUI | undefined> The settings forsocialEmailConfirmationUIscreen
Common
Holds localization settings for common texts.continue<string | undefined> Continue textshowPin<string | undefined> Show pin texthidePin<string | undefined> Hide pin textconfirm<string | undefined> Confirm text
ConfirmPincode
Holds localization settings forConfirmInitPincode or ConfirmNewPincode
screen.
headline<string | undefined> Headline textheadline2<string | undefined> Headline text 2subhead<string | undefined> Subhead text
EnterPincode
Holds localization settings forEnterPincode screen.
headline<string | undefined> Headline textheadline2<string | undefined> Headline text 2subhead<string | undefined> Subhead textforgotPin<string | undefined> Forgot pin text
NewPincode
Holds localization settings forInitPincode or NewPincode screen.
headline<string | undefined> Headline textheadline2<string | undefined> Headline text 2subhead<string | undefined> Subhead text
RecoverPincode
Holds localization settings forRecoverPincode screen.
headline<string | undefined> Headline textheadline2<string | undefined> Headline text 2subhead<string | undefined> Subhead textanswerInputHeader<string | undefined> Answer input header textanswerInputPlaceholder<string | undefined> Answer input placeholder text
SecurityConfirm
Holds localization settings forSecurityConfirm screen.
title<string | undefined> Title textheadline<string | undefined> Headline textinputHeadline<string | undefined> Input headline textinputPlaceholder<string | undefined> Input placeholder textinputMatch<string | undefined> Input match text
SecurityIntros
Holds localization settings forSecurityIntros screen.
headline<string | undefined> Headline textheadline2<string | undefined> Headline text 2description<string | undefined> Description textlink<string | undefined> Link text
SecurityQuestions
Holds localization settings forSecurityQuestions screen.
title<string | undefined> Title textquestionHeader<string | undefined> Question header textquestionPlaceholder<string | undefined> Question placeholder textrequiredMark<string | undefined> Required mark textanswerHeader<string | undefined> Answer header textanswerPlaceholder<string | undefined> Answer placeholder textanswerHintHeader<string | undefined> Answer hint header textanswerHintPlaceholder<string | undefined> Answer hint placeholder text
SecuritySummary
Holds localization settings forSecuritySummary screen.
title<string | undefined> Title textquestion<string | undefined> Question text
SocialEmailConfirmationUI
Holds localization settings forSocialEmailConfirmationUI screen.
title<string | undefined> Title textheadline<string | undefined> Headline text
TransactionRequest
Holds localization settings forTransactionRequest screen.
title<string | undefined> Title textsubtitle<string | undefined> Subtitle textmainCurrency<object | undefined> Main currency details:amount<string | number | undefined> Main currency amountsymbol<string | undefined> Main currency symbol
exchangeValue<object | undefined> Exchange currency details:amount<string | number | undefined> Exchange currency amountsymbol<string | undefined> Exchange currency symbol
fromLabel<string | undefined> From label textfrom<string | undefined> From address or label texttoLabel<string | undefined> To label textto<string[] | undefined> To addressesnetworkFeeLabel<string | undefined> Network fee label textnetworkFeeTip<string | undefined> Network fee tooltip textnetworkFee<string | undefined> Network fee amountexchangeNetworkFee<string | undefined> Exchange network fee amounttotalLabel<string | undefined> Total label texttotal<string[] | undefined> Total amountsexchangeTotalValue<string | undefined> Exchange total valuerawTxDescription<string | undefined> Raw transaction descriptionrawTx<string | undefined> Raw transaction data
ContractInteraction
Holds localization settings for a contract interaction screen.title<string | undefined> Title textsubtitle<string | undefined> Subtitle textmainCurrency<object | undefined> Main currency details:amount<string | number | undefined> Main currency amountsymbol<string | undefined> Main currency symbol
exchangeValue<object | undefined> Exchange value details:amount<string | number | undefined> Exchange value amountsymbol<string | undefined> Exchange value symbol
fromLabel<string | undefined> From label textfrom<string | undefined> From address or label textcontractAddressLabel<string | undefined> Contract address label textcontractInfo<string[] | undefined> Contract informationnetworkFeeLabel<string | undefined> Network fee label textnetworkFeeTip<string | undefined> Network fee tooltip textnetworkFee<string | undefined> Network fee amountexchangeNetworkFee<string | undefined> Exchange network fee amounttotalLabel<string | undefined> Total label texttotal<string[] | undefined> Total amountsexchangeTotalValue<string | undefined> Exchange total valuedataDetails<object | undefined> Data details:dataDetailsLabel<string | undefined> Data details labelcallData<object | undefined> Call data:callDataLabel<string | undefined> Call data labeldata<string | undefined> Call data string
abiInfo<object | undefined> ABI information:functionNameLabel<string | undefined> Function name labelfunctionName<string | undefined> Function name stringparametersLabel<string | undefined> Parameters labelparameters<string[] | undefined> Parameters strings
SignatureRequest
Holds localization settings for a signature request screen.title<string | undefined> Title textcontractName<string | undefined> Contract namecontractUrl<string | undefined> Contract URLsubtitle<string | undefined> Subtitle textdescriptionLabel<string | undefined> Description label textdescription<string | undefined> Description text
EmailOtp
Holds localization settings for an email OTP (One-Time Password) screen.title<string | undefined> Title textsubtitle<string | undefined> Subtitle textresendHint<string | undefined> Resend hint textresend<string | undefined> Resend button text
ThemeColor
Holds customization color settings.backdrop<string | undefined> Backdrop color, e.g.'#000000'.backdropOpacity<number | undefined> Backdrop opacity, e.g.0.5.divider<string | undefined> Divider color, e.g.'#808080'or'grey'.bg<string | undefined> Background color e.g.'#FFFFFF'or'white'.success<string | undefined> Success color, e.g.'#008000'or'green'.error<string | undefined> Error color, e.g.'#FF0000'or'red'.textMain<string | undefined> Main text color, e.g.'#000000'or'black'.textMain2<string | undefined> Main text color 2, e.g.'#000000'or'black'.textAuxiliary<string | undefined> Auxiliary text color, e.g.'#000000'or'black'.textAuxiliary2<string | undefined> Auxiliary text color 2, e.g.'#000000'or'black'.textSummary<string | undefined> Summary text color, e.g.'#000000'or'black'.textSummaryHighlight<string | undefined> Summary highlight text color, e.g.'#000000'or'black'.textPlaceholder<string | undefined> Placeholder text color, e.g.'#808080'or'grey'.pinDotBase<string | undefined> Fill color for pincode input dot, e.g.'#FFFFFF'or'white'.pinDotBaseBorder<string | undefined> Stroke color for pincode input dot, e.g.'#000000'or'black'.pinDotActivated<string | undefined> Fill color for inputted pincode input dot, e.g.'#0000ff'or'blue'.enteredPinText<string | undefined> Text color for entered pincode input, e.g.#000000orblack.inputText<string | undefined> Text color for text input, e.g.#000000orblack.inputBorderFocused<string | undefined> Outline color for text input on focused, e.g.'#0000ff'or'blue'.inputBorderFocusedError<string | undefined> Outline color for text input when error, e.g.'#FF0000'or'red'.inputBg<string | undefined> Background color for text input, e.g.'#FFFFFF'or'white'.inputBgDisabled<string | undefined> Background color for disabled text input, e.g.'#FFFFFF'or'white'.dropdownBg<string | undefined> Background color for dropdown, e.g.'#FFFFFF'or'white'.dropdownBorderIsOpen<string | undefined> Outline color for dropdown is open, e.g.'#0000ff'or'blue'.dropdownBorderError<string | undefined> Outline color for dropdown when error, e.g.'#FF0000'or'red'.mainBtnText<string | undefined> Text color for primary button, e.g.'#FFFFFF'or'white'.mainBtnTextDisabled<string | undefined> Text color for disabled primary button, e.g.'#FFFFFF'or'white'.mainBtnTextOnHover<string | undefined> Text color for primary button on hover, e.g.'#FFFFFF'or'white'.mainBtnBg<string | undefined> Background color for primary button, e.g.'#000000'or'black'.mainBtnBgOnHover<string | undefined> Background color for primary button on hover, e.g.'#000000'or'black'.mainBtnBgDisabled<string | undefined> Background color for disabled primary button, e.g.'#000000'or'black'.secondBtnText<string | undefined> Text color for secondary button, e.g.'#000000'or'black'.secondBtnTextDisabled<string | undefined> Text color for disabled secondary button, e.g.'#000000'or'black'.secondBtnTextOnHover<string | undefined> Text color for secondary button on hover, e.g.'#000000'or'black'.secondBtnBorder<string | undefined> Outline color for secondary button, e.g.'#000000'or'black'.secondBtnBorderOnHover<string | undefined> Outline color for secondary button on hover, e.g.'#000000'or'black'.secondBtnBgOnHover<string | undefined> Background color for secondary button on hover, e.g.'#FFFFFF'or'white'.secondBtnBorderDisabled<string | undefined> Outline color for disabled secondary button, e.g.'#FFFFFF'or'white'.plainBtnText<string | undefined> Text color for plain text button, e.g.'#000000'or'black'.plainBtnTextDisabled<string | undefined> Text color for disabled plain text button, e.g.'#000000'or'black'.plainBtnTextOnHover<string | undefined> Text color for plain text button on hover, e.g.'#000000'or'black'.plainBtnBg<string | undefined> Background color for plain text button, e.g.'#FFFFFF'or'white'.plainBtnBgOnHover<string | undefined> Background color for plain text button on hover, e.g.'#FFFFFF'or'white'.recoverPinHintTitle<string | undefined> Text color for recover pincode hint title, e.g.'#FFFFFF'or'white'.recoverPinHintTitleBg<string | undefined> Background color for recover pincode hint title, e.g.'#FFFFFF'or'white'.recoverPinHint<string | undefined> Text color for recover pincode hint, e.g.'#FFFFFF'or'white'.titleGradients<string[] | undefined> Background color for linear-gradient text, e.g.['#B090F5', '#1AA3FF'].
Resources
Holds resource urls and properties, such as images or font-family settings. These resource properties should be hosted on a public server. SDK will load these resources from the urls provided.naviClose<string | undefined> Close iconnaviBack<string | undefined> Back iconsecurityIntroMain<string | undefined> Security intro main imagedropdownArrow<string | undefined> Dropdown arrow iconselectCheckMark<string | undefined> Select check mark iconsecurityConfirmMain<string | undefined> Security confirm main imageerrorInfo<string | undefined> Error info iconfontFamily<{ name?: string, url?: string } | undefined> Font family settings
CustomLinks
Holds custom links.learnMoreUrl<string | undefined> Learn more link
Class Definition
The Web SDK supports the class definitions listed in the following sections.W3SSdk
Constructor
Initializes a new instance ofW3SSdk.
Methods
execute
Executes a challenge.-
challengeId<string> Challenge ID -
onCompleted<Function> Callback functionerror<Error> Presents if error occursresult<ChallengeResult> Presents when success
setAppSettings
Sets the application settings.appSettings<AppSettings> Application settings object
setAuthentication
Sets the authentication information.auth<Authentication> Authentication object
updateConfigs
Updates the configurations.configs<Configs> Configurations objectonSocialLoginComplete<Function | undefined> Callback functionerror<Error> Presents if error occursresult<SocialLoginResult> | <\EmailLoginResult> | undefined> Presents and contains the result of the social login when the social login is completed
getDeviceId
Gets the device ID.performLogin
Performs a social login.provider<SocialLoginProvider> Social login provider
verifyOtp
Verifies the OTP.execute
Executes a challenge.challengeId<string> Challenge IDonCompleted<Function | undefined> Callback functionerror<Error> Presents if error occursresult<ChallengeResult | SignMessageResult | SignTransactionResult | undefined> Presents and contains the result of the challenge when the challenge is completed
setCustomSecurityQuestions
Sets custom security questions.questions<SecurityQuestion[] | undefined> Array ofSecurityQuestionrequiredCount<integer | undefined> Required count ofSecurityQuestion. The value is 2 by default.securityConfirmItems<string[] | undefined> Array of customized disclaimers onSecurityConfirmscreen. The value isundefinedby default.
setLocalizations
Sets custom localizationslocalizations<Localizations | undefined> Settings ofLocalizations
setResources
Sets custom resourcesresources<Resources | undefined> Settings ofResources
setThemeColor
Sets custom theme colorsthemeColor<ThemeColor | undefined> Settings ofThemeColor
setCustomLinks
Sets custom linkscustomLinks<CustomLinks | undefined> Settings ofCustomLinks
setOnForgotPin
Sets callback function for ForgotPin button click eventonForgotPin<Function | undefined> Callback functionshouldCloseModalOnForgotPin<boolean | undefined> Should close modal on forgot pin click event
setOnResendOtpEmail
Sets callback function for Resend OTP Email button click eventonResendOtpEmail<Function | undefined> Callback function
Sample code
React.js
Javascript
Vanilla JavaScript
Javascript