mo-auth

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

前置约束

Pre-Constraints

CRITICAL — 先阅读
共享规则
,其中包含
mocli
初始化、认证、输出解析以及安全规则
CRITICAL — Read
Shared Rules
first, which includes
mocli
initialization, authentication, output parsing, and security rules

mocli auth - 墨问 Auth 认证

mocli auth - MoWen Auth Authentication

本技能提供墨问 Auth 认证的能力,指导你如何通过
mocli auth
完成 API Key 的配置与更新、获取当前的配置信息、获取 API Key 对应的账户,在墨问平台上的 Profile 信息。
This skill provides MoWen Auth Authentication capabilities, guiding you on how to complete API Key configuration and update, obtain current configuration information, get the account corresponding to the API Key, and retrieve Profile information on the MoWen platform through
mocli auth
.

使用原则

Usage Principles

  • 用户提供新的 API Key 或要求初始化认证时,使用
    mocli auth init --apik <api-key>
    • 用户明确要求更换、覆盖、重新配置 API Key 时,使用
      mocli auth init --apik <api-key> --force
    • 用户要查看当前认证状态时,使用
      mocli auth info
      ;用户还要查看账号资料时,使用
      mocli auth info --profile
    • 所有响应展示都必须隐藏 API Key。即使
      mocli
      返回的是脱敏值,也不要额外复述完整密钥。
    • 其它命令返回
      reason=AUTH
      时,引导用户重新提供 API Key,并使用
      init --force
      更新。
  • When users provide a new API Key or request authentication initialization, use
    mocli auth init --apik <api-key>
    .
    • When users explicitly request to replace, overwrite, or reconfigure the API Key, use
      mocli auth init --apik <api-key> --force
      .
    • When users want to check the current authentication status, use
      mocli auth info
      ; when users also want to view account profile, use
      mocli auth info --profile
      .
    • All response displays must hide the API Key. Do not repeat the full key even if
      mocli
      returns a desensitized value.
    • When other commands return
      reason=AUTH
      , guide users to provide the API Key again and use
      init --force
      to update.

mocli auth init --apik <api-key> [--force]

mocli auth init --apik <api-key> [--force]

初始化 API Key。可选参数
--force
用于更换(覆盖)已有 API Key。该命令会写入本地认证配置,执行前需要确认用户确实要初始化或覆盖。
Initialize the API Key. The optional parameter
--force
is used to replace (overwrite) an existing API Key. This command will write to the local authentication configuration, and you need to confirm that the user really wants to initialize or overwrite before execution.

使用示例

Usage Examples

  • 我的墨问 apikey 是 <apikey>, 帮我完成认证/初始化
    mocli auth init --apik xxxxxx
    • 我的墨问 apikey 换了,帮我更新一下
      mocli auth init --apik xxxxxx --force
  • My MoWen apikey is <apikey>, help me complete authentication/initialization
    mocli auth init --apik xxxxxx
    • My MoWen apikey has changed, help me update it
      mocli auth init --apik xxxxxx --force

mocli auth info [--profile]

mocli auth info [--profile]

获取当前认证配置。可选参数
--profile
用于额外获取当前 API Key 对应账户在墨问平台上的 Profile(用户信息)。
Obtain current authentication configuration. The optional parameter
--profile
is used to additionally retrieve the Profile (user information) of the account corresponding to the current API Key on the MoWen platform.

使用示例

Usage Examples

  • 查看我的墨问认证信息
    mocli auth info
    • 查看我的墨问认证信息并返回我的用户资料
      mocli auth info --profile
  • Check my MoWen authentication information
    mocli auth info
    • Check my MoWen authentication information and return my user profile
      mocli auth info --profile

输出示例

Output Example

{
  "code": 0,
  "status": "OK",
  "reply": {
    "auth": {
      "api_key": "hx3jrU31xxs**********0BVvUm4ytQK",
      "mo_uid": "KBqt7yiVrXBa9DJIJuUm3"
    },
    "profile": {
      "uid": "KBqt7yiVrXBa9DJIJuUm3",
      "name": "精卫鸟zzz🇨🇳",
      "intro": "in culpa nostrud",
      "regist_at": 1662465648,
      "member": {
        "is_member": true,
        "plans": {
          "pro": {
            "type": "pro",
            "status": 64,
            "expire_at": 1852446600011
          }
        }
      }
    }
  }
}
{
  "code": 0,
  "status": "OK",
  "reply": {
    "auth": {
      "api_key": "hx3jrU31xxs**********0BVvUm4ytQK",
      "mo_uid": "KBqt7yiVrXBa9DJIJuUm3"
    },
    "profile": {
      "uid": "KBqt7yiVrXBa9DJIJuUm3",
      "name": "精卫鸟zzz🇨🇳",
      "intro": "in culpa nostrud",
      "regist_at": 1662465648,
      "member": {
        "is_member": true,
        "plans": {
          "pro": {
            "type": "pro",
            "status": 64,
            "expire_at": 1852446600011
          }
        }
      }
    }
  }
}

reply 字段说明

Reply Field Description

字段类型说明引用字段
auth
object认证信息
AuthInfo - 认证信息
profile
object用户在墨问平台上的 Profile(用户信息)
UserInfo - 用户信息
FieldTypeDescriptionReference Field
auth
objectAuthentication information
AuthInfo - Authentication Information
profile
objectUser's Profile (user information) on the MoWen platform
UserInfo - User Information

展示注意事项

Display Notes

  • auth.api_key
    属于敏感信息。展示认证状态时只说明“已配置”或展示脱敏片段,不要输出完整密钥。
    • auth.mo_uid
      可展示,用于帮助用户确认当前认证账号。
    • 如果
      profile
      存在,可展示
      profile.name
      profile.uid
      profile.intro
      、会员状态等非敏感信息。
    • 如果命令失败且
      reason=AUTH
      ,不要继续调用需要认证的命令;先提示用户重新初始化 API Key。
  • auth.api_key
    is sensitive information. When displaying authentication status, only indicate "configured" or show a desensitized fragment, do not output the full key.
    • auth.mo_uid
      can be displayed to help users confirm the currently authenticated account.
    • If
      profile
      exists, non-sensitive information such as
      profile.name
      ,
      profile.uid
      ,
      profile.intro
      , and membership status can be displayed.
    • If the command fails and
      reason=AUTH
      , do not continue to call commands requiring authentication; first prompt the user to re-initialize the API Key.

展示规则

Display Rules

** 参考 **
公共展示规则
** Reference **
Public Display Rules