ExtendedPrivateKey.deserialize constructor

ExtendedPrivateKey.deserialize(
  1. Uint8List key
)

Implementation

factory ExtendedPrivateKey.deserialize(Uint8List key) {
  var extendedPrivateKey = ExtendedPrivateKey(
    depth: key[4],
    parentFingerprint: sublist(key, 5, 9),
    childNumber: ByteData.view(sublist(key, 9, 13).buffer).getInt32(0),
    chainCode: sublist(key, 13, 45),
    key: utils.decodeBigIntWithSign(1, sublist(key, 46, 78)),
  );

  if (!extendedPrivateKey.verifyChecksum(sublist(key, lengthOfSerializedKey,
      lengthOfSerializedKey + lengthOfChecksum))) {
    throw InvalidChecksum();
  }

  return extendedPrivateKey;
}