Ed25519KholawPublicKey.fromBytes constructor
Factory method for creating an Ed25519-KholawPublicKey from a byte array. It checks the length and prefix of the provided keyBytes to ensure validity. If the keyBytes include a public key prefix, it removes it before creating the instance.
Implementation
factory Ed25519KholawPublicKey.fromBytes(List<int> keyBytes) {
if (keyBytes.length ==
Ed25519KeysConst.pubKeyByteLen +
Ed25519KeysConst.pubKeyPrefix.length &&
keyBytes[0] == Ed25519KeysConst.pubKeyPrefix[0]) {
keyBytes = keyBytes.sublist(1);
}
return Ed25519KholawPublicKey._(
EDDSAPublicKey(Curves.generatorED25519, keyBytes));
}