Class Endorsement
- Namespace
- MarymoorStudios.Core.Rpc.Identity
- Assembly
- MarymoorStudios.Core.Rpc.Identity.dll
[DataContract]
public sealed class Endorsement
- Inheritance
-
Endorsement
- Inherited Members
Constructors
Endorsement(string, ReadOnlyMemory<byte>, DateTime, string, ReadOnlyMemory<byte>, ReadOnlyMemory<byte>, string[]?)
public Endorsement(string email, ReadOnlyMemory<byte> publicKey, DateTime created, string issuer, ReadOnlyMemory<byte> issuerPublicKey, ReadOnlyMemory<byte> signature, string[]? claims = null)
Parameters
email
stringpublicKey
ReadOnlyMemory<byte>created
DateTimeissuer
stringissuerPublicKey
ReadOnlyMemory<byte>signature
ReadOnlyMemory<byte>claims
string[]
Properties
Claims
An (optional) set of additional claims.
[DataMember]
public string[]? Claims { get; }
Property Value
- string[]
Created
Date the endorsement was created.
[DataMember]
public DateTime Created { get; }
Property Value
Email address of the endorsed identity.
[DataMember]
public string Email { get; }
Property Value
Issuer
Email address of the issuing identity.
[DataMember]
public string Issuer { get; }
Property Value
IssuerPublicKey
Public key of the issuing identity.
[DataMember]
public ReadOnlyMemory<byte> IssuerPublicKey { get; }
Property Value
PublicKey
Public key of the endorsed identity.
[DataMember]
public ReadOnlyMemory<byte> PublicKey { get; }
Property Value
Signature
The signed hash.
[DataMember]
public ReadOnlyMemory<byte> Signature { get; }
Property Value
Methods
PublicKeyEquals(Endorsement, Endorsement)
Returns true if the two endorsements have the same public keys.
public static bool PublicKeyEquals(Endorsement e1, Endorsement e2)
Parameters
e1
Endorsemente2
Endorsement
Returns
TryCreate(CertificateManager, UserIdentity, DateTime, out Endorsement)
Creates an endorsement for a given identity.
public static bool TryCreate(CertificateManager issuer, UserIdentity target, DateTime timestamp, out Endorsement endorsement)
Parameters
issuer
CertificateManagerThe identity issuing the endorsement.
target
UserIdentityThe identity to be endorsed.
timestamp
DateTimeThe timestamp to use for the creation time.
endorsement
EndorsementIf successful, the endorsement.
Returns
- bool
True is successful, false otherwise.
Remarks
The issuer
MUST include a private key.
TryCreate(CertificateManager, UserIdentity, DateTime, string[], out Endorsement)
Creates an endorsement for a given identity.
public static bool TryCreate(CertificateManager issuer, UserIdentity target, DateTime timestamp, string[] claims, out Endorsement endorsement)
Parameters
issuer
CertificateManagerThe identity issuing the endorsement.
target
UserIdentityThe identity to be endorsed.
timestamp
DateTimeThe timestamp to use for the creation time.
claims
string[]An (optional) set of additional claims.
endorsement
EndorsementIf successful, the endorsement.
Returns
- bool
True is successful, false otherwise.
Remarks
The issuer
MUST include a private key.
Validate(CertificateManager)
Validates an endorsement.
public bool Validate(CertificateManager certMgr)
Parameters
certMgr
CertificateManager
Returns
- bool
True if the endorsement is valid, false otherwise.