info-auth

PKU unified credential management CLI (统一凭据管理). Use this skill when the user or AI Agent needs to authenticate with PKU services, manage stored credentials, check session status across all services, or when the user mentions 登录, 凭据, 密钥链, keyring, credential, auth, or asks how to let AI tools auto-login. This is the FIRST skill to use before any other PKU service — it handles secure credential storage so that treehole/course/campuscard/elective can auto-login without passwords.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "info-auth" with this command: npx skills add wjsoj/pku-info-auth

Info-Auth - PKU 统一凭据管理 CLI

Secure credential management for all PKU IAAA-based CLI tools. Allows AI Agents to trigger login flows without ever seeing passwords.

Why This Exists

AI Agents (like OpenClaw/Claude Code) cannot and should not handle user passwords directly. This tool lets users store credentials once in the OS keyring, then all CLI tools auto-authenticate from the keyring.

Architecture

  • Crate location: crates/info-auth/
  • Backend: OS keyring via keyring crate
    • Linux: D-Bus Secret Service (GNOME Keyring / KDE Wallet)
    • macOS: Apple Keychain
    • Windows: Windows Credential Manager
  • Keyring service name: info-pku

CLI Commands

CommandAliasFunction
storesaveInteractively input and store credentials to OS keyring
statusShow credential storage status (never shows password)
checkShow session status for ALL services (treehole/course/campuscard/elective)
clearRemove credentials from OS keyring

Credential Resolution Order

When any CLI tool runs login -p, credentials are resolved in this order:

  1. OS Keyring — stored via info-auth store (recommended)
  2. Environment variablesPKU_USERNAME + PKU_PASSWORD (for CI/automation)
  3. Interactive prompt — fallback, asks for username/password via stdin

SMS verification codes follow a similar pattern:

  1. Environment variablePKU_SMS_CODE (Agent can set this after asking user)
  2. Interactive prompt — fallback

For AI Agents — Quick Start

First-time setup (user does this once manually)

info-auth store
# User enters username + password interactively
# Credentials stored in OS keyring, encrypted

Agent workflow

# 1. Check which services have valid sessions
info-auth check

# 2. Login to any service (auto-reads credentials from keyring)
treehole login -p
course login -p
campuscard login -p
elective login -p          # may need: --dual major / --dual minor

# 3. If SMS verification is needed (treehole first login):
#    Ask user for the code, then set env var:
PKU_SMS_CODE=123456 treehole login -p

# 4. Use the service
treehole list
course courses --all
campuscard info
elective show

Key rules for Agents

  • NEVER pass passwords as CLI arguments
  • NEVER try to read the keyring directly — use info-auth status to check
  • If info-auth check shows "未登录" or "会话已过期", run <tool> login -p
  • If login fails with "系统密钥链中未存储凭据", ask user to run info-auth store

Development Notes

  • All user-facing strings in Chinese
  • Error handling: anyhow::Result with .context("中文描述")
  • The store command requires password confirmation (enter twice)
  • keyring_has_credential() returns diagnostic info on failure for debugging

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

PKU CWFW

北京大学财务综合信息门户 (cwfw.pku.edu.cn / WF_CWBS) CLI 工具。当用户提及 cwfw、财务门户、财务综合信息门户、个人酬金、工资查询、报销查询 时使用此 skill。Also use when dealing with cwfw IAAA 登录 (app_id=IIPF)、home...

Registry SourceRecently Updated
590Profile unavailable
Coding

Treehole

PKU Treehole (北大树洞) anonymous forum CLI tool built in Rust. Use this skill when working on the treehole crate, debugging treehole commands, adding features t...

Registry SourceRecently Updated
1450Profile unavailable
Coding

PKU BDKJ

北京大学空间 (bdkj.pku.edu.cn) 学术研讨教室预约 CLI 工具。当用户提及 bdkj、北大空间、学术研讨教室、教室预约、研讨间、借教室 或想要查询/预约/取消 二教/四教/地学 教学楼里的空闲学术研讨教室时使用此 skill。支持保存固定参与人分组(如课题组),重复发起预约时只需 `--grou...

Registry SourceRecently Updated
570Profile unavailable
Coding

PKU Claspider

北京大学课程信息爬取 CLI (dean.pku.edu.cn 教务部 + elective.pku.edu.cn 选课网 + onlineroomse.pku.edu.cn 智云课堂)。当用户提及 claspider、课程爬虫、课程信息爬取、课程目录、全校开课、按院系/教师/关键词查课、合并课程数据 时使用此...

Registry SourceRecently Updated
560Profile unavailable