pub fn encode_seed(
entropy: [u8; 16],
encoding_type: CryptoAlgorithm,
) -> XRPLCoreResult<String>
Expand description
Returns an encoded seed.
§Examples
§Basic usage
use xrpl::core::addresscodec::encode_seed;
use xrpl::core::addresscodec::exceptions::XRPLAddressCodecException;
use xrpl::constants::CryptoAlgorithm;
use xrpl::core::addresscodec::utils::SEED_LENGTH;
use xrpl::core::exceptions::XRPLCoreException;
let entropy: [u8; SEED_LENGTH] = [
207, 45, 227, 120, 251, 221, 126, 46, 232,
125, 72, 109, 251, 90, 123, 255
];
let encoding_type: CryptoAlgorithm = CryptoAlgorithm::SECP256K1;
let seed: String = "sn259rEFXrQrWyx3Q7XneWcwV6dfL".into();
let encoding: Option<String> = match encode_seed(
entropy,
encoding_type,
) {
Ok(seed) => Some(seed),
Err(e) => match e {
XRPLCoreException::XRPLAddressCodecError(XRPLAddressCodecException::UnknownSeedEncoding) => None,
_ => None,
}
};
assert_eq!(Some(seed), encoding);