Dashlane Plugin
Our Dashlane plugin enables secure loading of secrets from Dashlane using declarative instructions within your .env files.
It shells out to the official Dashlane CLI (dcli) to resolve secret references in the dl:// format.
Features
Section titled “Features”- Secret references via
dl://URIs (e.g.dl://<id>/password) - Headless CI/CD support via service device keys for non-interactive authentication
- Optional vault sync before reads with
autoSync - Automatic vault locking on process exit in headless mode (configurable via
lockOnExit) - In-session caching per resolution run
- Multiple instances for accessing different Dashlane accounts
- Helpful error messages with resolution tips
Installation and setup
Section titled “Installation and setup”In a JS/TS project, you may install the @varlock/dashlane-plugin package as a normal dependency.
Otherwise you can just load it directly from your .env.schema file, as long as you add a version specifier.
See the plugins guide for more instructions on installing plugins.
Prerequisites
Section titled “Prerequisites”You must have dcli (Dashlane CLI) installed and available in your PATH.
See the Dashlane CLI installation docs for setup instructions.
Authentication
Section titled “Authentication”The plugin supports two authentication modes:
Interactive (local dev): If you are already logged into dcli, just initialize without credentials:
# @plugin(@varlock/dashlane-plugin)# @initDashlane()Headless (CI/prod): Use service device keys for non-interactive authentication:
# @plugin(@varlock/dashlane-plugin)# @initDashlane(serviceDeviceKeys=$DASHLANE_SERVICE_DEVICE_KEYS)# ---
# @type(dashlaneDeviceKeys)DASHLANE_SERVICE_DEVICE_KEYS=In headless mode (when serviceDeviceKeys is provided), the plugin automatically locks the vault when the process exits. This is best-effort and may not run in all exit scenarios (e.g. SIGKILL). You can control this behavior with the lockOnExit param.
Vault sync
Section titled “Vault sync”The plugin does not sync the vault by default. To run dcli sync once before the first secret read, set autoSync=true:
# @plugin(@varlock/dashlane-plugin)# @initDashlane(serviceDeviceKeys=$DASHLANE_SERVICE_DEVICE_KEYS, autoSync=true)Sync failures are non-blocking — if the sync fails (e.g. network issues), the plugin still reads from the existing local vault.
Multiple instances
Section titled “Multiple instances”Access multiple Dashlane accounts by providing an id:
# @plugin(@varlock/dashlane-plugin)# @initDashlane(id=personal)# @initDashlane(id=team, serviceDeviceKeys=$TEAM_DASHLANE_KEYS)# ---
MY_TOKEN=dashlane(personal, "dl://abc123/password")SHARED_KEY=dashlane(team, "dl://def456/password")Loading secrets
Section titled “Loading secrets”Use the dashlane() resolver function to fetch a secret by its dl:// reference:
# @plugin(@varlock/dashlane-plugin)# @initDashlane()# ---
DB_PASSWORD=dashlane("dl://abc123/password")API_KEY=dashlane("dl://def456/password")When you have multiple plugin instances, pass the instance id as the first argument:
DB_PASSWORD=dashlane(prod, "dl://abc123/password")Reference
Section titled “Reference”Root decorators
Section titled “Root decorators”@initDashlane()
Section titled “@initDashlane()”Initialize a Dashlane plugin instance for dashlane() resolver.
Key/value args:
id(optional): instance identifier for multiple instancesserviceDeviceKeys(optional): service device keys for headless authenticationautoSync(optional): iftrue, runsdcli synconce before the first readlockOnExit(optional): lock the vault on process exit. Defaults totruein headless mode,falsein interactive mode.
# Interactive (local dev)# @initDashlane()
# Headless (CI/prod) with auto-sync# @initDashlane(serviceDeviceKeys=$DASHLANE_SERVICE_DEVICE_KEYS, autoSync=true)
# Named instance# @initDashlane(id=prod, serviceDeviceKeys=$DASHLANE_SERVICE_DEVICE_KEYS)Data types
Section titled “Data types”dashlaneDeviceKeys
Section titled “dashlaneDeviceKeys”Service device keys for non-interactive Dashlane CLI authentication. Must start with dls_.
Resolver functions
Section titled “Resolver functions”dashlane()
Section titled “dashlane()”Fetch a secret from Dashlane by dl:// reference.
Array args:
instanceId(optional, if 2 args): instance identifierdlReference(required):dl://secret reference URI
# Default instanceDB_PASSWORD=dashlane("dl://abc123/password")
# With explicit instanceDB_PASSWORD=dashlane(prod, "dl://abc123/password")Troubleshooting
Section titled “Troubleshooting”dcli command not found
Section titled “dcli command not found”- Install dcli following the installation docs
- Ensure
dcliis in yourPATH
Authentication failed
Section titled “Authentication failed”- Verify you are logged in:
dcli sync - For headless auth, check that
DASHLANE_SERVICE_DEVICE_KEYSis set correctly - See Dashlane CLI authentication for details
Entry not found
Section titled “Entry not found”- Verify the entry exists:
dcli password -o json | jq '.[].title' - Use the entry ID for reliable lookups:
dashlane("dl://<id>/password")
Vault locked or not synced
Section titled “Vault locked or not synced”- Run
dcli syncto sync your vault - Set
autoSync=truein@initDashlaneto sync automatically before reads