Depends on #483
This issue will extend the Wasm API of the svm_codec.wasm to support the new Signatures Schemes.
Consequently, the svm-codec-npm will have to be extended as well (@avive FYI)
Extensions to be implemented:
- Sign the
Transaction
#[no_mangle]
pub unsafe extern "C" fn wasm_sign(tx: *mut u8, params: *mut u8) -> *mut u8 {
// ...
}
tx - a pointer to the binary Transaction (the Envelope and the Message parts).
params - a pointer to a JSON containing the data required for signing the transaction:
{
algorithm: "EdDSA",
params: {
private_key: "..."
}
}
The params Schema will consist of the keys algorithm and params.
The params is a JSON that the algorithm key will dictate its schema.
- Encode
sigdata
Given a JSON containing the Signatures, we'd like to encode them from the sigdata field.
The encoding can vary between different Templates. For now, it suffices to support the concatenate encoding.
(see svm_codec::concat_sigs under #483).
Similar to the wasm_sign the input JSON will always have keys abi and params.
The params schema will vary depending on the abi given. (again, for now we'll just deal with abi assigned to concat).
pub unsafe extern "C" fn wasm_encode_sigdata(ptr: *mut u8) -> *mut u8 {
// ...
}
{
abi: "concat"
params: {
sigs: ["...", "..."]
}
}