Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic encryption/decryption utility #113

Open
theoephraim opened this issue Nov 26, 2024 · 2 comments
Open

Generic encryption/decryption utility #113

theoephraim opened this issue Nov 26, 2024 · 2 comments

Comments

@theoephraim
Copy link

theoephraim commented Nov 26, 2024

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

@SimonBarendse
Copy link
Member

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.

What if you store the encryption/decryption key in 1Password?

@theoephraim
Copy link
Author

@SimonBarendse - yep I can do that now, but it requires creating the item, storing configuration about where the key is stored, and explaining to the user to not mess with it. The idea here would be to have a method that works with as little configuration as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants