Skip to content
Juvix imports

module arch.node.engines.encryption_config;

import prelude open;
import arch.node.engines.encryption_messages open;
import arch.node.types.engine open;
import arch.node.types.messages open;
import arch.node.types.identities open;
import arch.system.identity.identity open hiding {ExternalIdentity};

Encryption Configuration

Overview

The Encryption engine configuration contains static information for Encryption engine instances.

The Encryption Local Configuration

The configuration of an Encryption Engine instance includes the identity's encryption capabilities, the address of an associated ReadsFor engine, and a specific backend.

EncryptionLocalCfg

The type for engine-specific local configuration.

type EncryptionLocalCfg :=
mk@{
encryptor
: Set ReadsForEvidence
-> ExternalIdentity
-> Encryptor ByteString Backend Plaintext Ciphertext;
backend : Backend;
readsForEngineAddress : EngineID;
};
Arguments
encryptor:
Function to generate encryptor for a set of evidence and an identity.
backend:
The backend to use for encryption.
readsForEngineAddress:
The address of the associated ReadFor engine.

The Encryption Configuration

EncryptionCfg

EncryptionCfg : Type := EngineCfg EncryptionLocalCfg;

Instantiation

encryptionCfg : EncryptionCfg :=
EngineCfg.mk@{
node := PublicKey.Curve25519PubKey "0xabcd1234";
name := "encryption";
cfg :=
EncryptionLocalCfg.mk@{
encryptor :=
\{_ _ :=
Encryptor.mkEncryptor@{
encrypt := \{_ x := x};
encryptorHash :=
HASH.mkHASH@{
ordKey :=
OrdKey.mkOrdKey@{
compare := Ord.compare;
};
hash := \{x := "0x1234abcd"};
};
}};
backend := Backend.LocalMemory;
readsForEngineAddress := mkPair none "Blah";
};
};