Skip to content

ElectronSafeStorage

Unofficial

Electron safeStorage module for encrypting and decrypting strings using OS-level cryptography.

Import:

import type { ElectronSafeStorage } from '@obsidian-typings/obsidian-catalyst-latest';

Signature:

export interface ElectronSafeStorage extends NodeJS.EventEmitter

Extends: NodeJS.EventEmitter

Methods

MethodReturnsDescription
decryptString(encrypted)stringDecrypts the encrypted buffer obtained with encryptString back into a string.

This function will throw an error if decryption fails.
encryptString(plainText)BufferEncrypts a string using OS-level cryptography.

This function will throw an error if encryption fails.
isEncryptionAvailable()booleanWhether 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.

Links to this page: