Make Signer Trait more flexible on asn1 formating
antiphoton opened this issue · comments
The js_signer mod formats signature as asn1 in the rust code, because the current TypeScript implementation does not do the asn1 formatting.
However, there is a posibility that some JavaScript signer already includes the asn1 formatting. We should provide the flexibility to disable the asn1 formatting in the Rust code.
Instead of having the single JsSigner::new, we can make the change to have two public constructors
impl JsSigner {
// The JS function should be of type
// `(input: Uint8Array) => Promise<Uint8Array>`.
// The JS function returns the raw signature, which contains exactly 64 bytes.
pub fn new(js_function: JsFunction) -> Self {
todo!()
}
// The JS function should be of type
// `(input: Uint8Array) => Promise<Uint8Array>`.
// The JS function returns the signature in ASN1 format.
pub fn new_with_asn1(js_function: JsFunction) -> Self {
todo!()
}
}
This sounds reasonable.