diff --git a/src/auth/memo.js b/src/auth/memo.js index cf46a90374ac18638c1149defecd707c45fa437b..225d17b96fd433387a5b1b06e4c70ea9defd4ab6 100644 --- a/src/auth/memo.js +++ b/src/auth/memo.js @@ -83,6 +83,23 @@ export function encode(private_key, public_key, memo, testNonce) { return '#' + base58.encode(new Buffer(memo, 'binary')) } +/** Get public keys of both sender and receiver */ +export function getPubKeys(memo) { + assert(memo, 'memo is required') + assert.equal(typeof memo, 'string', 'memo') + if(!/^#/.test(memo)) return [] + memo = memo.substring(1) + + checkEncryption() + + memo = base58.decode(memo) + memo = encMemo.fromBuffer(new Buffer(memo, 'binary')) + + const {from, to} = memo + + return [from.toString(), to.toString()] +} + let encodeTest = undefined /**