From 717d129e8696d30d823df87f38189b13eb4c0935 Mon Sep 17 00:00:00 2001 From: Sattvik Chakravarthy Date: Fri, 18 Oct 2024 15:10:44 +0530 Subject: [PATCH] fix: handling null --- src/main/java/io/supertokens/oauth/OAuth.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/io/supertokens/oauth/OAuth.java b/src/main/java/io/supertokens/oauth/OAuth.java index aa2192247..3e1fc0544 100644 --- a/src/main/java/io/supertokens/oauth/OAuth.java +++ b/src/main/java/io/supertokens/oauth/OAuth.java @@ -367,12 +367,18 @@ public static void addOrUpdateClient(Main main, AppIdentifier appIdentifier, Sto } private static String encryptClientSecret(Main main, String clientSecret) throws InvalidConfigException, InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { + if (clientSecret == null) { + return null; + } String key = Config.getConfig(main).getOAuthClientSecretEncryptionKey(); clientSecret = Utils.encrypt(clientSecret, key); return clientSecret; } private static String decryptClientSecret(Main main, String clientSecret) throws InvalidConfigException, InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { + if (clientSecret == null) { + return null; + } String key = Config.getConfig(main).getOAuthClientSecretEncryptionKey(); clientSecret = Utils.decrypt(clientSecret, key); return clientSecret;