diff --git a/src/index-browser.ts b/src/index-browser.ts index df15c410f4..cc328b1bcb 100644 --- a/src/index-browser.ts +++ b/src/index-browser.ts @@ -6,7 +6,7 @@ export { } from './chain'; export { InvalidTxError, sendTransaction } from './send-transaction'; export { - getAddressFromPriv, isAddressValid, genSalt, encodeUnsigned, hash, encodeContractAddress, + isAddressValid, genSalt, encodeUnsigned, hash, encodeContractAddress, sign, verify, messageToHash, signMessage, verifyMessage, isValidKeypair, } from './utils/crypto'; export { diff --git a/src/utils/crypto.ts b/src/utils/crypto.ts index 518c116c10..54824628ff 100644 --- a/src/utils/crypto.ts +++ b/src/utils/crypto.ts @@ -10,17 +10,6 @@ import { } from './encoder'; import { ArgumentError } from './errors'; -/** - * Generate address from secret key - * @param secret - Private key as hex string - * @returns Public key encoded as address - */ -export function getAddressFromPriv(secret: string | Uint8Array): Encoded.AccountAddress { - const secretBuffer = typeof secret === 'string' ? Buffer.from(secret, 'hex') : secret; - const keys = nacl.sign.keyPair.fromSecretKey(secretBuffer); - return encode(keys.publicKey, Encoding.AccountAddress); -} - /** * Check if address is valid * @param maybeAddress - Address to check diff --git a/test/unit/crypto.ts b/test/unit/crypto.ts index 38b6e5084b..222bd05b19 100644 --- a/test/unit/crypto.ts +++ b/test/unit/crypto.ts @@ -3,7 +3,7 @@ import { describe, it } from 'mocha'; import { assert, expect } from 'chai'; import { buildTxHash, decode, Encoded, - getAddressFromPriv, verifyMessage, isValidKeypair, isAddressValid, hash, genSalt, + verifyMessage, isValidKeypair, isAddressValid, hash, genSalt, sign, verify, messageToHash, signMessage, Encoding, } from '../../src'; @@ -31,10 +31,6 @@ const txRaw = 'tx_+QTlCwH4QrhA4xEWFIGZUVn0NhnYl9TwGX30YJ9/Y6x6LHU6ALfiupJPORvjbi const expectedHash = 'th_HZMNgTvEiyKeATpauJjjeWwZcyHapKG8bDgy2S1sCUEUQnbwK'; describe('crypto', () => { - it('Address from secret', () => { - getAddressFromPriv(privateKeyAsHex).should.be.equal(address); - }); - describe('isValidKeypair', () => { it('verify the generated key pair', () => { const keyPair = {