Skip to content

Generic encryption/decryption utility #113

@theoephraim

Description

@theoephraim

Use Case

I'm building some dev tools and I have some local application cache data that I need to encrypt. Currently I need to manage the decryption key, and there's not really a good place to put it, other than on disk right near the encrypted data.

It would be awesome if I could rely on 1password for this encryption/decryption instead. Especially if the sdk supported connecting to the local desktop app, then I could safely store this data on the local filesystem, and rely on 1password biometric unlock to decrypt it.

Requirements and desired behavior

I think everything is based on vaults, so I imagine you'd have to select a vault, although perhaps it could select a default somehow.

const opClient = await createClient({
  useDesktopApp: true,
});

// I imagine it can probably encrypt without unlocking, but depends how it works under the hood...
const encryptedData = await opClient.utils.encrypt('plain text data', { vaultId: 'xyz123' } );
// maybe encrypted data includes vault id too?

// triggers biometric unlock if not already unlocked
const decrypted = await opClient.utils.decrypt(encryptedData, { vaultId: 'xyz123' });

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions