fromMultiEd25519PublicKey static method
Converts a K-of-N MultiEd25519PublicKey to AuthenticationKey with:
auth_key = sha3-256(p_1 | … | p_n | K | 0x01)
. K
represents the K-of-N required for
authenticating the transaction. 0x01
is the 1-byte scheme for multisig.
Implementation
static AuthenticationKey fromMultiEd25519PublicKey(MultiEd25519PublicKey publicKey) {
Uint8List pubKeyBytes = publicKey.toBytes();
final bytes = Uint8List(pubKeyBytes.length + 1);
bytes.setAll(0, pubKeyBytes);
bytes.setAll(pubKeyBytes.length, [AuthenticationKey.MULTI_ED25519_SCHEME]);
final sha3Hash = SHA3Digest(256);
return AuthenticationKey(sha3Hash.process(bytes));
}