Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function signMessage (publicKey: Uint8Array, nonce: BN | number, value: Uint8Array, apiSupport: EncodingVersions): Signed {
const message = encodeCall(publicKey, nonce, value, apiSupport);
const signature = keyring.getPair(publicKey).sign(message);
const data = u8aConcat(
prefixes.publicKey,
message,
signature
);
console.log(`signMessage (${apiSupport}) : message :: ${u8aToHex(message)}`);
console.log(`signMessage (${apiSupport}) : signature :: ${u8aToHex(signature)}`);
console.log(`signMessage (${apiSupport}) : data :: ${u8aToHex(data)}`);
return {
data: u8aConcat(
bnToU8a(data.length, 32, true),
data
),