
Sops Add Key
- 2 installs
- 21 repo stars
- Updated August 5, 2026
- joaquimscosta/arkhe-claude-plugins
Adds a new machine's age public key to .sops.yaml and re-encrypts all files so the new machine can decrypt them.
About
Adds a machine's age public key to a SOPS project and re-encrypts all files for multi-machine access. A developer uses it to authorize a new machine to decrypt shared secrets.
- Detects current SOPS state before changing keys
- Re-encrypts all files for the new key
Sops Add Key by the numbers
- 2 all-time installs (skills.sh)
- Ranked #1,788 of 2,203 Security skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/joaquimscosta/arkhe-claude-plugins --skill sops-add-keyAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 2 |
|---|---|
| repo stars | ★ 21 |
| Last updated | August 5, 2026 |
| Repository | joaquimscosta/arkhe-claude-plugins ↗ |
What it does
Adds a new machine's age public key to .sops.yaml and re-encrypts all files so the new machine can decrypt them.
Files
SOPS Add Key
Add a new machine's age public key to the project and re-encrypt all files so the new machine can decrypt them.
Workflow
1. Detect current state:
python3 ${CLAUDE_SKILL_DIR}/../sops-setup/scripts/detect_sops.py <project-root>2. Verify prerequisites:
project.sops_yaml.existsmust be true — if not, tell user to run/devtools:sops-setupfirstproject.encrypted_filesshould be non-empty — warn if there are no.enc.yamlfiles to re-encrypt- If
project.tmp_filesis non-empty, warn about stale temporary files (leftover from a failed decrypt/re-encrypt) and suggest the user delete them
3. Audit key propagation (if encrypted files exist): For each encrypted file, read its YAML and check the sops.age recipients list against project.sops_yaml.authorized_keys. If any authorized key is missing from any file's recipients:
WARNING: Key age1xxx...yyy is in .sops.yaml but NOT a recipient in:
- apps/web/.env.local.enc.yaml
- apps/api/.env.local.enc.yaml
These files need re-encryption before the corresponding machine can decrypt them.Offer to run sops updatekeys -y <file> for each affected file before proceeding with the new key addition.
4. Show current authorized keys from project.sops_yaml.authorized_keys:
Currently authorized keys (N):
1. age1abc...def (truncated)
2. age1ghi...jkl (truncated)5. Use `AskUserQuestion` — ask user to paste the new machine's age public key. Validate it starts with age1.
6. Read `.sops.yaml` and add the new key to the age: field in creation_rules. Use the Edit tool to append the key to the comma-separated list or multi-line block.
7. Re-encrypt all files using sops updatekeys:
sops updatekeys -y <file>.enc.yamlFor each encrypted file. The -y flag auto-confirms. This re-wraps only the data encryption key for the new recipient list — values and MAC are unchanged, producing a minimal diff.
If sops updatekeys is not available (older sops version), fall back to decrypt + re-encrypt:
sops --decrypt <file>.enc.yaml > <file>.tmp.yaml
sops --encrypt <file>.tmp.yaml > <file>.enc.yaml
rm <file>.tmp.yamlVerify: After re-encrypting, read each file's sops.age recipients block and confirm all keys from .sops.yaml (including the newly added key) appear as recipients. If any key is missing, warn the user that re-encryption may have failed.
8. Summary:
| Action | Detail |
|--------|--------|
| Key added | age1xyz... (new machine) |
| .sops.yaml | Updated (now N+1 authorized keys) |
| Re-encrypted | .env.local.enc.yaml |
| Re-encrypted | .env.production.enc.yaml |Remind user to commit both .sops.yaml and the updated .enc.yaml files.
Key Rotation vs Key Addition
- Adding a key (
sops updatekeys): Re-wraps the DEK for the new recipient list. Safe, minimal diff. Use for onboarding machines. - Rotating keys (
sops rotate -i): Generates a new DEK and re-encrypts every value. Use when a key is compromised or for periodic security hygiene. - If the user mentions a compromised key, recommend
sops rotate -iafter removing the compromised key from.sops.yaml.
Key Rules
- Validate the public key format (must start with
age1) before modifying.sops.yaml - Always show the current keys before adding a new one
- Re-encrypt ALL
.enc.yamlfiles — missing any would lock out the new machine for those files - Use
sops updatekeys(not full decrypt/re-encrypt) for routine key additions - After re-encryption, the new machine can clone and decrypt immediately