https://github.com/conradsheeran/steam-totp
A library developed using the ArkTS language to obtain Steam mobile authentication codes | 使用 ArkTS 语言开发的实现获取 Steam 手机令牌验证码的库
https://github.com/conradsheeran/steam-totp
arkts harmony harmonyos steam totp totp-generator
Last synced: 2 months ago
JSON representation
A library developed using the ArkTS language to obtain Steam mobile authentication codes | 使用 ArkTS 语言开发的实现获取 Steam 手机令牌验证码的库
- Host: GitHub
- URL: https://github.com/conradsheeran/steam-totp
- Owner: conradsheeran
- License: mit
- Created: 2024-12-11T16:38:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-27T13:19:54.000Z (over 1 year ago)
- Last Synced: 2024-12-27T13:38:16.070Z (over 1 year ago)
- Topics: arkts, harmony, harmonyos, steam, totp, totp-generator
- Language: TypeScript
- Homepage: https://tickauth.com
- Size: 26.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# steam-totp
使用 ArkTS 语言开发的实现获取 Steam 手机令牌验证码的库
## 注意:
1. **最低API要求**:API 12(5.0.0.102)
2. **权限要求**: ohos.permission.INTERNET ( 用于获取服务器时间 )
- 关于系统权限申请, 请参考 [HarmonyOS 开发指南](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/declare-permissions-V5)
## 安装指南:
### 方法一:从 ohpm 安装 (推荐)
1. 通过 DevEco Studio 打开您的项目
2. 在 DevEco Studio 的终端运行:
```bash
ohpm install steam-totp
```
### 方法二:从 Github Release 安装
1. 从 [Github Release](https://github.com/conradsheeran/steam-totp/releases) 下载所需 HAR 共享包
2. 在 DevEco Studio 的终端运行:
```bash
ohpm install path/to/steam-totp.har
```
### 方法三: 在 oh-package.json5 中设置依赖
```json
{
"dependencies": {
"steam-totp": "^1.0.1"
}
}
```
## 使用方法
### 1. generateAuthCode(secret: buffer.Buffer | string, timeOffset: number = 0)
```typescript
import { SteamTOTP } from "steam-totp"
const code: string = await SteamTOTP.generateAuthCode(your_secret)
// 通过获取服务器时间以传入 timeOffset
const timeOffset: number = (await getTimeOffset()).offset
const code: string = await SteamTOTP.generateAuthCode(your_secret, timeOffset)
```
### 2. generateConfirmationCode(identitySecret: buffer.Buffer | string, time: number, tag: string)
```typescript
const timeOffset: number = (await getTimeOffset()).offset
const time: number = SteamTOTP.time(timeOffset)
const tag: string = "allow"
const code: string = await SteamTOTP.generateConfirmationCode(your_identitySecret, time, tag)
```
### 3. getDeviceID(steamID: string)
```typescript
const deviceID: string = await SteamTOTP.getDeviceID(your_steamID)
```