Interface TransactionSigner<P extends PrivateKeyable>
- All Known Subinterfaces:
SignatureService<PK>
- All Known Implementing Classes:
AbstractSignatureService,AbstractTransactionSigner,BcDerivedKeySignatureService,BcSignatureService
-
Method Summary
Modifier and TypeMethodDescriptionderivePublicKey(P privateKeyable) Accessor for the public-key corresponding to the supplied key meta-data.<T extends Transaction>
SignatureGet a signature for the supplied unsigned transaction using the suppliedTransactionSigner.multiSignInner(P privateKeyable, Batch batchTransaction) Obtain a multi-signature for a batch transaction using the suppliedTransactionSigner.default <T extends Transaction>
SignermultiSignToSigner(P privateKeyable, T transaction) Deprecated.sign(P privateKeyable, UnsignedClaim unsignedClaim) Signs a claim for usage in a Payment Channel.sign(P privateKeyable, Attestation attestation) Sign attestations for cross-chain account creation or transfers.<T extends Transaction>
SingleSignedTransaction<T> Get a transaction with a single-sig usingprivateKeyable.Get a signature for a batch transaction using the suppliedTransactionSigner.
-
Method Details
-
derivePublicKey
Accessor for the public-key corresponding to the supplied key meta-data. This method exists to support implementations that hold private-key material internally yet need a way for external callers to determine the actual public key for signature verification or other purposes.- Parameters:
privateKeyable- APrivateKeyableto derive a public key from.- Returns:
- A
PublicKey.
-
sign
Get a transaction with a single-sig usingprivateKeyable.- Type Parameters:
T- The typeTransactionto be signed.- Parameters:
privateKeyable- TheTransactionSignerused to signtransaction.transaction- TheTransactionto sign.- Returns:
- A
SingleSignedTransactionof typeTransactionSignercontaining everything related to a signed transaction.
-
sign
Signs a claim for usage in a Payment Channel.- Parameters:
privateKeyable- ATransactionSignerused for signing.unsignedClaim- AnUnsignedClaim.- Returns:
- A
Signature.
-
sign
Sign attestations for cross-chain account creation or transfers.This method will be marked
Betauntil the featureXChainBridge amendment is enabled on mainnet. Its API is subject to change.- Parameters:
privateKeyable- TheTransactionSignerused to signattestation.attestation- AnAttestationto sign.- Returns:
- A
Signature.
-
signInner
Get a signature for a batch transaction using the suppliedTransactionSigner.Per XLS-0056, BatchSigners sign a specific format: HashPrefix::batch + flags + count + inner tx IDs. This differs from both single-signing and multi-signing.
This method will be marked
Betauntil the featureBatch amendment is enabled on mainnet. Its API is subject to change.- Parameters:
privateKeyable- TheTransactionSignerused to signbatchTransaction.batchTransaction- TheBatchtransaction to sign.- Returns:
- A
Signaturefor the batch transaction.
-
multiSign
Get a signature for the supplied unsigned transaction using the suppliedTransactionSigner. The primary reason this method's signature diverges fromsign(PrivateKeyable, Transaction)is that for multi-sign scenarios, the interstitially signed transaction is always discarded. Instead, a quorum of signatures is needed, and then that quorum is submitted to the ledger with the unsigned transaction. Thus, getting a multi-signed transaction here is not useful and is not returned from this interface. Note thatSignatureUtilscan be used to assemble and obtain the bytes for a multi-signed transaction (these diverge slightly from the bytes of a single-signed transaction).- Type Parameters:
T- The type of the transaction to be signed.- Parameters:
privateKeyable- TheTransactionSignerused to signtransaction.transaction- TheTransactionto sign.- Returns:
- A
Signaturefor the transaction.
-
multiSignInner
Obtain a multi-signature for a batch transaction using the suppliedTransactionSigner.This is used when a multi-sig account acts as a BatchSigner with nested Signers. Per rippled's checkBatchMultiSign, this uses batch serialization (HashPrefix::batch + flags + count + tx IDs) followed by appending the signer's account ID.
This method will be marked
Betauntil the featureBatch amendment is enabled on mainnet. Its API is subject to change.- Parameters:
privateKeyable- TheTransactionSignerused to signbatchTransaction.batchTransaction- TheBatchtransaction to sign.- Returns:
- A
Signaturefor the batch transaction with multi-sig format.
-
multiSignToSigner
@Deprecated default <T extends Transaction> Signer multiSignToSigner(P privateKeyable, T transaction) Deprecated.UsemultiSign(PrivateKeyable, Transaction)instead and assemble aSignermanually. This will allow callers to better manage public-key derivation, especially for derived key scenarios like an HSM where public-key derivation is expensive and may only need to be done once for multiple multi-sig operations.Obtain a signature for the supplied unsigned transaction using the suppliedTransactionSigner.As is the case with
multiSign(PrivateKeyable, Transaction), the primary reason this method's signature diverges fromsign(PrivateKeyable, Transaction)is that for multi-sign scenarios, the interstitially signed transaction is always discarded. Instead, a quorum of signatures is need and then that quorum is submitted to the ledger with the unsigned transaction. Thus, obtaining a multi-signed transaction here is not useful and is not returned from this interface. Note thatSignatureUtilscan be used to assemble and obtain the bytes for a multi-signed transaction (these diverge slightly from the bytes of a single-signed transaction).This method is nearly identical to
multiSign(PrivateKeyable, Transaction)except that its return-type is aSigner, which is more convenient for submitting transactions to the XRP Ledger. Note however that this method internally callsderivePublicKey(PrivateKeyable), which in certain remote-key configurations (e.g., storing keys in a remote HSM) involves a potentially expensive remote call to the HSM. In most scenarios, the public key will already be available, so callers of this method should consider usingmultiSign(PrivateKeyable, Transaction)instead if public-key derivation is a performance concern.- Type Parameters:
T- The type of the transaction to be signed.- Parameters:
privateKeyable- TheTransactionSignerused to signtransaction.transaction- TheTransactionto sign.- Returns:
- A
Signaturefor the transaction.
-
multiSign(PrivateKeyable, Transaction)instead and assemble aSignermanually.