Some checks failed
Security Scan / backend-security (push) Failing after 3s
Security Scan / frontend-security (push) Failing after 5s
CI / test (push) Failing after 3s
CI / frontend (push) Failing after 3s
CI / golangci-lint (push) Failing after 3s
CI / windsurf-platform (macos-latest) (push) Has been cancelled
CI / windsurf-platform (windows-latest) (push) Has been cancelled
29 lines
1.3 KiB
Go
29 lines
1.3 KiB
Go
package service
|
|
|
|
import "github.com/Wei-Shaw/sub2api/internal/pkg/claude"
|
|
|
|
// ==============================================================
|
|
// antigravity — identity_service 扩展
|
|
//
|
|
// 此文件包含 Antigravity fork 对 IdentityService 的扩展,
|
|
// 新增了实例级隔离盐值和指纹默认值覆盖功能。
|
|
//
|
|
// 对上游文件 identity_service.go 的最小化改动:
|
|
// - defaultFingerprint 版本号更新
|
|
// - IdentityService struct 新增 instanceSalt 字段
|
|
// ==============================================================
|
|
|
|
// ApplyDefaultFingerprintOverrides 用配置覆盖 identity_service 的默认指纹
|
|
// 允许不同部署实例设置不同的 CLI/SDK 版本号,避免所有实例指纹相同
|
|
func ApplyDefaultFingerprintOverrides(cliVersion, pkgVersion, runtimeVersion, os_, arch string) {
|
|
claude.ApplyFingerprintOverrides(cliVersion, pkgVersion, runtimeVersion, os_, arch)
|
|
defaultFingerprint = defaultIdentityFingerprint()
|
|
}
|
|
|
|
// NewIdentityServiceWithSalt 创建带实例盐值的 IdentityService
|
|
// 实例盐值用于 user_id 重写时的 session hash 混淆,
|
|
// 使不同 sub2api 实例对相同输入产生不同的 hash 输出,增加隔离性
|
|
func NewIdentityServiceWithSalt(cache IdentityCache, salt string) *IdentityService {
|
|
return &IdentityService{cache: cache, instanceSalt: salt}
|
|
}
|