Class Signatory
Represents a keyholder or group of keyholders that can sign a transaction for crypto transfer to support file creation, contract creation and execution or pay for consensus services among other network tasks.
Implements
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public sealed class Signatory : IEquatable<Signatory>
Remarks
A
Signatory
is created with a pre-existing Ed25519 or ECDSA Secp256k1 private key, a combination of other signatories, or a callback action having the information necessary to successfully sign the transaction as described by its matching Endorsement requirements. RSA-3072 and
<pre><code class="lang-csharp">Contract</code></pre>
signatures are not natively supported through the
Signatory
at this time but can be achieved through the callback functionality.
Constructors
| Edit this page View SourceSignatory(KeyType, ReadOnlyMemory<byte>)
Create a signatory having a private key of the specified type.
Declaration
public Signatory(KeyType type, ReadOnlyMemory<byte> privateKey)
Parameters
| Type | Name | Description |
|---|---|---|
| KeyType | type |
should use to sign transactions. |
| ReadOnlyMemory<byte> | privateKey | The bytes of a private key corresponding to the specified type. |
Remarks
At this time, the library only supports Ed25519 and ECDSA Secp256k1 key types.
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | If any key type other than Ed25519 or ECDSA Secp256k1 is used. |
Signatory(params Signatory[])
Create a signatory that is a combination of a number of other signatories. When this signatory is called to sign a transaction it will in turn ask all the child signatories in turn to sign the given transaction.
Declaration
public Signatory(params Signatory[] signatories)
Parameters
| Type | Name | Description |
|---|---|---|
| Signatory[] | signatories | One or more signatories that when combined can form a multi key signature for the transaction. |
Signatory(Func<IInvoice, Task>)
Create a Signatory invoking the given async callback function
when asked to sign a transaction. The
Signatory
will pass an instance of an <xref href="Hiero.IInvoice" data-throw-if-not-resolved="false"></xref> containing
details of the transaction to sign when needed. The callback
function may add as many signatures as necessary to properly
sign the transaction.
Declaration
public Signatory(Func<IInvoice, Task> signingCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IInvoice, Task> | signingCallback | An async callback method that is invoked when the library asks this Signatory to sign a transaction. |
Remarks
Note: If this Signatory is attached to the IConsensusContext, it is also asked to sign the separate payment for any paid query made with that context, such as a record lookup through GetTransactionRecordAsync(ConsensusClient, TransactionId, CancellationToken, Action<IConsensusContext>?) (since it will typically represent the Payer's signature). So, work relating to one transaction can invoke this callback more than once when the caller also retrieves its record.
Signatory(ReadOnlyMemory<byte>)
Create a signatory with a private Ed25519 or ECDSA Secp256k1 key. When transactions are signed, this signatory will automatically sign the transaction with this private key.
Declaration
public Signatory(ReadOnlyMemory<byte> privateKey)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlyMemory<byte> | privateKey |
. |
Methods
| Edit this page View SourceEquals(Signatory?)
Equality implementation.
Declaration
public bool Equals(Signatory? other)
Parameters
| Type | Name | Description |
|---|---|---|
| Signatory | other |
object to compare. |
Returns
| Type | Description |
|---|---|
| bool |
object. |
Equals(object?)
Equality implementation.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
object to compare (if it is an
). |
Returns
| Type | Description |
|---|---|
| bool |
object, otherwise
. |
Overrides
| Edit this page View SourceGetEndorsements()
Retrieves a list of Endorsement (Public Keys) held internally by this Signatory (and/or its child signatories). At this time only Endorsements backed by Ed25519 and ECDSA keys are exported. If this signatory only wraps a callback method, the list returned will be empty.
Declaration
public IReadOnlyList<Endorsement> GetEndorsements()
Returns
| Type | Description |
|---|---|
| IReadOnlyList<Endorsement> | A collection of Ed25519 and/or ECDSA Endorsements, can be an empty list if none exist. |
GetHashCode()
Equality implementation.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
|
Overrides
Operators
| Edit this page View Sourceoperator ==(Signatory, Signatory)
Equals implementation.
Declaration
public static bool operator ==(Signatory left, Signatory right)
Parameters
| Type | Name | Description |
|---|---|---|
| Signatory | left |
argument. |
| Signatory | right |
argument. |
Returns
| Type | Description |
|---|---|
| bool |
objects. |
implicit operator Signatory(Func<IInvoice, Task>)
Convenience implicit cast for creating a
Signatory
directly from a
Func<IInvoice, Task> signingCallback
callback
method.
Declaration
public static implicit operator Signatory(Func<IInvoice, Task> signingCallback)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<IInvoice, Task> | signingCallback | An async callback method that is invoked when the library asks this Signatory to sign a transaction. |
Returns
| Type | Description |
|---|---|
| Signatory |
implicit operator Signatory(ReadOnlyMemory<byte>)
Convenience implicit cast for creating a
Signatory
directly from an Ed25519 or ECDSA Secp256k1 private key.
Declaration
public static implicit operator Signatory(ReadOnlyMemory<byte> privateKey)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlyMemory<byte> | privateKey |
. |
Returns
| Type | Description |
|---|---|
| Signatory |
operator !=(Signatory, Signatory)
Not equals implementation.
Declaration
public static bool operator !=(Signatory left, Signatory right)
Parameters
| Type | Name | Description |
|---|---|---|
| Signatory | left |
argument. |
| Signatory | right |
argument. |
Returns
| Type | Description |
|---|---|
| bool |
if the Key requirements are identical within each
object.
if they are not identical. |