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

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

Open
YaronWittenstein opened this issue Dec 26, 2021 · 0 comments
Open

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

YaronWittenstein opened this issue Dec 26, 2021 · 0 comments
Assignees
Labels
AA Related to the Accounts Abstraction codec Related to the Codec simple-coin-iteration-2 svm svm-core SVM core change

Comments

@YaronWittenstein
Copy link
Contributor

YaronWittenstein commented Dec 26, 2021

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: ["...", "..."]
  }
}
@YaronWittenstein YaronWittenstein added codec Related to the Codec AA Related to the Accounts Abstraction simple-coin-iteration-2 svm svm-core SVM core change labels Dec 26, 2021
@YaronWittenstein YaronWittenstein changed the title Exend the svm-codec Wasm API Exend the svm-codec Wasm API to support Signatures Dec 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AA Related to the Accounts Abstraction codec Related to the Codec simple-coin-iteration-2 svm svm-core SVM core change
Projects
None yet
Development

No branches or pull requests

2 participants