virtualeconomy / js-v-sdk

[DEPRECATED and please use https://github.com/virtualeconomy/js-vsys instead] Java Script library for V Systems
https://www.npmjs.com/package/@virtualeconomy/js-v-sdk
MIT License
10 stars 5 forks source link

Read transaction attachment #45

Closed vipertechofficial closed 3 years ago

vipertechofficial commented 3 years ago

Is it possible to implement a methods to get the clear text of a transactions attachment, I think it uses the public key of the receiver but how could we decrypt this?

SheldonYS commented 3 years ago

Just decode with base58. All attachments are shown as base58 format to avoid invisible char showing.

0x100cc commented 3 years ago

Here is the sample code

import base58 from 'base-58'
import converters from '@/js-v-sdk/src/utils/converters'
let bytes = base58.decode(attachment)
value = converters.byteArrayToString(bytes)