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.

Examples

/** Connecting with WalletConnect provider */
async function connectOrbis() {
  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."
  }

Next steps

Explore other parts of the API.

API Documentation

isConnected()