Table of Contents

Class SignedCloudEvent<T>

Namespace
Savvyio.EventDriven.Messaging.CloudEvents.Cryptography
Assembly
Savvyio.EventDriven.Messaging.dll

Provides a default implementation of the ISignedCloudEvent<T> interface.

public record SignedCloudEvent<T> : CloudEvent<T>, IEquatable<Acknowledgeable>, IEquatable<CloudEvent>, IEquatable<CloudEvent<T>>, ISignedCloudEvent<T>, ICloudEvent<T>, IDictionary<string, object>, ICollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable, ISignedMessage<T>, IMessage<T>, IAcknowledgeable, IEquatable<SignedCloudEvent<T>> where T : IIntegrationEvent

Type Parameters

T

The type of the payload constraint to the IIntegrationEvent interface.

Inheritance
SignedCloudEvent<T>
Implements
Inherited Members
Extension Methods

Examples

This example shows how to wrap a CloudEvent together with the signature that protects its serialized envelope.

using System;
using Savvyio;
using Savvyio.EventDriven;
using Savvyio.EventDriven.Messaging.CloudEvents;
using Savvyio.EventDriven.Messaging.CloudEvents.Cryptography;
using Savvyio.Messaging;

namespace ExampleApp;

public sealed class SignedCloudEventExample
{
    public ISignedCloudEvent<MemberCreatedEvent> Create()
    {
        var message = new Message<MemberCreatedEvent>("msg-42", new Uri("https://api.example.com/members"), "members.created", new MemberCreatedEvent("MEM-42"));
        var cloudEvent = message.ToCloudEvent();
        return new SignedCloudEvent<MemberCreatedEvent>(cloudEvent, "signature-value");
    }
}

public sealed record MemberCreatedEvent(string MemberId) : Request, IIntegrationEvent;

Constructors

SignedCloudEvent(ICloudEvent<T>, string)

Initializes a new instance of the SignedCloudEvent<T> class.

public SignedCloudEvent(ICloudEvent<T> message, string signature)

Parameters

message ICloudEvent<T>

The cloud event to sign.

signature string

The cryptographic signature of the message.

Exceptions

ArgumentNullException

message cannot be null - or - signature cannot be null.

ArgumentException

signature cannot be empty or consist only of white-space characters.

Properties

Signature

Gets the cryptographic signature of the message.

public string Signature { get; }

Property Value

string

The cryptographic signature of the message.

See Also