🕸️ refactor: Migrate from crypto to Web Crypto API (#3357)

* move crypto to async webcrypto

update encrypt/decrypt

forgot await

* chore: import order - openidStrategy.js

* chore: import order - Session.js

* chore: import order - AuthController.js

* Update AuthService.js

---------

Co-authored-by: Danny Avila <danacordially@gmail.com>
This commit is contained in:
matt burnett 2024-08-04 23:59:45 -04:00 committed by GitHub
parent b6fe7e5570
commit 3e0f95458f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 108 additions and 51 deletions

View file

@ -29,7 +29,7 @@ const getUserPluginAuthValue = async (userId, authField) => {
throw new Error(`No plugin auth ${authField} found for user ${userId}`);
}
const decryptedValue = decrypt(pluginAuth.value);
const decryptedValue = await decrypt(pluginAuth.value);
return decryptedValue;
} catch (err) {
logger.error('[getUserPluginAuthValue]', err);
@ -64,7 +64,7 @@ const getUserPluginAuthValue = async (userId, authField) => {
const updateUserPluginAuth = async (userId, authField, pluginKey, value) => {
try {
const encryptedValue = encrypt(value);
const encryptedValue = await encrypt(value);
const pluginAuth = await PluginAuth.findOne({ userId, authField }).lean();
if (pluginAuth) {
const pluginAuth = await PluginAuth.updateOne(