ExtendedPublicKey.deserialize constructor

ExtendedPublicKey.deserialize(
  1. Uint8List key
)

Implementation

factory ExtendedPublicKey.deserialize(Uint8List key) {
  var extendedPublickey = ExtendedPublicKey(
    depth: key[4],
    parentFingerprint: sublist(key, 5, 9),
    childNumber: ByteData.view(sublist(key, 9, 13).buffer).getInt32(0),
    chainCode: sublist(key, 13, 45),
    q: _decodeCompressedECPoint(sublist(key, 45, 78)),
  );

  if (!extendedPublickey.verifyChecksum(sublist(key, 78, 82))) {
    throw InvalidChecksum();
  }

  return extendedPublickey;
}