Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@portkey/did

Package Overview
Dependencies
Maintainers
1
Versions
369
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@portkey/did

![ES Version](https://img.shields.io/badge/ES-2020-yellow) ![Node Version](https://img.shields.io/badge/node-14.x-green) [![NPM Package][npm-image]][npm-url] [![Dependency Status][deps-image]][deps-url] [![Dev Dependency Status][deps-dev-image]][deps-dev-

  • 0.0.1-alpha.1.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2K
decreased by-31.32%
Maintainers
1
Weekly downloads
 
Created
Source

@portkey/did

ES Version Node Version [![NPM Package][npm-image]][npm-url] [![Dependency Status][deps-image]][deps-url] [![Dev Dependency Status][deps-dev-image]][deps-dev-url]

Prerequisites

  • :gear: NodeJS (LTS/Fermium)
  • :toolbox: Yarn/Lerna

Package.json Scripts

ScriptDescription
cleanUses rm to remove dist/
buildUses tsc to build package and dependent packages
lintUses eslint to lint package
lint:fixUses eslint to check and fix any warnings
formatUses prettier to format the code

Getting Started

The @portkey/did library is a collection of modules that contain functionality for the did ecosystem.

  • @portkey/accounts is for the portkey account.
  • @portkey/utils is for the portkey utils.
  • @portkey/contracts is for the portkey contracts.
  • @portkey/graphql is for the portkey graphql.
  • @portkey/contracts is for the portkey request.
  • @portkey/types is for the portkey types.
  • @portkey/utils is for the portkey utils.
  • @portkey/validator is for the portkey validator.

Installation

Using NPM
npm install @portkey/did
Using Yarn
yarn add @portkey/did

After that you need configure did server node、graphQL node、storage suite.

class Store implements IStorageSuite {
  async getItem(key: string) {
    return localStorage.getItem(key);
  }
  async setItem(key: string, value: string) {
    return localStorage.setItem(key, value);
  }
  async removeItem(key: string) {
    return localStorage.removeItem(key);
  }
}
did.setConfig({
  requestDefaults: {
    baseURL: 'you did server node',
    timeout: 'timeout', // optional default 8000ms
  },
  graphQLUrl: 'you graphQL node',
  storageMethod: new Store(),
});

That’s it! now you can use the did object.

@portkey/did API Reference

did.setConfig

Where you configure did server node, graphQL node, storage suite.

did.setConfig({
  requestDefaults: {
    baseURL: 'you did server node',
  },
  graphQLUrl: 'you graphQL node',
  storageMethod: you storage suite,
});

did.login

loginAccount

Email or phone number login.

did.login(type: 'loginAccount', params: AccountLoginParams): Promise<LoginResult>;

Example

did.login('loginAccount', {
  chainId: 'chainId',
  loginGuardianAccount: 'loginGuardianAccount',
  guardiansApproved: [
    {
      type: 'Email',
      value: 'value',
      verifierId: 'verifierId',
      verificationDoc: 'verificationDoc',
      signature: 'signature',
    },
  ],
  deviceString: 'deviceString',
  context: {
    requestId: 'requestId',
    clientId: 'clientId',
  },
});
scan

Logged in manager to add manager.

login(type: 'scan', params: ScanLoginParams): Promise<true>;

Example

did.login('scan',{
  chainId: 'chainId',
  caHash: 'caHash',
  manager: {
    managerAddress: 'managerAddress',
    deviceString: 'deviceString';
  };
})
getLoginStatus

getLoginStatus(params: { chainId: ChainId; sessionId: string }): Promise<RecoverStatusResult>;

Example

did.getLoginStatus({
  chainId: 'chainId',
  sessionId: 'sessionId',
});

logout

logout(params: EditManagerParams): Promise<boolean>;

Example

did.logout({ chainId: 'chainId' });

register

register(params: Omit<RegisterParams, 'managerAddress'>): Promise<RegisterResult>;

Example

did.register({
  type: 'Email',
  loginGuardianAccount: 'loginGuardianAccount',
  deviceString: 'deviceString',
  chainId: 'chainId',
  verifierId: 'verifierId',
  verificationDoc: 'verificationDoc',
  signature: 'signature',
  context: {
    requestId: 'requestId',
    clientId: 'clientId',
  },
});

getHolderInfo

getHolderInfo by graphQL

getHolderInfo(params: Pick<GetHolderInfoParams, 'managerAddress' | 'chainId'>): Promise<Array<GetCAHolderByManagerResult>>;

Example

did.getHolderInfo({
  managerAddress: 'managerAddress', // optional
  chainId: 'chainId',
});

getHolderInfo by contracts

getHolderInfo(params: Pick<GetHolderInfoParams, 'managerAddress' | 'chainId'>): Promise<Array<GetCAHolderByManagerResult>>;

Example

did.getHolderInfo({
  caHash: 'caHash', // loginGuardianAccount and caHash choose one
  loginGuardianAccount: 'loginGuardianAccount', // loginGuardianAccount and caHash choose one
  chainId: 'chainId',
});

services

_services.getVerificationCode

getVerificationCode(params: SendVerificationCodeParams): Promise<SendVerificationCodeResult>;

Example

did._services.getVerificationCode({
  chainId: 'chainId',
  guardianAccount: 'guardianAccount',
  type: 'Email',
  verifierId: 'verifierId',
});
_services.getVerificationCode

verifyVerificationCode(params: VerifyVerificationCodeParams): Promise<VerifyVerificationCodeResult>;

Example

did._services.verifyVerificationCode({
  verifierSessionId: 'verifierSessionId',
  chainId: 'chainId',
  guardianAccount: 'guardianAccount',
  verifierId: 'verifierId',
  verificationCode: 'verificationCode',
});

FAQs

Package last updated on 24 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc