createSubIdentityAsync method
- String deviceName = "",
- SealdGeneratedPrivateKeys? privateKeys,
- Duration expireAfter = const Duration(days: 5 * 365),
Creates a new sub-identity, or new device, for the current user account. After creating this new device, you will probably want to call massReencrypt, so that the newly created device will be able to decrypt SealdEncryptionSessions previously created for this account.
deviceName
- An optional name for the device to create. This is metadata, useful on the Seald Dashboard for recognizing this device. Optional.
privateKeys
- Optional. Pre-generated private keys, returned by a call to SealdSdk.generatePrivateKeysAsync.
expireAfter
- The duration during which the device key for the device to create will be valid without renewal. Optional, defaults to 5 years.
Returns a SealdCreateSubIdentityResponse instance, containing the ID of the newly created device, and the identity export of the newly created sub-identity.
Implementation
Future<SealdCreateSubIdentityResponse> createSubIdentityAsync(
{String deviceName = "",
SealdGeneratedPrivateKeys? privateKeys,
Duration expireAfter = const Duration(days: 5 * 365)}) {
return compute((Map<String, dynamic> args) async {
privateKeys ??= await generatePrivateKeysAsync();
return createSubIdentity(
deviceName: args["deviceName"],
expireAfter: args["expireAfter"],
privateKeys: privateKeys);
}, {"deviceName": deviceName, "expireAfter": expireAfter});
}