We are now recommending developers to use the new connect_v2() function instead of this one.

orbis.connect()

The connect function will create a new Ceramic session that will be used to write streams. Sessions will stay valid for 31 days by default.

We recommend developers to also use the orbis.isConnected() on each app mount/load to check if there is an active session for the user visiting your app website.

How to use?

let res = await orbis.connect();

Parameters

  • provider: optional By default it will be using window.ethereum if available. Can be used to pass the WalletConnect provider for example.
  • lit: optional Use false if you are not using any features requiring encryption (such as token gated posts or direct messages). Default is true which is requiring two signatures for a full login.

Examples

/** Example 1: Connecting without requiring Lit encryption */
orbis.connect(window.ethereum, false);

/** Example 2: Connecting with WalletConnect provider */
let wallet_connect_provider = new WalletConnectProvider({
  infuraId: "infura_key",
});

/** Enable session (triggers QR Code modal) */
await wallet_connect_provider.enable();

/** Connect to Orbis using WalletConnect as a provider */
let res = await orbis.connect(wallet_connect_provider);

Returns

{
  status: 200,
  did: "did:pkh:..",
  details: {
    did: "did:pkh:..",
    profile: {
      pfp: "https://...",
      username: "Baptiste",
      description: "..."
    }
  },
  result: "Success connecting to the DiD."
}