createDocument method

Implementation

Future<DecryptedDocumentDto?> createDocument(UserDto user, DecryptedDocumentDto document, CryptoConfig<DecryptedDocumentDto, DocumentDto> config) async {
  var newDocument = await this.rawCreateDocument(await config.encryptDocument(
      user.dataOwnerId()!, <String>{...(user.autoDelegations["all"] ?? {}), ...(user.autoDelegations["medicalInformation"] ?? {})}, (await document.initDelegations(user, config))));
  return newDocument != null ? await config.decryptDocument(user.dataOwnerId()!, newDocument) : null;
}