SealdSdk_CreateSubIdentity method

int SealdSdk_CreateSubIdentity(
  1. Pointer<NativeSealdSdk> sealdSdk,
  2. Pointer<Utf8> deviceName,
  3. int expireAfter,
  4. Pointer<Utf8> preGeneratedEncryptionKey,
  5. Pointer<Utf8> preGeneratedSigningKey,
  6. Pointer<Pointer<NativeSealdCreateSubIdentityResponse>> result,
  7. Pointer<Pointer<NativeSealdError>> error,
)

Create a new sub-identity, or new device, for the current user account. After creating this new device, you will probably want to call SealdSdk_MassReencrypt, so that the newly created device will be able to decrypt EncryptionSessions previously created for this account.

@param sealdSdk The SealdSdk instance. @param deviceName An optional name for the device to create. This is metadata, useful on the Seald Dashboard for recognizing this device. Optional. @param expireAfter The duration during which the device key for the device to create will be valid without renewal, in Milliseconds. Optional, defaults to 5 years. @param preGeneratedEncryptionKey A B64 encoding of a pre-generated key, or NULL. Either both must be passed, or neither. @param preGeneratedSigningKey A B64 encoding of a pre-generated key, or NULL. Either both must be passed, or neither. @param result A pointer to store a CreateSubIdentityResponse* instance, containing DeviceId (the ID of the newly created device), BackupKey (the identity export of the newly created sub-identity), and BackupKeyLen (the length of BackupKey). @param error A pointer to a SealdError* where details will be stored in case of error. @return Error code: -1 if an error happened, 0 for success.

Implementation

int SealdSdk_CreateSubIdentity(
  ffi.Pointer<NativeSealdSdk> sealdSdk,
  ffi.Pointer<pkg_ffi.Utf8> deviceName,
  int expireAfter,
  ffi.Pointer<pkg_ffi.Utf8> preGeneratedEncryptionKey,
  ffi.Pointer<pkg_ffi.Utf8> preGeneratedSigningKey,
  ffi.Pointer<ffi.Pointer<NativeSealdCreateSubIdentityResponse>> result,
  ffi.Pointer<ffi.Pointer<NativeSealdError>> error,
) {
  return _SealdSdk_CreateSubIdentity(
    sealdSdk,
    deviceName,
    expireAfter,
    preGeneratedEncryptionKey,
    preGeneratedSigningKey,
    result,
    error,
  );
}