Skip to content

Commit 4309a04

Browse files
authored
fix(input_secret): For string secret revert to old form until SDK is updated (#522)
1 parent a4753e4 commit 4309a04

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/input_secrets/src/input_secrets.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ export function encryptInputSecretValue<T extends string | object>(
4646
ow(publicKey, ow.object.instanceOf(KeyObject));
4747
ow(schema, ow.optional.object);
4848

49+
// TODO to make string encryption compatible with current SDK, we need to use the old form.
50+
// Remove this once SDK is updated to use the new form
51+
if (typeof value === 'string') {
52+
const { encryptedValue, encryptedPassword } = publicEncrypt({ value, publicKey });
53+
return `${ENCRYPTED_STRING_VALUE_PREFIX}:${encryptedPassword}:${encryptedValue}`;
54+
}
55+
4956
const schemaHash = schema ? getFieldSchemaHash(schema) : null;
5057

5158
// We are encrypting the value as a JSON string, so we need to stringify it first.

0 commit comments

Comments
 (0)