Open
Description
Happy friday Scatter team!
We are trying to sign arbitrary data with Scatter.
We use scatter.getArbitrarySignature
. It works well for any strings that have less than 12 chars per word.
In our case, we need to sign larger JSON messages, so the limitation becomes tricky. The documentation mentions that the limitation applies to strings.
Not sure if we can pass other data types to it.
I already tried to pass in plain Node.js Buffers and Uint8 Arrays created with eos.Serialize.SerialBuffer
, but no luck so far.
Why is the limitation of 12 chars there? Any ideas how to solve this issue?
Example:
const publicKey = 'PUBLIC_KEY'
const data = '{"foo":"bar","type":"candy","price":"100000000","amount": "1.00000000000000"}'
const sig = await scatter.getArbitrarySignature(publicKey, data)
console.log(data, sig, publicKey)
Example with Uint8 Binary data
const publicKey = 'PUBLIC_KEY'
const { TextDecoder, TextEncoder } = require('util')
const { Serialize } = require('eosjs')
const sb = new Serialize.SerialBuffer({
textEncoder: new TextEncoder(),
textDecoder: new TextDecoder()
})
const data = '{"foo":"bar","type":"candy","price":"100000000","amount": "1.00000000000000"}'
sb.pushString(data)
const array = sb.asUint8Array()
const sig = await scatter.getArbitrarySignature(publicKey, array)
console.log(array, sig, publicKey)
Metadata
Metadata
Assignees
Labels
No labels