papi-dts
    Preparing search index...

    Provides functions related to encrypting and decrypting strings like user data, secrets, etc.

    Uses Electron's safeStorage API.

    Note that these encryption mechanisms are not transferrable between computers. We recommend using them with papi.storage methods to store data safely.

    WARNING: The primary purpose of this service is to enable extensions to encrypt and decrypt data to be stored securely in local files. It is not intended to protect data passed over a network connection. Please note that using this service passes the unencrypted string between local processes using the PAPI WebSocket.

    interface IDataProtectionService {
        decryptString(encryptedText: string): Promise<string>;
        encryptString(text: string): Promise<string>;
        isEncryptionAvailable(): Promise<boolean>;
    }
    Index

    Methods

    • Decrypts a string using Electron's safeStorage API. Transforms the input base64-encoded string to a buffer using Buffer.from(text, 'base64').

      This method throws if the decryption mechanism is not available such as on Linux without a supported package installed. See safeStorage for more information.

      Note that this encryption mechanism is not transferrable between computers. We recommend using it with papi.storage methods to store data safely.

      WARNING: The primary purpose of this service is to enable extensions to encrypt and decrypt data to be stored securely in local files. It is not intended to protect data passed over a network connection. Please note that using this service passes the unencrypted string between local processes using the PAPI WebSocket.

      Parameters

      • encryptedText: string

        String to decrypt. This string should have been encrypted by papi.dataProtection.encryptString

      Returns Promise<string>

      Decrypted string

    • Encrypts a string using Electron's safeStorage API. Transforms the returned buffer to a base64-encoded string using buffer.toString('base64').

      This method throws if the encryption mechanism is not available such as on Linux without a supported package installed. See safeStorage for more information.

      Note that this encryption mechanism is not transferrable between computers. We recommend using it with papi.storage methods to store data safely.

      WARNING: The primary purpose of this service is to enable extensions to encrypt and decrypt data to be stored securely in local files. It is not intended to protect data passed over a network connection. Please note that using this service passes the unencrypted string between local processes using the PAPI WebSocket.

      Parameters

      • text: string

        String to encrypt

      Returns Promise<string>

      Encrypted string. Use papi.dataProtection.decryptString to decrypt

    • Returns true if encryption is currently available. Returns false if the decryption mechanism is not available such as on Linux without a supported package installed. See Electron's safeStorage API for more information.

      WARNING: The primary purpose of this service is to enable extensions to encrypt and decrypt data to be stored securely in local files. It is not intended to protect data passed over a network connection. Please note that using this service passes the unencrypted string between local processes using the PAPI WebSocket.

      Returns Promise<boolean>

      true if encryption is currently available; false otherwise