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:

  1. Generate an owner key (taken care of by VertexBuilder::new());
  2. Optionally permit access to others;
  3. Assign an optional value;
  4. 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: u32

Implementations

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 Bob to append data to this vertex

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().

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.