Skip to content

Commit

Permalink
fix: handling null
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc authored Oct 18, 2024
1 parent e54cd5f commit 717d129
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/io/supertokens/oauth/OAuth.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 717d129

Please sign in to comment.