Blockchain Commons XID TypeScript Library - v1.0.0-alpha.20
    Preparing search index...

    Class Attachments

    A container for vendor-specific metadata attachments.

    Attachments provides a flexible mechanism for attaching arbitrary metadata to envelopes without modifying their core structure.

    Index

    Constructors

    • Creates a new empty attachments container.

      Returns Attachments

    Methods

    • Adds a new attachment with the specified payload and metadata.

      Parameters

      • payload: EnvelopeEncodableValue

        The data to attach

      • vendor: string

        A string identifying the entity that defined the attachment format

      • OptionalconformsTo: string

        Optional URI identifying the structure the payload conforms to

      Returns void

    • Adds a pre-constructed attachment envelope directly.

      Parameters

      • envelope: Envelope

        The attachment envelope to add

      Returns void

    • Retrieves an attachment by its digest.

      Parameters

      • digest: Digest

        The unique digest of the attachment to retrieve

      Returns Envelope | undefined

      The envelope if found, or undefined

    • Removes an attachment by its digest.

      Parameters

      • digest: Digest

        The unique digest of the attachment to remove

      Returns Envelope | undefined

      The removed envelope if found, or undefined

    • Removes all attachments from the container.

      Returns void

    • Returns whether the container has any attachments.

      Returns boolean

    • Returns the number of attachments in the container.

      Returns number

    • Returns an iterator over all attachment envelopes.

      Returns IterableIterator<[string, Envelope]>

    • Check equality with another Attachments container.

      Parameters

      Returns boolean

    • Adds all attachments from this container to an envelope.

      Parameters

      • envelope: Envelope

        The envelope to add attachments to

      Returns Envelope

      A new envelope with all attachments added as assertions

    • Creates an Attachments container from an envelope's attachment assertions.

      Parameters

      • envelope: Envelope

        The envelope to extract attachments from

      Returns Attachments

      A new Attachments container with the envelope's attachments