Argyle-Software / dilithium

A post-quantum cryptographic signature scheme
Apache License 2.0
66 stars 23 forks source link

No way to serialize or restore a key pair? #11

Open adamierymenko opened 1 year ago

adamierymenko commented 1 year ago

It looks like there's no way to save/restore a Keypair. I guess this is nowhere even near production ready right?

ghost commented 1 year ago

it's pretty simple to implement your own restoration function. here's an example of how you can do so:

// src/api.rs

impl Keypair {
  // -- snip --
  pub fn restore(pub_bytes: Vec<u8>, sec_bytes: Vec<u8>) -> Self {
    Self {
      public: pub_bytes.try_into().unwrap(),
      secret: sec_bytes.try_into().unwrap(),
    }
  }
}

though, it would be really useful if this was included by default (and honestly i'm confused as to why it's not).