Juvix imports
module arch.node.engines.decryption;
import prelude open;
import arch.node.types.engine open;
import arch.node.engines.decryption_config open public;
import arch.node.engines.decryption_messages open public;
import arch.node.engines.decryption_environment open public;
import arch.node.engines.decryption_behaviour open public;
import arch.node.types.anoma as Anoma open;
open decryption_config_example;
open decryption_environment_example;
Decryption Engine¶
The Decryption engine handles decryption of data encrypted to a specific identity. Decryption engine instances are generated by the Identity Management Engine when an identity is generated or connected.
Purpose¶
The Decryption Engine maintains decryption capabilities for a specific identity and handles decryption requests for that identity. Only the original caller and anyone to whom they pass the engine instance reference can send messages to the instance and decrypt data encrypted to the corresponding identity.
Components¶
Type¶
DecryptionEngine : Type :=
Engine
DecryptionCfg
DecryptionLocalState
DecryptionMailboxState
DecryptionTimerHandle
DecryptionActionArguments
Anoma.Msg
Anoma.Cfg
Anoma.Env;
Example of a decryption engine¶
exampleDecryptionEngine : DecryptionEngine :=
mkEngine@{
cfg := decryptionCfg;
env := decryptionEnv;
behaviour := decryptionBehaviour;
};
where decryptionCfg
is defined as follows:
decryptionCfg : EngineCfg DecryptionCfg :=
mkEngineCfg@{
node := Curve25519PubKey "0xabcd1234";
name := "decryption";
cfg :=
mkDecryptionCfg@{
decryptor :=
mkDecryptor@{
decrypt := \{_ x := some x};
};
backend := BackendLocalMemory;
};
};
decryptionEnv
is defined as follows:
decryptionEnv : DecryptionEnv :=
mkEngineEnv@{
localState := unit;
mailboxCluster := Map.empty;
acquaintances := Set.empty;
timers := [];
};
and decryptionBehaviour
is defined as follows:
decryptionBehaviour : DecryptionBehaviour :=
mkEngineBehaviour@{
guards := First [decryptGuard];
};