Skip to content
Snippets Groups Projects
Commit 6fe80f73 authored by Mahdi Yari's avatar Mahdi Yari
Browse files

Update memo.js

parent 7fdbd10e
No related branches found
No related tags found
1 merge request!11Memo helper function - get public keys
......@@ -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
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment