Skip to main content

SignIn

One-click integration allows for a quick connection to Portkey with only basic configuration needed. You can control the display form by adjusting the uiType parameter in the Sign function.

Usage

import { DIDWalletInfo, SignIn, ISignIn } from "@portkey/did-ui-react";
import { useCallback, useState } from "react";

const App: React.FC = () => {
const ref = useRef<ISignIn>();

const onFinish = useCallback((didWallet: DIDWalletInfo) => {
console.log("didWallet:", didWallet);
}, []);

return (
<>
<button onClick={() => ref.current?.setOpen(true)}>Sign In</button>
<SignIn
uiType="Modal"
onFinish={onFinish}
onCancel={() => ref.current?.setOpen(false)}
/>
</>
);
};

export default App;

API

PropertyDescriptionTypeDefaultVersion
pinDefault pin. When typeof pin === 'string', the process of setting the pin will be skippedstring | undefined-V1.5.3+
keyboardIs Portkey numeric keyboard used. Only takes effect on mobile devicesboolean-V1.5.3+
designLogin UI mode"SocialDesign" | "CryptoDesign" | "Web2Design"CryptoDesign
uiTypeIs UI displayed as Modal or as a page component'Modal' | 'Full'Modal
getContainerMenu renders the parent node when uiType is ModalHTMLElement | () => HTMLElement | Selectors | falsedocument.body
classNameClass name of the top level containerstring-
defaultChainIdDefault chain ID for login and sing-upChainId'AELF'
defaultLifeCycleDefault lifecycle of the ongoing login processPartial<TStep1LifeCycle | TStep2SignUpLifeCycle | TStep2SignInLifeCycle | TStep3LifeCycle>-
isShowScanIs scan to log in shownbooleantrue
phoneCountryList of countries that support sending SMS verification codesIPhoneCountry-V2.0.0
extraElementCustomized contentReactNode-
extraElementListCustomized contentReactNode[]-V2.0.0
termsOfServiceAddress of the terms, won't be displayed if not configured. If it is a string, consider it as a linkReactNode-
privacyPolicyLink that directs to the privacy policystring-V2.0.0
validateEmailCustomized rules for email verification(v:string)=>Promise<any>-
validatePhoneCustomized rules for phone number verification(v:string)=>Promise<any>-V2.0.0
isErrorTipIs error tip set as defaultbooleantrue
onErrorCallback of error(error: {errorFields:string, error: any}) => void;-
onChainIdChangeTriggered when the chain where the user registers address does not match the default chain ID(chainId?: ChainId) => void;-
onLifeCycleChangeTriggered when certain cycle changes(liftCycle: LifeCycleType, nextLifeCycleProps: T): void;-
onCreatePendingTriggered when the creation/login initiated succeeds(info: CreatePendingInfo) => void;-
onFinishCallback when creation/login is completed(didWallet: DIDWalletInfo) => void;-
onCancelCallback of cancelling when uiType is Modal() => void;-
onSignUpCheck if an account has been created using the previous Portkey, and if it needs to proceed with executing the account creation process in the upgraded Portkey.
Note: This applies only if you have integrated the SDK up to and including v2.0.0. SDK in higher versions are not affected.
(identifierInfo: { identifier: string; accountType: AccountType; authToken?: string; }) => Promise<SignUpValue>-V2.0.0