Skip to content

Support for external signers #83

@zorba128

Description

@zorba128

Library should support scenario with signing process detatched from transaction building:

  • transaction gets prepared
  • it gets serialized without signatures and delivered to signer component
  • signer generates and returns signatures
  • signatures are attached, transaction is broadcasted

To support that scenario:

  • Message.setFeePayer should accept public key only (private key is not needed at that stage)
  • Transaction.sign should allow adding signature to already constructed message
  • Message.deserialize and/or Transaction.deserialize is needed

Actually there are few more issues that might be cleaned up

  • note Transaction and TransactionBuilder provide same functionality. I'd suggest removing mutation methods from Transaction, and keep only signing and serialization logic there.
  • Transaction.sign mutates underlying message (setFeePayer); rather than that, it should just sign whatever is already there; if fee payer needs to be applied, it might be done during building stage
  • note the Transaction actually might operate on serialized message; this would also solve its problematic lifecycle, with NPE thrown if serialize is called without sign()

See #78 - it probably was requested for same reason

Take a look at recent commits at my fork: https://github.com/zorba128/solanaj/tree/signatures

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions