Struct glycos::graph::cryptograph::VertexBuilder [−][src]
pub struct VertexBuilder {
derived_public: PublicKey,
owner_recogniser: Recogniser,
derivation_builder: EphemeralKeyDerivationBuilder,
value: Option<Vec<u8>>,
owner_cek: Option<Vec<u8>>,
acl: VertexControlList,
cek: [u8; 32],
kek_ephemeral: PrivateKey,
clock: u32,
}Expand description
A builder for Vertex’.
Building a Vertex takes several distinct steps:
- Generate an owner key (taken care of by
VertexBuilder::new()); - Optionally permit access to others;
- Assign an optional value;
- Sign the vertex (using
VertexBuilder::build()).
The signing operation will return the associated owner key.
Examples
use glycos::crypto::ec::*;
use glycos::graph::cryptograph::*;
let rng = ring::rand::SystemRandom::new();
let alice = PrivateKey::generate(&rng).expect("Generate key");
let public = alice.compute_public_key().unwrap();
let (v, k): (Vertex, PrivateKey) = VertexBuilder::new(&rng, &public).unwrap()
.build(&rng, &alice).unwrap();
assert_eq!(v.check_acl(&alice).unwrap().unwrap(), k,
"`build` should return the owner key.");Fields
derived_public: PublicKeyowner_recogniser: Recogniserderivation_builder: EphemeralKeyDerivationBuildervalue: Option<Vec<u8>>owner_cek: Option<Vec<u8>>acl: VertexControlListcek: [u8; 32]kek_ephemeral: PrivateKeyclock: u32Implementations
Start the VertexBuilder process.
The master_key is the public key of the owner of the generated vertex.
The corresponding private key should be provided at the end of the VertexBuilder, in
VertexBuilder::build().
Builds a VertexBuild from an existing vertex.
This destroys the current ACL, since this cannot be recovered!
Use VertexBuilder::permit() to reinstantiate.
This operation also destroys all edges, rebuild them using EdgeBuilder!
Set the optional value of the Vertex to a binary string.
Examples
use glycos::crypto::ec::*;
use glycos::graph::cryptograph::*;
let rng = ring::rand::SystemRandom::new();
let alice = PrivateKey::generate(&rng).expect("Generate key");
let public = alice.compute_public_key().unwrap();
let (v, k): (Vertex, PrivateKey) = VertexBuilder::new(&rng, &public).unwrap()
.value(b"foaf:Person").unwrap()
.build(&rng, &alice).unwrap();Permit many to append data to this vertex
Finish the Vertex.
The passed private key should be the corresponding PrivateKey to the PublicKey passed
in VertexBuilder::new().
