This commit is contained in:
zeaslity
2025-03-13 11:22:44 +08:00
parent 34147b2f69
commit 4f8a8a6ff2
6 changed files with 117 additions and 51 deletions

View File

@@ -77,6 +77,14 @@ type ValidateOpts struct {
Encoder otp.Encoder
}
func (opts *ValidateOpts) ConvertToValidateOpts(generateOpts GenerateOpts) {
opts.Period = generateOpts.Period
opts.Skew = 1
opts.Digits = generateOpts.Digits
opts.Algorithm = generateOpts.Algorithm
opts.Encoder = otp.EncoderDefault
}
// GenerateCodeCustom takes a timepoint and produces a passcode using a
// secret and the provided opts. (Under the hood, this is making an adapted
// call to hcmii-uav-watchdog-otp.GenerateCodeCustom)