Install
openclaw skills install @wjsoj/pku-info-commonShared library crate (info-common) providing IAAA authentication, OTP, session persistence, credential resolution, and QR rendering for PKU CLI tools. Use this skill when working on the info-common crate, modifying shared auth logic, debugging IAAA login failures, extending session storage, working on credential/keyring integration, adding a new CLI tool that needs PKU auth, or when the user mentions IAAA, unified auth, 统一认证, OTP/手机令牌, session persistence, cookie storage, keyring, credential, or QR code display. Also use when understanding how treehole/course/campuscard/elective share authentication infrastructure.
openclaw skills install @wjsoj/pku-info-commonThe shared library crate providing authentication, session management, and utilities for all IAAA-based CLI tools.
crates/info-common/~/.config/info/<name>/ for each consumer crateiaaa.rs — IAAA Unified AuthenticationIaaaConfig with app_id and redirect_url:
app_id="PKU Helper", redirect to /chapi/cas_iaaa_loginapp_id="blackboard", redirect to Blackboard SSOapp_id="portal2017", redirect to portal → berserker-authapp_id="elective", redirect to elective SSOotp.rs — TOTP Code Generationsession.rs — Session & Cookie PersistenceStore::new(APP_NAME) creates storage at ~/.config/info/<name>/session.json — token, expires_at, uid, created_at, extra (serde_json::Value)cookies.json — reqwest CookieStore serialized as JSONcredential.rs — Unified Credential Resolutionkeyring crate with platform-specific backends:
PKU_USERNAME, PKU_PASSWORD, PKU_SMS_CODEresolve_sms_code() — env var PKU_SMS_CODE → interactiveconfirm_send_sms() — auto-confirms when PKU_SMS_CODE is setkeyring_store(), keyring_clear(), keyring_has_credential()check_session(app_name) — returns Valid / Expired / NotFoundqr.rs — Terminal QR Code Displayviuer crateAll IAAA-based CLI tools use credential::resolve_credential() for login. The resolution order:
info-pku service) — set by info-auth storePKU_USERNAME + PKU_PASSWORD)AI Agents should:
info-auth check to verify session status before operations<tool> login -p to trigger auto-login from keyringPKU_SMS_CODE env var if SMS verification is neededTo add a new IAAA-based CLI tool:
crates/info-common in Cargo.tomlIaaaConfig with the service's app_id and redirect_urlcredential::resolve_credential() instead of manual stdin inputcomplete_*_login() to exchange the IAAA token with the target servicesession.expires_at when saving sessionsStore::new("tool-name") for session persistenceclient.rs pattern: build() for auth requests, build_simple() for IAAA loginanyhow::Result with .context("中文描述")#[allow(dead_code)]