Files
cmii-uav-watchdog-project/cmii-uav-watchdog-center/services/totp_service.go
2025-12-06 11:26:05 +08:00

19 lines
415 B
Go

package services
import (
"cmii-uav-watchdog-common/totp_tier_one"
"cmii-uav-watchdog-otp/totp"
"log"
)
// GenerateTierOneTOTPSecret 生成一级TOTP密钥 只能center调用
func GenerateTierOneTOTPSecret() (string, error) {
secret, err := totp.Generate(totp_tier_one.TierOneTOTPSecretOpts)
if err != nil {
log.Printf("生成TOTP密钥失败: %v", err)
return "", err
}
return secret.Secret(), nil
}