Class CoreCapsuleAbstract

Hierarchy

Constructors

  • Constructs a new CoreCapsule instance.

    Parameters

    • env: Environment

      Environment to use.

    • Optional apiKey: string

      API key to use.

    • Optional opts: ConstructorOpts

      Additional constructor options; see ConstructorOpts.

    Returns CoreCapsule

    • A new CoreCapsule instance.

Properties

ctx: Ctx
disableProviderModal?: boolean
email?: string
loginEncryptionKeyPair?: KeyPair

Encryption key pair generated from loginEncryptionKey.

platformUtils: PlatformUtils
portalBackgroundColor?: string

Hex color to use in the portal for the background color.

portalPrimaryButtonColor?: string

Hex color to use in the portal for the primary button.

portalTextColor?: string

Hex text color to use in the portal.

sessionCookie?: string
userId?: string
wallets?: Record<string, Wallet>

Methods

  • Determines if 2FA has been set up.

    Returns Promise<{
        isSetup: boolean;
    }>

    • true if 2FA is setup, false otherwise
  • Checks if a user exists.

    Parameters

    • email: string

    Returns Promise<boolean>

    • true if user exists, false otherwise.
  • Remove all local storage and prefixed session storage.

    Returns Promise<void>

  • Parameters

    • bigInt: Record<string, any>

    Returns BigInteger

  • Parameters

    • jsonKeyPair: Record<string, any>

    Returns KeyPair

  • Creates a new user.

    Parameters

    • email: string

      email to use for creating the user.

    Returns Promise<void>

  • Creates a new wallet.

    Parameters

    • skipDistribute: boolean = false

      if true, recovery share will not be distributed.

    • customFunction: ((params?) => void)

      method called when createWallet is done.

        • (params?): void
        • Parameters

          • Optional params: any

          Returns void

    Returns Promise<[Wallet, string]>

    [wallet, recoveryShare]

  • Returns Promise<void>

  • Distributes a new wallet recovery share.

    Parameters

    • walletId: string

      the wallet to distribute the recovery share for.

    • userShare: string

      the user share generate the recovery share from.

    Returns Promise<string>

    • recovery share.
  • Enables 2FA.

    Parameters

    • verificationCode: string

      verification code received via 2FA.

    Returns Promise<void>

  • Returns string

  • Fetches the wallets associated with the user.

    Returns Promise<any[]>

    • wallets that were fetched.
  • Gets the email associated with the CoreCapsule instance.

    Returns string

    • email associated with the CoreCapsule instance.
  • Parameters

    • partnerId: string

    Returns Promise<string>

  • Returns PlatformUtils

  • URL of the portal, which can be associated with a partner id

    Parameters

    • Optional partnerId: string

      id of the partner to get the portal URL for

    Returns Promise<string>

    • portal URL
  • Parameters

    • isForNewDevice: boolean

    Returns Promise<string>

  • Parameters

    • compressedUrl: string

    Returns string

  • Parameters

    • transactionId: string

    Returns string

  • Get transmission shares associated with session.

    Parameters

    • Optional isForNewDevice: boolean

      true if this device is registering.

    Returns Promise<any>

    • transmission keyshares.
  • Gets the wallets associated with the CoreCapsule instance.

    Returns Record<string, Wallet>

    • wallets associated with the CoreCapsule instance.
  • Parameters

    • webAuthId: string
    • Optional partnerId: string
    • Optional isForNewDevice: boolean

    Returns Promise<string>

  • Generates a URL that can be used to perform web auth for creating a new credential.

    Parameters

    • sessionId: string

      id of the session to use for web auth

    • loginEncryptionPublicKey: string

      public key to use for encrypting the login encryption key

    • Optional partnerId: string

      id of the partner to get the portal URL for

    • Optional newDeviceSessionId: string

      id of the session to use for web auth for a new device

    • Optional newDeviceEncryptionKey: string

      public key to use for encrypting the login encryption key for a new device

    Returns Promise<string>

    • web auth url
  • Parameters

    • serializedInstanceBase64: string

    Returns Promise<void>

  • Initialize storage relating to a CoreCapsule instance.

    Init only needs to be called for storage that is async.

    Returns Promise<void>

  • Initiates a login.

    Parameters

    • email: string

      the email to login with

    • Optional useShortURL: boolean

      whether to shorten the link

    Returns Promise<string>

    • web auth url for logging in
  • Checks if a session is active and a wallet exists.

    Returns Promise<boolean>

    • true if session is active and a wallet exists.
  • Returns boolean

  • Returns Promise<boolean>

  • Parameters

    • key: string

    Returns string | Promise<string>

  • Parameters

    • key: string
    • value: string

    Returns void | Promise<void>

  • Logs the user out.

    Returns Promise<void>

  • Parameters

    • cookie: string

    Returns void

  • Returns Promise<void>

  • Updates the session with the user management server, possibly opening a popup to refresh the session.

    Parameters

    • shouldOpenPopup: boolean

      true if you want to open the popup automatically

    Returns Promise<string>

    • web auth url for refreshing session
  • Returns Promise<void>

  • Returns string

  • Sends a transaction.

    Parameters

    • walletId: string

      id of the wallet to send the transaction from.

    • rlpEncodedTxBase64: string

      rlp encoded tx as base64 string

    • chainId: string

      chain id of the chain the transaction is being sent on.

    Returns Promise<FullSignatureRes>

  • Parameters

    • key: string

    Returns string | Promise<string>

  • Parameters

    • key: string

    Returns void | Promise<void>

  • Parameters

    • key: string
    • value: string

    Returns void | Promise<void>

  • Sets the email associated with the CoreCapsule instance.

    Parameters

    • email: string

      Email to set.

    Returns Promise<void>

  • Sets the login encryption key pair associated with the CoreCapsule instance.

    Parameters

    • keyPair: KeyPair

      Encryption key pair generated from loginEncryptionKey.

    Returns Promise<void>

  • Sets the user id associated with the CoreCapsule instance.

    Parameters

    • userId: string

      User id to set.

    Returns Promise<void>

  • Sets the wallets associated with the CoreCapsule instance.

    Parameters

    • wallets: Record<string, Wallet>

      Wallets to set.

    Returns Promise<void>

  • Sets up 2FA.

    Returns Promise<{
        uri?: string;
    }>

    uri - uri to use for setting up 2FA

  • Call this method after login to perform setup.

    Parameters

    • Optional temporaryShares: any[]

      optional temporary shares to use for decryption.

    Returns Promise<void>

  • Parameters

    • link: string

    Returns Promise<string>

  • Signs a message.

    If you want to sign the keccak256 hash of a message, hash the message first and then pass in the base64 encoded hash.

    Parameters

    • walletId: string

      id of the wallet to sign with.

    • messageBase64: string

      base64 encoding of exact message that should be signed

    Returns Promise<FullSignatureRes>

  • Signs a transaction.

    Parameters

    • walletId: string

      id of the wallet to sign the transaction from.

    • rlpEncodedTxBase64: string

      rlp encoded tx as base64 string

    • chainId: string

      chain id of the chain the transaction is being sent on.

    Returns Promise<FullSignatureRes>

  • Converts to a string, removing sensitive data when logging this class.

    Doesn't work for all types of logging.

    Returns string

  • Call this method after login to ensure that the user ID is set internally.

    Returns Promise<void>

  • Performs 2FA verification.

    Parameters

    • email: string

      email to use for performing a 2FA verification.

    • verificationCode: string

      verification code to received via 2FA.

    Returns Promise<{
        address?: string;
        initiatedAt?: Date;
        status?: RecoveryStatus;
        userId: string;
        walletId: string;
    }>

  • Passes the email code obtained from the user for verification.

    Parameters

    • verificationCode: string

    Returns Promise<string>

    • web auth url for creating a new credential
  • Waits for the session to be active.

    Returns Promise<void>

  • Waits for the session to be active and sets up the user.

    Returns Promise<{
        needsWallet: boolean;
    }>

    • whether a wallet needs to be created
  • Parameters

    • walletId: string

    Returns Promise<void>

Generated using TypeDoc