addOwnership method
Add an ownership with a secret and its authorized public keys @param {String | Uint8List} secret Secret encrypted (hexadecimal or binary buffer) @param {List
Implementation
Transaction addOwnership(dynamic secret, List<AuthorizedKey> authorizedKeys) {
if (secret is! Uint8List && secret is! String) {
throw "'secret' must be a string or Uint8List";
}
if (secret is Uint8List) {
secret = uint8ListToHex(secret);
}
for (AuthorizedKey authorizedKey in authorizedKeys) {
if (!isHex(authorizedKey.publicKey!)) {
throw "'Authorized public key' must be an hexadecimal string";
}
if (!isHex(authorizedKey.encryptedSecretKey!)) {
throw "'Encrypted secret' must be an hexadecimal string";
}
}
data!.ownerships!
.add(Ownership(secret: secret, authorizedPublicKeys: authorizedKeys));
return this;
}