npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@portkey-v1/did

v1.5.4-alpha.22

Published

<p align="center"> <a href="https://portkeydocs.readthedocs.io/en/pre-release/PortkeyDIDSDK/index.html"> <img width="200" src= "https://raw.githubusercontent.com/Portkey-Wallet/portkey-web/master/logo.png"/> </a> </p>

Downloads

406

Readme

ES Version Node Version NPM Package Version

Prerequisites

Package.json Scripts

| Script | Description | | -------- | -------------------------------------------------- | | clean | Uses rm to remove dist/ | | build | Uses tsc to build package and dependent packages | | lint | Uses eslint to lint package | | lint:fix | Uses eslint to check and fix any warnings | | format | Uses prettier to format the code |

Getting Started

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

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

Installation

Using NPM

npm install @portkey-v1/did

Using Yarn

yarn add @portkey-v1/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: 'your did server node',
    timeout: 'timeout', // optional default 8000ms
  },
  graphQLUrl: 'your graphQL node',
  storageMethod: new Store(),
});

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

@portkey-v1/did API Reference

did.setConfig

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

did.setConfig({
  requestDefaults: {
    baseURL: 'you did server node',
    timeout: 'timeout', // optional default 8000ms
  },
  graphQLUrl: 'your graphQL node',
  storageMethod: 'your storage suite',
});

did.login

type: loginAccount

Email or mobile phone number or Google or Apple login.

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

Example

did.login('loginAccount', {
  chainId: 'chainId',
  loginGuardianIdentifier: 'loginGuardianIdentifier',
  guardiansApproved: [
    {
      type: 'Email',
      identifier: 'identifier',
      verifierId: 'verifierId',
      verificationDoc: 'verificationDoc',
      signature: 'signature',
    },
  ],
  extraData: 'extraData',
  context: {
    requestId: 'requestId',
    clientId: 'clientId',
  },
});

type: scan

Logged in management to add management.

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

Example

did.login('scan',{
  chainId: 'chainId',
  caHash: 'caHash',
  managerInfo: {
    address: 'address',
    extraData: 'extraData'
  };
})

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, 'manager'>): Promise<RegisterResult>;

Example

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

getRegisterStatus

getRegisterStatus(params: { chainId: ChainId; sessionId: string }): Promise<RegisterStatusResult>;

Example

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

getHolderInfo

getHolderInfo by graphQL.

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

Example

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

getHolderInfo by server.

getHolderInfo(params: Omit<GetHolderInfoParams, 'manager'>): Promise<IHolderInfo>;

Example

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

getVerifierServers

Get the VerifierServer information of the corresponding chain.

getVerifierServers(chainId: ChainId): Promise<VerifierItem[]>;

Example

did.getVerifierServers({
  chainId: 'chainId',
});

check manager is exist

Check whether the manager has management permissions for the account.

checkManagerIsExist(params:{chainId: ChainId, caHash:string, manager:string}): Promise<boolean>;

Example

did.checkManagerIsExist({
  chainId: 'chainId',
  caHash: 'caHash',
  manager: 'manager'
});

services

services.getVerificationCode

send verification code.

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

Example

did.services.getVerificationCode({
  params: {
    chainId: 'chainId',
    guardianIdentifier: 'guardianIdentifier',
    type: 'Email',
    verifierId: 'verifierId',
    operationType: 'operationType',
  },
  headers: {
    reCaptchaToken: 'reCaptchaToken',
  },
});

operationType types

services.verifyVerificationCode

verify verification code.

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

Example

did.services.verifyVerificationCode({
  verifierSessionId: 'verifierSessionId',
  chainId: 'chainId',
  guardianIdentifier: 'guardianIdentifier',
  verifierId: 'verifierId',
  verificationCode: 'verificationCode',
  operationType: 'operationType',
});

services.verifyGoogleToken

verify Google token.

verifyGoogleToken(params: VerifyGoogleTokenParams): Promise<VerifyVerificationCodeResult>;

Example

did.services.verifyGoogleToken({
  chainId: 'chainId',
  accessToken: 'accessToken',
  verifierId: 'verifierId',
  operationType: 'operationType',
});

services.verifyAppleToken

verify Apple token.

verifyAppleToken(params: VerifyAppleTokenParams): Promise<VerifyVerificationCodeResult>;

Example

did.services.verifyAppleToken({
  chainId: 'chainId',
  verifierId: 'verifierId',
  identityToken: 'identityToken',
  operationType: 'operationType',
});

services.sendAppleUserExtraInfo

send Apple user extra info.

sendAppleUserExtraInfo(params: SendAppleUserExtraInfoParams): Promise<SendAppleUserExtraInfoResult>;

Example

did.services.sendAppleUserExtraInfo({
  identityToken: 'identityToken',
  userInfo: {
    name: {
      firstName: 'firstName',
      lastName: 'lastName',
    },
    email: 'email',
  },
});