1.0.5 • Published 9 months ago

@wepin/utils v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

@wepin/utils

Utils for Wepin service

Install

yarn add @wepin/utils

or

npm install @wepin/utils

Import

import WeipnUtils from '@wepin/utils'

UVD Librarys

static makeHint(value: string): Hint;
static makeUVD(value: string): UVD['UVD'] | undefined;
static getEncUVD(b64PubKey: string, uvd: UVD): Promise<EncUVD>;

makeHint

A hint object must be created with the PIN number of the user's wallet.

const userPIN1 = '000000' // 사용자에게 입력받은 PIN
const pin1Hint = WepinUtils.makeHint(userPIN1)

makeUVD

This function hashes the PIN number first before encrypting the user's PIN number.

const userPIN1 = '000000' // 사용자에게 입력받은 PIN
const pin1UVD = WepinUtils.makeUVD(userPIN1)

getEncUVD

The encrypted UVD Object is obtained by using the hashed PIN as an input value.

 WepinUtils.getEncUVD(pubKey, {
      UVD: pin1UVD,  
      nonce: 0   
  }).then(encUvd => {
      console.log(encUvd)
      // send `/register` request with encUvd 
  })