new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Electron · API · all subjects

safestorage/methods

8 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

safeStorage.isEncryptionAvailable() method

safeStorage.isEncryptionAvailable() returns a boolean indicating whether encryption is available. On Linux, returns true if the app has emitted the ready event and the secret key is available. On macOS, returns true if Keychain is available. On Windows, returns true once the app has emitted the ready event.

safeStorage.isAsyncEncryptionAvailable() method

safeStorage.isAsyncEncryptionAvailable() returns Promise<boolean> that resolves with whether encryption is available for asynchronous safeStorage operations. The asynchronous encryptor is initialized lazily the first time this method, encryptStringAsync, or decryptStringAsync is called after the app is ready. The returned promise resolves once initialization completes.

safeStorage.encryptString() method

safeStorage.encryptString(plainText) takes a plainText string parameter and returns Buffer (an array of bytes representing the encrypted string). This function will throw an error if encryption fails.

safeStorage.decryptString() method

safeStorage.decryptString(encrypted) takes an encrypted Buffer parameter and returns a string. It decrypts the encrypted buffer obtained with safeStorage.encryptString back into a string.

safeStorage.encryptStringAsync() method

safeStorage.encryptStringAsync(plainText) takes a plainText string parameter and returns Promise<Buffer> (an array of bytes representing the encrypted string).

safeStorage.decryptStringAsync() method

safeStorage.decryptStringAsync(encrypted) takes an encrypted Buffer parameter and returns Promise<Object>. The resolved object contains: shouldReEncrypt (boolean) indicating whether data should be re-encrypted as the key has been rotated or a new key is available that provides a different security level (if true, call decryptStringAsync again to receive the new decrypted string), and result (string) containing the decrypted string.

safeStorage.setUsePlainTextEncryption() method

safeStorage.setUsePlainTextEncryption(usePlainText) takes a usePlainText boolean parameter. On Linux, this function will force the module to use an in-memory password for creating a symmetric key that is used for encrypt/decrypt functions when a valid OS password manager cannot be determined for the current active desktop environment. This function is a no-op on Windows and macOS.

safeStorage.getSelectedStorageBackend() method

safeStorage.getSelectedStorageBackend() is available on Linux and returns a string with the user-friendly name of the password manager selected. Possible return values are: 'basic_text' (when the desktop environment is not recognised or if --password-store="basic" flag is provided), 'gnome_libsecret' (when the desktop environment is X-Cinnamon, Deepin, GNOME, Pantheon, XFCE, UKUI, unity or if --password-store="gnome-libsecret" flag is provided), 'kwallet' (when the desktop session is kde4 or if --password-store="kwallet" flag is provided), 'kwallet5' (when the desktop session is kde5 or if --password-store="kwallet5" flag is provided), 'kwallet6' (when the desktop session is kde6 or if --password-store="kwallet6" flag is provided), 'unknown' (when called before app has emitted the ready event).

Give your agent this brain