1.0.8 • Published 7 months ago

@wepin/uvd-utils v1.0.8

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

@wepin/uvd-utils

UVD Utils for Wepin service

Install

yarn add @wepin/uvd-utils

or

npm install @wepin/uvd-utils

Import

import WepinUtils from '@wepin/uvd-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
  })