Features

Connect to Keychain or password manager

2y agoPending

With javascript and fetch(), it's possible to easily import data from other services. However, in order to do this, I need some API tokens.

Of course, I could turn on E2E encryption, but this only applies to cloud sync, and the notes are still available as plain text to most programs running locally. So this is not really enough. MacOS has tools like keychain for this purpose. I may also not want every token to be available on every device for compliance reasons.

It'd be nice if there was a way to securely store some values, with an optional prompt in case the secret is unavailable.

and 2 others

3 comments

  1. I want to fetch data from 3rd party APIs. For example, I have a template that imports my current assigned tasks from Confluence and adds them as tasks. Another templates imports a list of all JIRA tickets currently waiting for my code review and adds tasks for this. In order to access these datas, I use Atlassians's API, and this needs a personal Access token.

    It is insecure to store secrets such as passwords or tokens in plain text on disk, even when the disk is encrypted. In my company (and probably any ISO 27001-certified company), this would break compliance with security guidelines. Currently, my solution is that NotePlan asks me for the token every time through a textbox, and I fetch it from my password manager and enter it. However, it'd be nice if NotePlan could store this token securely and thereby provide better UX for this process.

    MacOS uses Keychain as a secure on-device storage for such secrets (Linux also uses different keychain/keyring tools). You can access it via the Keychain Access Application, and this is where your saved WiFi passwords and other secrets from other apps live. The contents are stored in an encrypted manner and the service only allows access to the secrets to authorised applications. So macOS already comes with a secure storage for tokens, NotePlan just needs to connect to it. These tools (including macOS) are usually key-value stores, with additional authorisation that controls access for each application to each key.

    In python, you would use a library like keyring (https://pypi.org/project/keyring/) to easily connect to these things, I don't know how to do it in X-Code or whatever NotePlan is written in.

    The idea would be that NotePlan provides JS methods to access the keychain. These would be two methods ( `store_secret(key, value)` and `get_secret(key)`, the latter can fail if a secret is not present ). I could implement simple logic in my fetch-confluence-task script that checks if get_secret fails (or if it is successful, if the token is still valid), ask the user for the token if it is missing/invalid and then update it in keychain, and then use it to access the api.

    Alternatively, NotePlan could offer to manage secrets in the settings, which could be accessed from JS. I don't know how this would be stored properly though.

  2. 1Password works well and you can copy links into NotePlan. Would that work?

  3. Thanks for sharing this! I'm not 100% following, you mean fetching websites where a login is needed? And how does it connect to Keychain?