diff options
author | Eduardo Julian | 2018-12-30 23:30:57 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-12-30 23:30:57 -0400 |
commit | f2f0fbe5eb47e9e9d9aad2729a83b44a4b51652c (patch) | |
tree | b8f363cdbdd0414c87fc65705b7e9f8ee97b8c1a /stdlib/source | |
parent | 9b2201a843a812cfd0d9d9359f4ac388080e9ea2 (diff) |
Added library for handling identities for values in foreign data-stores.
Diffstat (limited to 'stdlib/source')
-rw-r--r-- | stdlib/source/lux/control/identity.lux | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/stdlib/source/lux/control/identity.lux b/stdlib/source/lux/control/identity.lux new file mode 100644 index 000000000..da7445bc7 --- /dev/null +++ b/stdlib/source/lux/control/identity.lux @@ -0,0 +1,53 @@ +(.module: + [lux #* + [control + [equivalence (#+ Equivalence)] + [security + [capability (#+ Capability)]]] + [type + abstract]]) + +(abstract: #export (ID code entity storage) + {#.doc "A value that uniquely identifies an entity in some foreign data storage (such as a database)."} + + code + + (structure: #export (Equivalence<ID> Equivalence<code>) + (All [code entity storage] + (-> (Equivalence code) + (Equivalence (ID code entity storage)))) + (def: (= reference sample) + (:: Equivalence<code> = + (:representation reference) + (:representation sample)))) + + (type: #export (Can-Identify code storage) + (All [entity] + (Capability code + (ID code entity storage)))) + + (type: #export (Can-Anonymize code storage) + (All [entity] + (Capability (ID code entity storage) + code))) + + (type: #export (Service code storage) + [(Can-Identify code storage) + (Can-Anonymize code storage)]) + + (def: Service<_> + Service + [(|>> :abstraction) + (|>> :representation)]) + + (type: #export (Context code scope storage) + (-> (Service code storage) + (scope storage))) + + (def: #export (with-identity context) + (All [code scope] + (Ex [storage] + (-> (Context code scope storage) + (scope storage)))) + (context ..Service<_>)) + ) |