js-algorand-sdk icon indicating copy to clipboard operation
js-algorand-sdk copied to clipboard

Support attaching signatures to transactions

Open jasonpaulos opened this issue 3 years ago • 0 comments

Summary

This SDK has the ability to create a signed transaction given a private key using the Transaction.signTxn method. However, we should also support use cases where the SDK does not have access the private key, such as if the key is on another system or stored in a hardware wallet.

We can support this by providing a function which creates a signed transaction based on an arbitrary signature, which can be computed elsewhere.

Scope

I propose creating the following new method on the Transaction class:

  • attachSignature(signerAddr: string, signature: Uint8Array): Uint8Array
    • Create a signed transaction using an existing signature. This would be very similar to the existing signTxn method, except it accepts the signature as an input. And if signerAddr is not the same as the sender of the transaction, the auth addr (sgnr) field should be set on the signed transaction.

A related issue is #412, which is to add similar functionality for MultiSig accounts.

jasonpaulos avatar Oct 05 '21 21:10 jasonpaulos