renewKeysAsync method

Future<void> renewKeysAsync({
  1. Uint8List? preparedRenewal,
  2. SealdGeneratedPrivateKeys? privateKeys,
  3. Duration expireAfter = const Duration(days: 5 * 365),
})

Renews the keys of the current device, extending their validity. If the current device has expired, you will need to call renewKeys before you are able to do anything else. Warning: if the identity of the current device is stored externally, for example on SSKS, you will want to re-export it and store it again, otherwise the previously stored identity will not be recognized anymore.

preparedRenewal - Optional. A prepared renewal, returned by a call to SealdSdk.prepareRenew. If preparedRenewal is given, privateKeys will be ignored. privateKeys - Optional. Pre-generated private keys, returned by a call to SealdSdk.generatePrivateKeysAsync. expireAfter - The duration during which the renewed device key will be valid without further renewal. Optional, defaults to 5 years.

Implementation

Future<void> renewKeysAsync({
  Uint8List? preparedRenewal,
  SealdGeneratedPrivateKeys? privateKeys,
  Duration expireAfter = const Duration(days: 5 * 365),
}) {
  return compute((Map<String, dynamic> args) async {
    privateKeys ??=
        preparedRenewal != null ? null : await generatePrivateKeysAsync();
    renewKeys(
        expireAfter: args["expireAfter"],
        preparedRenewal: args["preparedRenewal"],
        privateKeys: privateKeys);
  }, {"expireAfter": expireAfter, "preparedRenewal": preparedRenewal});
}