ExtendedKey.deserialize constructor
ExtendedKey.deserialize(
- String key
Take a HD key serialized according to the spec and deserialize it.
Works for both private and public keys.
Implementation
factory ExtendedKey.deserialize(String key) {
var decodedKey = Base58Codec(alphabet).decode(key);
if (decodedKey.length != lengthOfSerializedKey + lengthOfChecksum) {
throw InvalidKeyLength(
decodedKey.length, lengthOfSerializedKey + lengthOfChecksum);
}
if (equal(decodedKey.getRange(0, 4), privateKeyVersion)) {
return ExtendedPrivateKey.deserialize(Uint8List.fromList(decodedKey));
}
return ExtendedPublicKey.deserialize(Uint8List.fromList(decodedKey));
}