XuqmGroup-RNSDK/packages/license
2026-06-16 13:49:30 +08:00
..
src fix: 功能缺陷修复 — ImSDK login await WebSocket、fetchHistory 支持 GROUP、License 改用 apiRequest、LogQueue 重试上限 2026-06-16 13:49:30 +08:00
package.json fix: @xuqm/rn-common 从 dependencies 移到 peerDependencies,避免宿主项目嵌套安装旧版 2026-06-16 13:27:23 +08:00
README.md docs: 添加 CLAUDE.md + 各 package README + 架构总览 + 模块待开发说明 2026-06-16 12:14:52 +08:00

@xuqm/rn-license

XuqmGroup RN SDK 证书授权模块。提供设备 License 验证能力。

安装

yarn add @xuqm/rn-license react-native-quick-crypto

Peer dependenciesreact-native >= 0.76@react-native-async-storage/async-storage >= 1.21.0react-native-quick-crypto >= 0.7.0

使用

无需独立初始化。 内部自动调用 awaitInitialization() 等待 XuqmSDK 就绪。

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 缓存

类型

interface LicenseUserInfo {
  userId?: string
  userSig?: string
}

type LicenseStatus = 'ok' | 'denied' | 'unknown'

interface LicenseResult {
  type: 'success' | 'denied' | 'error'
  reason?: string
  message?: string
}