Function rusty_secrets::wrapped_secrets::recover_secret[][src]

pub fn recover_secret(
    shares: &[String],
    verify_signatures: bool
) -> Result<SecretProto>

Recovers the secret from a k-out-of-n Shamir's secret sharing.

At least k distinct shares need to be provided to recover the share.

Examples

use rusty_secrets::wrapped_secrets::recover_secret;

let share1 = "2-1-Cha7s14Q/mSwWko0ittr+/Uf79RHQMIP".to_string();
let share2 = "2-4-ChaydsUJDypD9ZWxwvIICh/cmZvzusOF".to_string();
let shares = vec![share1, share2];

match recover_secret(&shares, false) {
    Ok(secret) => {
        // Do something with the secret
    },
    Err(e) => {
        // Deal with the error
    }
}