/// Writes a threshold signing public key to the given path.
Writes a threshold signing public key to the given path.
Writes a threshold signing public key to the given path .
pub fn store_threshold_sig_pk<P: AsRef<Path>>(pk: &PublicKey, path: P) {
    let pk = ThresholdSigPublicKey::try_from(pk.clone())
        .expect("failed to parse threshold signature PK from protobuf");
    let der_bytes = threshold_sig_public_key_to_der(pk)
        .expect("failed to encode threshold signature PK into DER");
    let mut bytes = vec![];
    bytes.extend_from_slice(b"-----BEGIN PUBLIC KEY-----\r\n");
    for chunk in base64::encode(&der_bytes[..]).as_bytes().chunks(64) {
        bytes.extend_from_slice(chunk);
        bytes.extend_from_slice(b"\r\n");
    }
    bytes.extend_from_slice(b"-----END PUBLIC KEY-----\r\n");
    let path = path.as_ref();
    std::fs::write(path, bytes)
        .unwrap_or_else(|e| panic!("failed to store public key to {}: {}", path.display(), e));
}
pub fn store_threshold_sig_pk < P : AsRef < Path > > ( pk : & PublicKey , path : P ) { let pk = ThresholdSigPublicKey :: try_from ( pk . clone ( ) ) . expect ( " " ) ; let der_bytes = threshold_sig_public_key_to_der ( pk ) . expect ( " " ) ; let mut bytes = vec ! [ ] ; bytes . extend_from_slice ( b" \r \n " ) ; for chunk in base64 :: encode ( & der_bytes [ .. ] ) . as_bytes ( ) . chunks ( 64 ) { bytes . extend_from_slice ( chunk ) ; bytes . extend_from_slice ( b" \r \n " ) ; } bytes . extend_from_slice ( b" \r \n " ) ; let path = path . as_ref ( ) ; std :: fs :: write ( path , bytes ) . unwrap_or_else ( | e | panic ! ( " " path display ( ) e ) ) ; }
Writes a threshold signing public key to the given path.
Writes a threshold signing public key to the given path .
pk
&PublicKey
path
P