Skip to content
This repository was archived by the owner on Aug 14, 2023. It is now read-only.
This repository was archived by the owner on Aug 14, 2023. It is now read-only.

Exend the svm-codec Wasm API to support Signatures #482

@YaronWittenstein

Description

@YaronWittenstein

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:

  1. 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.

  1. 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: ["...", "..."]
  }
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions