Table of Contents

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 string
publicKey ReadOnlyMemory<byte>
created DateTime
issuer string
issuerPublicKey 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

DateTime

Email

Email address of the endorsed identity.

[DataMember]
public string Email { get; }

Property Value

string

Issuer

Email address of the issuing identity.

[DataMember]
public string Issuer { get; }

Property Value

string

IssuerPublicKey

Public key of the issuing identity.

[DataMember]
public ReadOnlyMemory<byte> IssuerPublicKey { get; }

Property Value

ReadOnlyMemory<byte>

PublicKey

Public key of the endorsed identity.

[DataMember]
public ReadOnlyMemory<byte> PublicKey { get; }

Property Value

ReadOnlyMemory<byte>

Signature

The signed hash.

[DataMember]
public ReadOnlyMemory<byte> Signature { get; }

Property Value

ReadOnlyMemory<byte>

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 Endorsement
e2 Endorsement

Returns

bool

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 CertificateManager

The identity issuing the endorsement.

target UserIdentity

The identity to be endorsed.

timestamp DateTime

The timestamp to use for the creation time.

endorsement Endorsement

If 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 CertificateManager

The identity issuing the endorsement.

target UserIdentity

The identity to be endorsed.

timestamp DateTime

The timestamp to use for the creation time.

claims string[]

An (optional) set of additional claims.

endorsement Endorsement

If 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.