deserializeKey static method
Deserialize a serialized SLIP-32 key.
This method takes a Bech32-encoded string serKeyStr
representing a serialized SLIP-32 key
and the network versions keyNetVer
. It deserializes the key, extracts its components, and
returns a Slip32DeserializedKey
object containing the key bytes, derivation path, chain code,
and an indicator if the key is public.
Implementation
static Slip32DeserializedKey deserializeKey(
String serKeyStr,
Slip32KeyNetVersions keyNetVer,
) {
final bool isPublic = _getIfPublic(serKeyStr, keyNetVer);
final List<int> serKeyBytes = Bech32Decoder.decode(
isPublic ? keyNetVer.public : keyNetVer.private, serKeyStr);
// Get parts back
final List<dynamic> keyParts = _getPartsFromBytes(serKeyBytes, isPublic);
final List<int> keyBytes = keyParts[0];
final Bip32Path path = keyParts[1];
final Bip32ChainCode chainCode = keyParts[2];
return Slip32DeserializedKey(keyBytes, path, chainCode, isPublic);
}