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

@ericyangchen/npmyangtest

v2.2.4

Published

npm test package ericyang

Downloads

4

Readme

@ericyangchen/npmyangtest

安装

// 插件名称待定
npm i xxx

yarn add xxx

Using import to include the modules from xxx:

import VC from xxx;

var areaList = VC.utils.areaList

Require

Using require to include the modules from xxx:

var VC = require(xxx);
var areaList = VC.utils.areaList

In the Browser

To use in the browser you must use the compiled version (as listed above). The browser.js file is located in the lib directory. Include it into the project with a <script> tag:

<script src="./lib/browser.js"></script>

Everything will be available under the VC variable, just like in the require example above.

var areaList = VC.utils.areaList

使用

发送验证信息
import VC from 'xxxx'

/***
params
{
  appId: string,
  backDoc: string,
  country: string,
  docId: string,
  docType: string,
  frontDoc: string,
  name: string,
  ownerDid: string,  sdk 方法生成
}
**/

await VC.sendUserInfo({...params}, apiKey)

/***
returnType 
成功发送 return true
异常 Throw error message
***/
获取用户 credential
import VC from 'xxxx'

/**
params
ownerDid: string,  sdk 方法生成
docType: string 证件类型
**/

const result = await VC.getVcList(ownerDid, docType);

/**
return 
{
      authId: '0348xxxx-xxxx-4317-xxxx-8d6f6166a65b',
      appId: 'tesxxxx01',
      credentialContext: 'credential:sfp_passport_authentication',
      description: 'My Shuftipro Passport Authentication',
      txHash: '9494568336a4c2xxxxxxxxxxxxxxxxbaa066e1585fe47',
      status: 1,
      encryptOriginData: 'xxxxxxx', // credential 主要信息
      requestTime: 1622156645
    }
    
    status
    1 ---- 成功
    2 ---- 验证失败
    0 ---- 验证中
**/

utils 方法

areaList
import VC from 'xxxx'

VC.utils.areaList

/**
return array

[
  { name: 'Afghanistan', alias: 'AF' },
  { name: 'Aland Islands', alias: 'AX' },
  ...
]

name ----- country name
alias ---- abbreviation, 用户选择的 country value

**/
docType
import VC from 'xxxx'

VC.utils.docType

/**
return object

{
  Passport: 'passport',
  IdCard: 'id_card',
  DrivingLicense: 'driving_license'
}

**/
chainType
import VC from 'xxxx'

VC.utils.chainType

/**
return object

{
  ETH: 'eth',
  BSC: 'bnb'
}

**/

generateId

import VC from 'xxxx'

/**
params
ETH Address
**/
const ownerDid = VC.utils.generateId('0xaaaaaaaaaaaaa', chainType);

/**
return 
did string
**/

deserialize

import VC from 'xxxx'

/**
params
encryptOriginData of credential result
base64 hash string
**/
const result = VC.utils.deserialize(string)


/**
return type

{
      '@context': [
        'https://www.w3.org/20xxxxxxxxxxxx',
        'https://ontid.ont.i20xxxxxxxxxxxx',
        'credential:sfp_passport_authentication'
      ],
      id: 'urn:uuid:861cbae4-xxxx-4844-xxxx-8c8xxxx7052',
      type: [ 'VerifiableCredential' ],
      issuer: 'did:ont:APc8FBxxxxxxxxxxxxxxSUFX2HAnBuBna',
      issuanceDate: '2021-05-28T07:04:23.000Z',
      expirationDate: '2022-05-28T07:04:23.000Z',
      credentialStatus: {
        id: '4f7f159ac4xxxxxxxxxxx5f61b7d0cc6',
        type: 'AttestContract'
      },
      credentialSubject: {
        Name: 'xxxxxxxx',
        BirthDay: 'xxxx-03-09',
        ExpirationDate: 'xxxx-03-12',
        IDDocNumber: 'xx26xxxx86',
        IssuerName: 'Shxxxxro',
        user_did: 'did:ont:5cxxxxxxxx701CbBExxxxx29b'
      },
      proof: {
        type: 'JWT',
        verificationMethod: 'did:ont:APcxxxxxxxxq2BSUFX2xxxxxna#keys-1',
        created: '2021-05-28T07:04:23Z',
        proofPurpose: 'assertionMethod',
        jws: 'ARyjxxxxxxxxxxxxxxxxxxGDisGMJdFE/4erXIazh3n8ipPotTFA+Z4hS09GlhVaio=\\'
      }
    }

**/

serializeSignMessage


import VC from 'xxxx'

/**
params
{
  jwtStr: string, // jwt
  audienceId: string, // pro Id
  ownerDid: string    // user wallet address
  effectiveTime: number   // Presentation Effective time, eg 1 day = 86400
}
**/
const JWT = VC.utils.serializeSignMessage(params);

/**
return 
jwt string
**/

createPresentation


import VC from 'xxxx'

/**
params
{
  signMessage: string  //  Signed metadata
  signature: string    //  Signature after signing through metamask
}
**/
const JWT = VC.utils.createPresentation(params);

/**
return 
presentation jwt string
**/