Juvix imports
module arch.node.engines.encryption_messages;
import prelude open;
import arch.node.types.identities open;
Encryption Messages¶
Message interface¶
type EncryptionMsg :=
  | MsgEncryptionRequest RequestEncrypt
  | MsgEncryptionReply ReplyEncrypt;
Message sequence diagrams¶
Encryption sequence (without ReadsFor evidence)¶
sequenceDiagram
    participant C as Client
    participant EE as Encryption Engine
    C->>EE: RequestEncrypt (useReadsFor: false)
    Note over EE: Encrypt commitment
    EE-->>C: ReplyEncrypt
Encryption sequence (with ReadsFor evidence)¶
sequenceDiagram
    participant C as Client
    participant EE as Encryption Engine
    participant RE as ReadsFor Engine
    C->>EE: RequestEncrypt (useReadsFor: true)
    EE->>RE: QueryReadsForEvidenceRequest
    Note over RE: Retrieve evidence
    RE-->>EE: QueryReadsForEvidenceReply
    Note over EE: Encrypt commitment using ReadsFor evidence
    EE-->>C: ReplyEncrypt
reads_for evidence).
Message types¶
RequestEncrypt¶
type RequestEncrypt :=
  mkRequestEncrypt@{
    data : Plaintext;
    externalIdentity : ExternalIdentity;
    useReadsFor : Bool;
  };
A RequestEncrypt instructs the Encryption Engine to encrypt data to a
particular external identity, possibly using known reads_for relationships.
Arguments
data:- The data to encrypt.
 externalIdentity:- The external identity requesting encryption.
 useReadsFor:- Whether to use known 
reads_forrelationships or not. 
ReplyEncrypt¶
type ReplyEncrypt :=
  mkReplyEncrypt@{
    ciphertext : Ciphertext;
    err : Option String;
  };
A ReplyEncrypt contains the data encrypted by the Encryption Engine in
response to a RequestEncrypt.
Arguments
ciphertext:- The encrypted data.
 err:- An error message if encryption failed.
 
EncryptionMsg¶
type EncryptionMsg :=
  | MsgEncryptionRequest RequestEncrypt
  | MsgEncryptionReply ReplyEncrypt;