diff --git a/libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts b/libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts index f4318840515..1838cec83c3 100644 --- a/libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts +++ b/libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts @@ -41,7 +41,7 @@ export class EncryptServiceImplementation implements EncryptService { this.blockType0 = getFeatureFlagValue(newConfig, FeatureFlag.PM17987_BlockType0); } - async encrypt(plainValue: string | Uint8Array, key: SymmetricCryptoKey): Promise { + async encrypt(plainValue: string, key: SymmetricCryptoKey): Promise { if (key == null) { throw new Error("No encryption key provided."); } @@ -53,14 +53,10 @@ export class EncryptServiceImplementation implements EncryptService { } if (plainValue == null) { - return Promise.resolve(null); + return null; } - if (typeof plainValue === "string") { - return this.encryptUint8Array(Utils.fromUtf8ToArray(plainValue), key); - } else { - return this.encryptUint8Array(plainValue, key); - } + return this.encryptUint8Array(Utils.fromUtf8ToArray(plainValue), key); } async wrapDecapsulationKey(