微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🔐

敏感操作双因素认证防护

TOTP · v1.0.1
办公 安全 A 级 作者 diegofcornejo 公开目录收录
1.1k 下载 0 安装 5.3k 收藏 4 浏览

简介

基于TOTP的双因素认证技能,保护敏感操作(如环境变量访问、网关重启、备份删除),提供1分钟时间容差验证,适合需要额外安全层级的AI代理场景。

原始描述

TOTP-based OTP verification for sensitive operations (env vars, gateway restarts, backup deletions, critical config changes). Uses otplib with window:2 (1 mi...

通过你的 Agent 添加

安装目录:totp/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/totp/
Codex CLI~/.codex/skills/totp/
DeepSeek Harness~/.agents/skills/totp/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

技能正文


name: totp description: TOTP-based OTP verification for sensitive operations (env vars, gateway restarts, backup deletions, critical config changes). Uses otplib with window:2 (1 minute tolerance). metadata: { "openclaw": { "requires": { "env": ["TOTP_SECRET"], "bins": ["node"] }, "primaryEnv": "TOTP_SECRET", "emoji": "🔐" } }

TOTP Verification Skill

Secure OTP verification using TOTP (Time-based One-Time Password) for sensitive operations.

Purpose

Protect access to:

  • .env variables
  • openclaw.json configuration
  • Gateway restarts
  • Backup deletions
  • Critical configuration changes
  • External API key operations

Setup

  1. Install dependencies:

    npm install
    
  2. Generate secret and QR:

    npm run generate
    

    Optionally pass service and account name:

    node scripts/generate-secret.js MyService myuser
    
  3. Set TOTP_SECRET in .env:

    TOTP_SECRET=YOUR_BASE32_SECRET_HERE
    
  4. Configure Google Authenticator/Authy with the generated secret.

Usage

When a sensitive operation is requested:

  1. Agent: "Please provide your OTP"
  2. User: Provides 6-digit code from authenticator app
  3. Agent: Runs verification:
    TOTP_SECRET=$TOTP_SECRET node scripts/verify.js 123456
    
  4. If valid (exit 0): Proceed with operation
  5. If invalid (exit 1): Deny access

Files

  • scripts/generate-secret.js - Generate new TOTP secret and QR
  • scripts/verify.js - Verify OTP tokens (window:2 = 1 minute tolerance)
  • SKILL.md - This documentation

Security Notes

  • Window: 2 (1 minute tolerance) for time drift
  • Algorithm: SHA1
  • Digits: 6
  • Period: 30 seconds
  • Secret: Base32 encoded, stored in .env as TOTP_SECRET

Integration

This skill should be integrated into the agent's decision flow when:

  1. User requests .env variables
  2. User requests openclaw.json contents
  3. User requests gateway restart
  4. User requests backup deletion
  5. Any operation marked as "critical"

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

2fatotpauthenticationotpsecuritysecrets-managementaccess-control

同类 Skill