Skip to content

Replace @1password/op-js with the 1Password JavaScript SDK#2

Merged
Tom Plant (pl4nty) merged 5 commits into
feat/use-js-sdkfrom
claude/amazing-turing-LZ0Oa
Jun 2, 2026
Merged

Replace @1password/op-js with the 1Password JavaScript SDK#2
Tom Plant (pl4nty) merged 5 commits into
feat/use-js-sdkfrom
claude/amazing-turing-LZ0Oa

Conversation

@pl4nty

Copy link
Copy Markdown
Member

No description provided.

Claude (claude) and others added 5 commits June 2, 2026 01:37
Replace the CLI-based @1password/op-js dependency with the native
@1password/sdk (onepassword-sdk-js). The SDK authenticates against the
1Password desktop app via DesktopAuth (biometric unlock) instead of
shelling out to the installed op CLI.

Key changes:
- Add a OnePassword client wrapper (src/client.ts) that lazily creates and
  reuses an SDK client, replacing the CLI validation wrapper (src/cli.ts).
- Account setup now prompts for an account name/URL/UUID, since the SDK
  cannot enumerate accounts (no account.list/whoami). Vault selection uses
  client.vaults.list.
- Items use client.items.get/create and client.items.list; secret
  references are constructed from vault/item/field IDs (the SDK doesn't
  return a reference string on fields).
- Secret injection resolves op:// references via client.secrets.resolveAll
  and substitutes them, replacing inject.data.
- Password generation uses Secrets.generatePassword with a parsed recipe.
- Field types/categories map to the SDK's ItemFieldType/ItemCategory enums.
- Hover auth check uses the SDK client; the Windows-only CLI workaround is
  removed and hover previews are enabled on all platforms.
- Keep the SDK and its WebAssembly core external in the esbuild bundle and
  ship them in node_modules (the ~10MB wasm is loaded from disk at runtime).
- The items.cacheValues setting is marked deprecated (the SDK has no cache).
- Update tests, factories, and README to match.
Updated quick start guide for 1Password extension installation.
Signed-off-by: GitHub <noreply@github.com>
When the 1Password desktop app integration is disabled (or the app isn't
running/unlocked), the SDK throws "Native library is not available." This
previously surfaced as a raw message and, on quiet paths like hover, only
went to the logs.

Detect this specific error and show a clear notification explaining how to
fix it (enable app integration in Settings -> Developer) with a "Learn more"
link to the docs. The notification is shown even on otherwise-quiet paths,
deduped so it appears only once until the account changes or a client
connects. Add client tests covering the new behavior.
@pl4nty Tom Plant (pl4nty) merged commit d510095 into feat/use-js-sdk Jun 2, 2026
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants