1.0.3 • Published 5 months ago

@wepin/ops-utils v1.0.3

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

@wepin/ops-utils

Utils for Wepin OpsWallet service

Install

yarn add @wepin/ops-utils

or

npm install @wepin/ops-utils

Import

import WepinUtils from '@wepin/ops-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 Password of the user's wallet.

const userPassword1 = 'test12345678' // 사용자에게 입력받은 Password, 10~20글자(영문, 숫자, 특수문자)
const password1Hint = WepinUtils.makeHint(userPassword1)

makeUVD

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

const userPassword1 = 'test12345678' // 사용자에게 입력받은 Password, 10~20글자(영문, 숫자, 특수문자)
const password1UVD = WepinUtils.makeUVD(userPassword1)

getEncUVD

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

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