Interface Envelope

All Known Implementing Classes:
EnvelopeImpl

public interface Envelope
Represents a (mutable) piece of data that is stored in the network. It contains a Java object and is always signed by an agent which is the only one allowed to update the envelope. Also, a list of readers can be set up.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a reader to the envelope.
    Get the content.
    Get the identifier of the envelope.
    Get the id of the owner (signing agent) of this envelope.
    boolean
    Checks if the given agent is direct reader of this envelope.
    boolean
    Checks if the content is private (encrypted).
    void
    Removes a reader from the envelope.
    void
    Set the content.
    void
    Removes all readers from this envelope and makes the contents available for everyone (the content is not encrypted in this case).
  • Method Details

    • getIdentifier

      String getIdentifier()
      Get the identifier of the envelope.
      Returns:
      The identifier.
    • getContent

      Serializable getContent()
      Get the content.
      Returns:
      The decrypted content.
    • setContent

      void setContent(Serializable content)
      Set the content. After modifying the envelope, it should be stored using the Context.storeEnvelope(i5.las2peer.api.persistency.Envelope, i5.las2peer.api.security.Agent).
      Parameters:
      content - The content to set
    • addReader

      void addReader(Agent agent)
      Adds a reader to the envelope.
      Parameters:
      agent - The new reader.
    • revokeReader

      void revokeReader(Agent agent)
      Removes a reader from the envelope. Notice that the removed reader still has access to older versions of this envelope in the network due to consequences of a p2p network. However, the agent cannot read future changes.
      Parameters:
      agent - The reader to remove.
    • hasReader

      boolean hasReader(Agent agent)
      Checks if the given agent is direct reader of this envelope. This method does not check for transitive access (e.g. via GroupAgents).
      Parameters:
      agent - The agent to check.
      Returns:
      True, if the given agent is a reader of this envelope.
    • setPublic

      void setPublic()
      Removes all readers from this envelope and makes the contents available for everyone (the content is not encrypted in this case).
    • isPrivate

      boolean isPrivate()
      Checks if the content is private (encrypted).
      Returns:
      True, if the content is private.
    • getOwnerId

      String getOwnerId()
      Get the id of the owner (signing agent) of this envelope.
      Returns:
      Agent id of the owner.