Secure way of encrypting payload in Javascript for user authentification

As in an Electron/Tauri app? I have no idea what you would choose, I assume they have some mechanism for secure storage, maybe if you are lucky you can use keychain on mac and something similar on windows.