Skip to content

Commit

Permalink
Resolve review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Hinton committed Dec 10, 2022
1 parent bb46b75 commit 3eec7ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions libs/common/src/interfaces/crypto.interface.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { EncryptService } from "../abstractions/encrypt.service";
import { SymmetricCryptoKey } from "../models/domain/symmetric-crypto-key";

export function nullableFactory<T extends new (...args: any) => any>(
export function nullableFactory<T extends new (...args: any[]) => any>(
c: T,
...args: ConstructorParameters<T>
): InstanceType<T> | undefined {
if (args[0] == null) {
return null;
}

return new c(...(args as any[]));
return new c(...args);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions libs/common/src/services/crypto.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -690,15 +690,15 @@ export class CryptoService implements CryptoServiceAbstraction {
): Promise<V> {
const key = await this.getKeyFromIdentifier(domain.keyIdentifier());

return this.encryptService.decryptDomain(view, domain as DecryptableDomain, key);
return await this.encryptService.decryptDomain(view, domain, key);
}

async encryptView<V extends Encryptable<EncryptableDomain<V>>>(
view: V
): Promise<EncryptableDomain<V>> {
const key = await this.getKeyFromIdentifier(view.keyIdentifier());

return this.encryptService.encryptView(view as Encryptable<EncryptableDomain<V>>, key);
return this.encryptService.encryptView(view, key);
}

private async getKeyFromIdentifier(keyIdentifier: string | null): Promise<SymmetricCryptoKey> {
Expand Down

0 comments on commit 3eec7ba

Please sign in to comment.