Versions in this module Expand all Collapse all v1 v1.0.0 Jan 23, 2016 Changes in this version + var ErrIncorrectCode = errors.New("code is invalid") + var ErrIncorrectKeyFormat = errors.New("incorrect key format") + func ExpectedCode(counter uint64, secretBytes []byte) string + func SyncSudoers(ud *UsersData, loginGroups []string, sudoGroups []string, dryRun bool) error + func SyncUsers(ud *UsersData, groups []string, dryRun bool, stdout io.Writer) error + func ValidateCode(user User, code string, yubicoClientID, yubicoSecretKey string) error + type AdminKey struct + AdminPrivateKey [32]byte + HostPublicKey [32]byte + func GenerateKeyPair() AdminKey + func (ak *AdminKey) UnmarshalJSON(b []byte) error + func (ak *AdminKey) UnmarshalText(text []byte) error + func (ak AdminKey) MarshalJSON() ([]byte, error) + func (ak AdminKey) MarshalText() (text []byte, err error) + func (ak AdminKey) String() string + type BackupCode struct + CreateTime time.Time + Hash []byte + Salt []byte + func NewBackupCode(code string) BackupCode + func (bc BackupCode) Matches(userCode string) bool + type HostKey struct + AdminPublicKey [32]byte + HostPrivateKey [32]byte + func (hk *HostKey) UnmarshalJSON(b []byte) error + func (hk *HostKey) UnmarshalText(text []byte) error + func (hk HostKey) MarshalJSON() ([]byte, error) + func (hk HostKey) MarshalText() (text []byte, err error) + func (hk HostKey) String() string + type TOTPCode struct + Hash []byte + Salt []byte + Time time.Time + type TOTPDevice struct + Codes []TOTPCode + CreateTime time.Time + Name string + SecretEncrypted []byte + SecretNonce []byte + func (d *TOTPDevice) GenerateCodes(startTime, endTime time.Time, adminKey AdminKey) error + func (d *TOTPDevice) SetSecret(adminKey AdminKey, secret string) + func (d TOTPDevice) Secret(adminKey AdminKey) (string, error) + func (d TOTPDevice) VerifyCode(now time.Time, skew time.Duration, userCode string) error + type User struct + AuthorizedKeys []string + BackupCodes []BackupCode + Email string + Groups []string + Name string + RealName string + TOTPDevices []TOTPDevice + Yubikeys []YubikeyDevice + func (u User) InAnyGroup(groupNames []string) bool + func (u User) InGroup(groupName string) bool + type UsersData struct + Users []User + YubikeyClientID string + YubikeyClientSecret string + func GetLocalCache(path string, hostKey HostKey) (*UsersData, error) + func LoadUsersData(data []byte, hostKey HostKey) (*UsersData, error) + func UpdateLocalCache(path string, upstreamURL string, hostKey HostKey) (*UsersData, error) + func (ud *UsersData) Delete(userName string) + func (ud *UsersData) Set(user User) + func (ud UsersData) GetUserByName(name string) *User + func (ud UsersData) SignedString(adminKey AdminKey) ([]byte, error) + type YubikeyDevice struct + CreateTime time.Time + DeviceID string + Name string