#[encrypted_library]
mod arcis_library {
#[allow(non_snake_case)]
pub struct ArcisEd25519Signature {
R_encoded: [u8; 32],
S: [u8; 32],
}
#[allow(non_snake_case, clippy::manual_memcpy)]
impl ArcisEd25519Signature {
pub fn from_bytes(bytes: [u8; 64]) -> Self {
let mut R_encoded = [0u8; 32];
let mut S = [0u8; 32];
for i in 0..32 {
R_encoded[i] = bytes[i];
S[i] = bytes[32 + i];
}
Self { R_encoded, S }
}
pub fn to_bytes(self) -> [u8; 64] {
let mut bytes = [0u8; 64];
for i in 0..32 {
bytes[i] = self.R_encoded[i];
bytes[32 + i] = self.S[i];
}
bytes
}
}
pub struct SecretKey {
secret_key: [u8; 32],
}
impl SecretKey {
pub fn from_bytes(bytes: [u8; 32]) -> Self {
SecretKey { secret_key: bytes }
}
pub fn new_rand() -> Self {
let mut bytes = [0u8; 32];
for b in bytes.iter_mut() {
*b = ArcisRNG::gen_integer_from_width(8) as u8;
}
SecretKey { secret_key: bytes }
}
}
pub struct SigningKey {
secret_key: SecretKey,
}
impl SigningKey {
#[allow(dead_code)]
pub fn new(value: SecretKey) -> Self {
Self { secret_key: value }
}
#[arcis_circuit = "sign"]
pub fn sign(&self, message: &[u8]) -> ArcisEd25519Signature {}
}
pub struct MXESigningKey {}
impl MXESigningKey {
#[arcis_circuit = "mxe-sign"]
pub fn sign(message: &[u8]) -> ArcisEd25519Signature {}
}
pub struct VerifyingKey {
public_key_encoded: [u8; 32],
}
impl VerifyingKey {
#[arcis_circuit = "verifying_key_from_secret_key"]
pub fn from_secret_key(secret_key: &SecretKey) -> Self {}
#[arcis_circuit = "verify"]
pub fn verify(&self, message: &[u8], signature: &ArcisEd25519Signature) -> bool {}
}
}