renewGroupKey method
Renews the group's private key. Can only be done by a group administrator. Should be called after removing members from the group.
groupId
- The group for which to renew the private key.
privateKeys
- Optional. Pre-generated private keys, returned by a call to SealdSdk.generatePrivateKeysAsync.
Implementation
void renewGroupKey(String groupId, {SealdGeneratedPrivateKeys? privateKeys}) {
if (_closed) {
throw SealdException(
code: "INSTANCE_CLOSED",
id: "FLUTTER_INSTANCE_CLOSED",
description: "Instance already closed.");
}
final Pointer<Utf8> nativeGroupId = groupId.toNativeUtf8();
final Pointer<Utf8> nativeEncryptionKey =
privateKeys?.encryptionKey.toNativeUtf8() ?? nullptr;
final Pointer<Utf8> nativeSigningKey =
privateKeys?.signingKey.toNativeUtf8() ?? nullptr;
final Pointer<Pointer<NativeSealdError>> err =
calloc<Pointer<NativeSealdError>>();
final int resultCode = _bindings.SealdSdk_RenewGroupKey(_ptr.pointer(),
nativeGroupId, nativeEncryptionKey, nativeSigningKey, err);
calloc.free(nativeGroupId);
calloc.free(nativeEncryptionKey);
calloc.free(nativeSigningKey);
if (resultCode != 0) {
throw SealdException._fromCPtr(err);
} else {
calloc.free(err);
}
}