XuqmGroup-RNSDK/packages/license/README.md
XuqmGroup 4c3019edab docs: 添加 CLAUDE.md + 各 package README + 架构总览 + 模块待开发说明
Agent 8 文档生成:
- CLAUDE.md 项目上下文
- 各 package README (common/update/push/im/xwebview/license/log)
- docs/架构总览.md
- docs/模块待开发说明.md
2026-06-16 12:14:52 +08:00

60 行
1.3 KiB
Markdown

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

# @xuqm/rn-license
XuqmGroup RN SDK 证书授权模块。提供设备 License 验证能力。
## 安装
```bash
yarn add @xuqm/rn-license react-native-quick-crypto
```
Peer dependencies`react-native >= 0.76`,`@react-native-async-storage/async-storage >= 1.21.0`,`react-native-quick-crypto >= 0.7.0`
## 使用
**无需独立初始化。** 内部自动调用 `awaitInitialization()` 等待 `XuqmSDK` 就绪。
```ts
import { checkLicense, getStatus, clear } from '@xuqm/rn-license'
// 验证 License
const result = await checkLicense()
if (result.type === 'success') {
console.log('License 通过:', result.reason)
} else {
console.error('License 失败:', result.message)
}
// 获取状态
const status = await getStatus() // 'ok' | 'denied' | 'unknown'
// 清除本地缓存(调试用)
await clear()
```
## API
| API | 说明 |
|-----|------|
| `checkLicense(userInfo?)` | 验证设备 License |
| `getStatus()` | 获取当前 License 状态 |
| `getDeviceId()` | 获取设备 ID |
| `clear()` | 清除本地 License 缓存 |
## 类型
```ts
interface LicenseUserInfo {
userId?: string
userSig?: string
}
type LicenseStatus = 'ok' | 'denied' | 'unknown'
interface LicenseResult {
type: 'success' | 'denied' | 'error'
reason?: string
message?: string
}
```