#![doc(html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo_small.png")]
#![deny(warnings)]
#![forbid(unsafe_code)]
extern crate curve25519_dalek;
extern crate hex;
extern crate hkdf;
extern crate num_bigint;
extern crate rand;
extern crate sha2;
use curve25519_dalek::constants::ED25519_BASEPOINT_POINT;
use curve25519_dalek::edwards::CompressedEdwardsY;
use curve25519_dalek::edwards::EdwardsPoint as c2_Element;
use curve25519_dalek::scalar::Scalar as c2_Scalar;
use hkdf::Hkdf;
use rand::{CryptoRng, OsRng, Rng};
use sha2::{Digest, Sha256};
use std::fmt;
use std::ops::Deref;
/* "newtype pattern": it's a Vec, but only used for a specific argument
* type, to distinguish between ones that are meant as passwords, and ones
* that are meant as identity strings */
#[derive(PartialEq, Eq, Clone)]
pub struct Password(Vec);
impl Password {
pub fn new(p: &[u8]) -> Password {
Password(p.to_vec())
}
}
impl Deref for Password {
type Target = Vec;
fn deref(&self) -> &Vec {
&self.0
}
}
#[derive(PartialEq, Eq, Clone)]
pub struct Identity(Vec);
impl Deref for Identity {
type Target = Vec;
fn deref(&self) -> &Vec {
&self.0
}
}
impl Identity {
pub fn new(p: &[u8]) -> Identity {
Identity(p.to_vec())
}
}
#[derive(Debug, PartialEq, Eq)]
pub enum ErrorType {
BadSide,
WrongLength,
CorruptMessage,
}
#[derive(Debug, PartialEq, Eq)]
pub struct SPAKEErr {
pub kind: ErrorType,
}
pub trait Group {
type Scalar;
type Element;
//type Element: Add