Logo di 1password Sdk

1password Sdk

OrganizzazionePopolare
MadAppGang
1password-sdk

How to load secrets and environment variables from 1Password programmatically using the official @1password/sdk (JavaScript/TypeScript). Use this skill whenever code needs to read a 1Password secret, resolve an op:// reference, fetch many secrets at once, discover the fields/sections of a 1Password item (e.g. to import API keys), or read a 1Password Environment — even if the user doesn't name the SDK explicitly. Triggers on: "@1password/sdk", "op://", "OP_SERVICE_ACCOUNT_TOKEN", "DesktopAuth", "resolve a secret from 1Password", "1Password service account", "1Password Environments", "fetch API keys from 1Password", or wiring 1Password into a Node/Bun/TypeScript app. Prefer this in-process SDK over shelling out to the `op` CLI unless the task specifically needs the user's interactive `op signin` session.

Panoramica

Pubblicato daMadAppGang
Repositoryclaudish
Nome della skill1password-sdk
Stelle
1K
Fork
138
File inclusi
4
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • File inclusi: 4

    Script, template e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da MadAppGang su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA 1password Sdk in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/MadAppGang/claudish/tree/main/.claude/skills/1password-sdk
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/MadAppGang/claudish.git /tmp/claudish
mkdir -p .claude/skills
cp -r /tmp/claudish/.claude/skills/1password-sdk .claude/skills/1password-sdk
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva 1password Sdk in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente 1password Sdk non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi 1password Sdk non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

1Password JavaScript/TypeScript SDK

The official @1password/sdk reads secrets from 1Password in-process — no op CLI subprocess, no op signin. It authenticates directly (service-account token or desktop biometric) and resolves op://vault/item/field references to their values. Use it whenever an app needs to pull credentials at runtime.

Why prefer the SDK over the op CLI: one auth model, one authorization event (the CLI + SDK each prompt separately, so mixing them double-prompts), no external binary to depend on, batched resolution, and structured per-reference errors. The CLI's only edge is using a user's existing interactive op signin session — the SDK cannot do that; it needs its own auth (below).

Install

bash
bun add @1password/sdk          # or npm install @1password/sdk

For 1Password Environments (the environments API), the stable release does NOT include it — you need the beta:

bash
bun add @1password/sdk@0.4.1-beta.1

Authenticate — create the client once

Every operation goes through a client. integrationName and integrationVersion are required (they identify your app in 1Password's audit log — note they do NOT change the desktop authorization prompt, which always shows the calling process).

ts
import { createClient, DesktopAuth } from "@1password/sdk";

// Service account — headless / CI / servers. No prompt, no desktop app.
const client = await createClient({
  auth: process.env.OP_SERVICE_ACCOUNT_TOKEN!,
  integrationName: "my-app",
  integrationVersion: "1.0.0",
});

// OR Desktop app — laptops, biometric (Touch ID). Prompts to authorize.
const client = await createClient({
  auth: new DesktopAuth("my-account-name"), // account name or UUID
  integrationName: "my-app",
  integrationVersion: "1.0.0",
});

Choosing auth:

  • OP_SERVICE_ACCOUNT_TOKEN → headless, no prompt, but cannot read Private/Personal vaults (shared vaults only). The token is itself a full-decryption secret — never log or persist it.
  • DesktopAuth → uses the running desktop app, can read your Private vault, prompts for Touch ID. Requires the desktop app's SDK integration to be enabled.

createClient, and every method below, are async — await them.

Resolve secrets — the core operation

ts
// One secret:
const apiKey = await client.secrets.resolve("op://Vault/Item/credential");

// Many at once (one round-trip, per-reference errors — prefer this for >1):
const res = await client.secrets.resolveAll([
  "op://Vault/Item/username",
  "op://Vault/Item/password",
]);
for (const [ref, response] of Object.entries(res.individualResponses)) {
  if (response.error) { console.error(`failed ${ref}:`, response.error); continue; }
  console.log(response.content.secret); // the value
}

Keep resolved secrets in-memory only — never write them to disk or logs.

→ Full resolution details (reference syntax, OTP/SSH query params, field types, validating a reference, the response shapes): references/resolve-secrets.md

Read a 1Password Environment (beta)

A named set of env vars managed in the desktop app, addressed by an opaque ID:

ts
const res = await client.environments.getVariables("<environment-id>");
for (const v of res.variables) {
  process.env[v.name] = v.value;   // { name, value, masked }
}

Requires the beta SDK and the Environment ID (copied from the desktop app: Developer → View Environments → Manage environment → Copy environment ID).

→ Details + the response shape: references/environments.md

Discover an item's fields (for globbed / bulk imports)

When you want to pull many fields from one item — e.g. an item whose fields are each named after an env var (OPENAI_API_KEY, ANTHROPIC_API_KEY, …) — you must discover them first. items.get() takes IDs, not names, so the flow is:

ts
// 1. name → vault ID
const vaults = await client.vaults.list();
const vaultId = [...vaults].find(v => v.title === "Jack")!.id;

// 2. name → item ID
const items = await client.items.list(vaultId);
const itemId = items.find(i => i.title === "API keys")!.id;

// 3. fetch the item → fields + sections
const item = await client.items.get(vaultId, itemId);
for (const f of item.fields) {
  // f.title (label), f.sectionId, f.fieldType, f.value
  // join f.sectionId → item.sections[].title for the section label
}

Note: items.get() returns every field's decrypted value — there is no "names without values" mode. This is the same as the op CLI's op item get (both decrypt in memory; neither writes to disk), so it's not a security regression — just don't persist what you don't use.

→ Full glob/discovery recipe (name→ID resolution, section-label joins, building op:// references, filtering by a glob): references/glob-discovery.md

What the SDK can and cannot do

NeedSDKNotes
Resolve op:// (single + batch)✅secrets.resolve / resolveAll
Validate a reference syntactically✅Secrets.validateSecretReference (static, no network)
List vaults / items, get item fields✅IDs only — resolve names→IDs yourself
Read a 1Password Environment✅ betaenvironments.getVariables, beta SDK only
Use an existing op signin session❌SDK needs its own token/DesktopAuth
Read Private vault headless❌service accounts = shared vaults only

Other languages

The SDK is also available for Go and Python with the same shapes (different casing/idioms). → references/other-languages.md

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA 1password Sdk?

How to load secrets and environment variables from 1Password programmatically using the official @1password/sdk (JavaScript/TypeScript). Use this skill whenever code needs to read a 1Password secret, resolve an op:// reference, fetch many secrets at once, discover the fields/sections of a 1Password item (e.g. to import API keys), or read a 1Password Environment — even if the user doesn't name the SDK explicitly. Triggers on: "@1password/sdk", "op://", "OP_SERVICE_ACCOUNT_TOKEN", "DesktopAuth", "resolve a secret from 1Password", "1Password service account", "1Password Environments", "fetch A...

Perché usare 1password Sdk su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. 1password Sdk è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo 1password Sdk in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/MadAppGang/claudish/tree/main/.claude/skills/1password-sdk. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare 1password Sdk?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con 1password Sdk?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con 1password Sdk: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA 1password Sdk è gratuita?

È pubblicata su GitHub da MadAppGang. Consulta il repository per i termini di licenza. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇