Why is the accessToken not encrypted by default?

Hi, why is the accessToken in account not encrypted by default e.g for discord in our persistence? And what's the easiest way to encrypt/decrypt it? Creating a custom plugin would do the job, I guess? thanks ! 🙂
Solution:
After discussing with @bekacru we'll be implementing this built-in. Right now it could be possible via custom plugin - but I'm not 100% certain on this. Our future plans (roughly) are: * Encrypt accessToken by default...
Jump to solution
12 Replies
Solution
Ping
Ping5mo ago
After discussing with @bekacru we'll be implementing this built-in. Right now it could be possible via custom plugin - but I'm not 100% certain on this. Our future plans (roughly) are: * Encrypt accessToken by default * Provide auth.$context.decryptAccessToken or something like that. * Provide options to configure access token encryption under options.account.accessToken * options.account.accessToken.disableEncryption - boolean * options.account.accessToken.encrypt - fn to encrypt * options.account.accessToken.decrypt - fn to decrypt * potentially others.
bekacru
bekacru5mo ago
you can encrypt it using db hooks. You don't need to make a plugin
djang0
djang0OP5mo ago
Yeah i can but there's no hook when I'd retrieve it? to decrypt So i'd have to check on some request hooks and modify the payload on the fly maybe? if there's an account? Thanks for the explanations, would be super cool 😋
bekacru
bekacru5mo ago
You should make an endpoint to retrive user accounts
djang0
djang0OP5mo ago
thanks it's gonna work like that, and more broadly thanks for your work on this lib @bekacru @Ping 🙏
Arthur
Arthur5mo ago
any ETA for this ? 🙂 + would it be possible to choose our own encrypt / decrypt function (with same kind of API you provide for secondary storage) ? interface SecondaryStorage { get: (key: string) => Promise<string | null>; set: (key: string, value: string, ttl?: number) => Promise<void>; delete: (key: string) => Promise<void>; }
Ping
Ping5mo ago
I'm pretty sure it's merged, but I'll double check.
Arthur
Arthur5mo ago
from the doc
No description
Ping
Ping5mo ago
Yeah that sounds right
Arthur
Arthur5mo ago
so not implemented for now right ?
bekacru
bekacru5mo ago
it's on a beta release should be tagged latest this friday
kx_nl
kx_nl4mo ago
@bekacru it tells about encryption but what about decryption, wanted to know how to implement it

Did you find this page helpful?