pub struct AnnihlKey {
pub solution: Solution,
/* private fields */
}Expand description
An AnnihlKey represents the mined proof-of-work solution
and elliptic curve point of an annihilative key.
Fields§
§solution: SolutionSerialised proof-of-work solution.
Implementations§
Source§impl AnnihlKey
impl AnnihlKey
Sourcepub fn new(solution: Solution, base_point: EdwardsPoint) -> Self
pub fn new(solution: Solution, base_point: EdwardsPoint) -> Self
Construct a new AnnihlKey from a mined proof-of-work solution
and shared base curve point.
Sourcepub fn new_pair(ikm: &[u8], iam: &[u8], constraint: u8) -> (Self, Self)
pub fn new_pair(ikm: &[u8], iam: &[u8], constraint: u8) -> (Self, Self)
Derive a new annihilative pair from keying material.
Returns a pair that satisfies the given proof-of-work constraint, where
each AnnihlKey consists of the mined Solution, and an EdwardsPoint
at an offset from the pair’s shared base curve point.
Sourcepub fn verify(&self, other: &Self) -> Result<[u8; 32], AnnihlErr>
pub fn verify(&self, other: &Self) -> Result<[u8; 32], AnnihlErr>
Verify that two annihilative keys form a valid pair.
First checks that both members share the same base curve point, then checks if the hash of their XOR satisfies the proof-of-work constraint.
Returns the XOR hash as an artifact on success, or an error when the members do not form a valid annihilative pair.
Sourcepub fn authenticate(&self, keying_material: &[u8]) -> Result<(), AnnihlErr>
pub fn authenticate(&self, keying_material: &[u8]) -> Result<(), AnnihlErr>
Authenticate than an AnnihlKey was derived from given keying material.
Returns an error if the annihilative key could not be authenticated by the keying material.
Sourcepub fn to_annihilation(&self, other: &Self) -> Result<[u8; 32], AnnihlErr>
pub fn to_annihilation(&self, other: &Self) -> Result<[u8; 32], AnnihlErr>
Compute an annihilation key from an annihilative pair.
Verifies the pair, then computes an Hmac of the verification artifact, keyed by the sum of both curve points. Requires both a key and antikey to compute. As long as one half of the annihilative pair remains secret, the secrecy of the derived annihilation key is preserved.
Returns the MAC as the annihilation key on success, or an error when the pair is invalid or the proof-of-work constraint is not satisfied.
Sourcepub fn into_annihilation(self, other: Self) -> Result<[u8; 32], AnnihlErr>
pub fn into_annihilation(self, other: Self) -> Result<[u8; 32], AnnihlErr>
Compute an annihilation key from an annihilative pair, consuming both keys.
Convenience method that consumes ownership of both keys while
delegating to to_annihilation.
Returns the MAC as the annihilation key on success, or an error when the pair is invalid or the proof-of-work constraint is not satisfied.
Sourcepub fn to_edwards_point(&self) -> EdwardsPoint
pub fn to_edwards_point(&self) -> EdwardsPoint
Return this AnnihlKey’s curve point as an EdwardsPoint.