Skip to content
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
Sequence diagram for encryption (no reads for).

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
Sequence diagram for encryption (with 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_for relationships 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;

Engine components