19 lines
415 B
Go
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
|
|
}
|