Locus Library
서비스에 로커스 체인을 적용할때 필요한 함수가 포함된 라이브러리를 제공합니다 다음과 같은 기능이 포함되어 있습니다.
- 키를 생성하거나 불러옵니다.
- 데이터를 형식을 변환합니다.
- 트랜잭션을 검증합니다.
- 프라이빗 키로 서명합니다.
설치 방법
- Javascript
npm i locuschain-lib
사용 방법
LocusLib.function(param1, param2, ... )
- function: 함수명
- param: 매개 변수
- Javascript
import { LocusLib } from 'locuschain-lib';
const result = await LocusLib.GetLibraryVersions()
console.log(result)
팁
모든 함수는 비동기 함수입니다. 앞에 await를 붙이거나 then을 사용하여 결과값을 받습니다.
Functions
GetLibraryVersions
GetLibraryVersion returns the versions of this wasm library.
Input
GetLibraryVersions( )
[None]
Output
| Key | Type | Description |
|---|---|---|
| LibraryVersion | int | Library Version |
| KeyStoreVersion | int | Key Store Version |
| KeyStoreVersionMin | int | 호환되는 최소 Key Store Version |
| GoBuildVersion | string | Library를 빌드한 Golang 버전 |
CreateAccountAndKeystore
creates two separate keystore files for master key and normal key.
Input
CreateAccountAndKeystore( PwdMaster, PwdNormal, MasterKeyAlgo, NormalKeyAlgo )
| Key | Type | Description |
|---|---|---|
| PwdMaster | string | Master Key Password |
| PwdNormal | string | Normal Key Password |
| MasterKeyAlgo | string | Master Key Algorithm |
| NormalKeyAlgo | string | Normal Key Algorithm |
Output
| Key | Type | Description |
|---|---|---|
| - | string | Master와 Normal Keystore string |
CreateNormalKey
creates a new normal key for the given address.
Input
CreateNormalKey( Addr, KeyAlgorithm )
| Key | Type | Description |
|---|---|---|
| addr | string | Address |
| KeyAlgorithm | string | Normal Key Algorithm |
Output
| Key | Type | Description |
|---|---|---|
| - | string | Normal Key string |
CreateMasterKeystore
creates a keystore of normal key for the given address.
Input
CreateMasterKeystore( Addr, Password, MskStr, MpkStr )
| Key | Type | Description |
|---|---|---|
| Addr | string | Address |
| Password | string | Master Key Password |
| MskStr | string | Master Secret Key |
| MpkStr | string | Master Public Key |