Orbis SDK
  • Introduction
  • Installation
  • Getting started
    • Option 1: Getting started with a Social Feed
    • Option 2: Decentralized communication platform
  • API Documentation
    • orbis.connect()
    • orbis.isConnected()
    • orbis.logout()
    • orbis.createPost()
Powered by GitBook
On this page
  • How to use?
  • Parameters
  • Examples
  • Returns
  1. API Documentation

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.

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."
  }
PreviousAPI DocumentationNextorbis.isConnected()

Last updated 2 years ago