feat: wrap public key in a class

This commit is contained in:
Michael Vines
2018-09-30 18:42:45 -07:00
parent 2c3208090c
commit ca6965f8c2
15 changed files with 180 additions and 95 deletions

View File

@@ -1,14 +1,8 @@
// @flow
import nacl from 'tweetnacl';
import bs58 from 'bs58';
import type {KeyPair} from 'tweetnacl';
/**
* Base 58 encoded public key
*
* @typedef {string} PublicKey
*/
export type PublicKey = string;
import {PublicKey} from './publickey';
/**
* An account key pair (public and secret keys).
@@ -36,7 +30,7 @@ export class Account {
* The public key for this account
*/
get publicKey(): PublicKey {
return bs58.encode(this._keypair.publicKey);
return new PublicKey(this._keypair.publicKey);
}
/**