@3id/ui-provider
TypeScript icon, indicating that this package has built-in type declarations

0.4.1 • Public • Published

3ID Connect Service UI Provider

An interface for applications to impelement any user interface 3ID connect service.

NOTE: Mostly internal use, names and interfaces are likely to change soon and support currently being added in the 3ID Connect Service and/or 3ID Manager Library

Use

npm install @ceramicstudio/ui-provider

Example usage:

import { UIProvider, ThreeIDManagerUI } from '@ceramicstudio/ui-provider'

// Implement the following UI Handlers 
const UIMethods: UIProviderHandlers = {
  // Ask user to continue with 3box account migration, true to
  // migrate, false to cancel request
  prompt_migration: async (ctx, params) => {
    //...
  },
   // Ask user to skip migration after migration faile, true to 
   // create new account, false to cancel request
  prompt_migration_skip: async (ctx, params) => {
    //...
  },
  // Known migration failure bugs, ask user to continue with new
  // account instead, true to create new, false to cancel request
  prompt_migration_fail: async (ctx, params) => {
    //...
  },
  // Ask user to connect account to existing account or create new.
  // Displayed when CAIP10 has no existing link in network.
  prompt_account: async (ctx, params) => {
    //...
  },
  // Permission request for app to access 3id-connect
  prompt_authenticate: async (ctx, params) => {
    //...
  },
  // Any errors during flows
  inform_error: async (ctx, params) => {
    //...
  },
  // Inform UI that a flow has ended and no futher requests are expected 
  inform_close: async (ctx, params) => {
    //...
  }
}

//Create a 3ID Connect UI Provider 
const provider = new UIProvider(UIMethods)

// TODO: provider consumption in other libraries

Maintainers

@zachferland

Readme

Keywords

Package Sidebar

Install

npm i @3id/ui-provider

Weekly Downloads

5

Version

0.4.1

License

(Apache-2.0 OR MIT)

Unpacked Size

9.87 kB

Total Files

8

Last publish

Collaborators

  • cb3box
  • paul_lecam
  • oed