massReencryptAsync method

Future<SealdMassReencryptResponse> massReencryptAsync(
  1. String deviceId, {
  2. int retries = 3,
  3. int retrieveBatchSize = 1000,
  4. Duration waitBetweenRetries = const Duration(seconds: 3),
  5. bool waitProvisioning = true,
  6. Duration waitProvisioningTime = const Duration(seconds: 5),
  7. Duration waitProvisioningTimeMax = const Duration(seconds: 10),
  8. Duration waitProvisioningTimeStep = const Duration(seconds: 1),
  9. int waitProvisioningRetries = 100,
  10. bool forceLocalAccountUpdate = false,
})

Retrieve, re-encrypt, and add missing keys for a certain device.

deviceId - The ID of the device for which to re-rencrypt. retries - Number of times to retry. Defaults to 3. retrieveBatchSize - Defaults to 1000. waitBetweenRetries - Time to wait between retries. Defaults to 3 seconds. waitProvisioning - Whether to wait for provisioning (new behaviour) or not. true to wait, false to not wait. Defaults to true. waitProvisioningTime - Time to wait if device is not provisioned on the server yet. The actual wait time will be increased on subsequent tries, by waitProvisioningTimeStep, up to waitProvisioningTimeMax. Defaults to 5 seconds. waitProvisioningTimeMax - Maximum time to wait if device is not provisioned on the server yet. Defaults to 10 seconds. waitProvisioningTimeStep - Amount to increase the time to wait if device is not provisioned on the server yet. Defaults to 1 second. waitProvisioningRetries - Maximum number of tries to check if the device is provisioned yet. Defaults to 100. forceLocalAccountUpdate - Whether to update the local account before trying the reencryption. true to update, false to not update. Defaults to false. Returns a SealdMassReencryptResponse instance, which will be populated with the number of re-encrypted keys, and the number of keys for which re-encryption failed.

Implementation

Future<SealdMassReencryptResponse> massReencryptAsync(String deviceId,
    {int retries = 3,
    int retrieveBatchSize = 1000,
    Duration waitBetweenRetries = const Duration(seconds: 3),
    bool waitProvisioning = true,
    Duration waitProvisioningTime = const Duration(seconds: 5),
    Duration waitProvisioningTimeMax = const Duration(seconds: 10),
    Duration waitProvisioningTimeStep = const Duration(seconds: 1),
    int waitProvisioningRetries = 100,
    bool forceLocalAccountUpdate = false}) {
  return compute(
      (Map<String, dynamic> args) => massReencrypt(args["deviceId"],
          retries: args["retries"],
          retrieveBatchSize: args["retrieveBatchSize"],
          waitBetweenRetries: args["waitBetweenRetries"],
          waitProvisioning: args["waitProvisioning"],
          waitProvisioningTime: args["waitProvisioningTime"],
          waitProvisioningTimeMax: args["waitProvisioningTimeMax"],
          waitProvisioningTimeStep: args["waitProvisioningTimeStep"],
          waitProvisioningRetries: args["waitProvisioningRetries"],
          forceLocalAccountUpdate: args["forceLocalAccountUpdate"]),
      {
        "deviceId": deviceId,
        "retries": retries,
        "retrieveBatchSize": retrieveBatchSize,
        "waitBetweenRetries": waitBetweenRetries,
        "waitProvisioning": waitProvisioning,
        "waitProvisioningTime": waitProvisioningTime,
        "waitProvisioningTimeMax": waitProvisioningTimeMax,
        "waitProvisioningTimeStep": waitProvisioningTimeStep,
        "waitProvisioningRetries": waitProvisioningRetries,
        "forceLocalAccountUpdate": forceLocalAccountUpdate
      });
}