Blockchain Commons GSTP TypeScript Library - v1.0.0-alpha.16
    Preparing search index...

    Class SealedEvent<T>

    A sealed event that combines an Event with sender information and state continuations for secure communication.

    import { SealedEvent, ARID } from '@bcts/gstp';
    import { XIDDocument } from '@bcts/xid';

    // Create sender XID document
    const sender = XIDDocument.new();
    const eventId = ARID.new();

    // Create a sealed event
    const event = SealedEvent.new("System notification", eventId, sender)
    .withNote("Status update")
    .withDate(new Date());

    // Convert to sealed envelope
    const envelope = event.toEnvelope(
    new Date(Date.now() + 60000), // Valid for 60 seconds
    senderPrivateKey,
    recipientXIDDocument
    );

    Type Parameters

    • T extends EnvelopeEncodableValue

      The type of content this event carries

    Implements

    Index

    Methods

    • Creates a new sealed event with the given content, ID, and sender.

      Type Parameters

      • T extends EnvelopeEncodableValue

      Parameters

      • content: T

        The content of the event

      • id: ARID

        The event ID

      • sender: XIDDocument

        The sender's XID document

      Returns SealedEvent<T>

    • Returns the date of the event.

      Returns Date | undefined

    • Creates an envelope that can be decrypted by zero or one recipient.

      Parameters

      • OptionalvalidUntil: Date

        Optional expiration date for the continuation

      • Optionalsigner: Signer

        Optional signer for the envelope

      • Optionalrecipient: XIDDocument

        Optional recipient XID document for encryption

      Returns Envelope$1

      The sealed event as an envelope

    • Creates an envelope that can be decrypted by zero or more recipients.

      Parameters

      • OptionalvalidUntil: Date

        Optional expiration date for the continuation

      • Optionalsigner: Signer

        Optional signer for the envelope

      • Optionalrecipients: XIDDocument[]

        Array of recipient XID documents for encryption

      Returns Envelope$1

      The sealed event as an envelope

    • Parses a sealed event from an encrypted envelope.

      Type Parameters

      • T extends EnvelopeEncodableValue

      Parameters

      • encryptedEnvelope: Envelope$1

        The encrypted envelope to parse

      • expectedId: ARID | undefined

        Optional expected event ID for validation

      • now: Date | undefined

        Optional current time for continuation validation

      • recipientPrivateKey: PrivateKeys

        The recipient's private keys for decryption

      • OptionalcontentExtractor: (env: Envelope$1) => T

        Function to extract content from envelope

      Returns SealedEvent<T>

      The parsed sealed event

    • Returns a string representation of the sealed event.

      Returns string