More documentation.
This commit is contained in:
@@ -17,26 +17,33 @@ type YubiKey struct {
|
||||
public []byte
|
||||
}
|
||||
|
||||
// Public returns the public component of the token.
|
||||
func (yk *YubiKey) Public() []byte {
|
||||
return yk.public[:]
|
||||
}
|
||||
|
||||
// Counter returns the YubiKey's counter.
|
||||
func (yk *YubiKey) Counter() uint64 {
|
||||
return yk.counter
|
||||
}
|
||||
|
||||
// SetCounter sets the YubiKey's counter.
|
||||
func (yk *YubiKey) SetCounter(counter uint64) {
|
||||
yk.counter = counter & 0xffffffff
|
||||
}
|
||||
|
||||
// Key returns the YubiKey's secret key.
|
||||
func (yk *YubiKey) Key() []byte {
|
||||
return yk.key[:]
|
||||
}
|
||||
|
||||
// Size returns the length of the YubiKey's OTP output plus the length
|
||||
// of the public identifier.
|
||||
func (yk *YubiKey) Size() int {
|
||||
return yubikey.OTPSize + len(yk.public)
|
||||
}
|
||||
|
||||
// OTP returns a new one-time password from the YubiKey.
|
||||
func (yk *YubiKey) OTP() string {
|
||||
otp := yk.token.Generate(yk.key)
|
||||
if otp == nil {
|
||||
@@ -51,6 +58,7 @@ func (yk *YubiKey) Hash() func() hash.Hash {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Type returns YUBIKEY.
|
||||
func (yk *YubiKey) Type() Type {
|
||||
return YUBIKEY
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user