Documentation
¶
Index ¶
- Constants
- func BuildOTPAuthURI(account Account) string
- func FormatOTP(otp string) string
- func GenerateHOTP(secret string, counter int64, digits int, algorithm string) (string, error)
- func GenerateQRCodePNG(account Account, size int) ([]byte, error)
- func GenerateSteamCode(secret string, interval int64) (string, int64, error)
- func GenerateTOTP(secret string, interval int64, digits int) (otp string, timeRemaining int64, err error)
- func GenerateTOTPWithAlgorithm(secret string, interval int64, digits int, algorithm string) (otp string, timeRemaining int64, err error)
- func NormalizeAlgorithm(alg string) string
- func NormalizeType(t string) string
- func ParseOtpauthURI(uri string) (account string, secret string, interval int, digits int, algorithm string, ...)
- func PreviewSecret(secret string) string
- func ReadQRFromFile(fp string) (string, error)
- func SplitAccountName(name string) (issuer, label string, hasIssuer bool)
- func ValidateAccountInput(account, secret string) error
- func ValidateDigits(digits int) error
- type Account
- type AccountChange
- type AccountSnapshot
- type HealthItem
- type HealthLevel
- type HealthReport
- type HealthSummary
- type ImportResult
- type Service
- func (s Service) DeleteAccount(account string) (int, error)
- func (s Service) HealthReport() (HealthReport, error)
- func (s Service) ImportAccountsFromQR(qrFile string) (ImportResult, error)
- func (s Service) LoadAccounts() ([]Account, error)
- func (s Service) MigrateLegacyFrom(path string, removeSource bool) (UpsertSummary, error)
- func (s Service) SaveAccounts(accounts []Account) error
- func (s Service) SetAccountArchived(name string, archived bool) error
- func (s Service) UpdateAccount(currentName string, updated Account) error
- func (s Service) UpsertAccounts(incoming []Account) (UpsertSummary, error)
- type UpsertSummary
Constants ¶
View Source
const ( DefaultLegacyAccountFile = "accounts.json" DefaultStoreFileName = "accounts.enc" DefaultKeyFileName = "accounts.key" DefaultInterval = 30 DefaultDigits = 6 )
View Source
const ( AlgorithmSHA1 = "SHA1" AlgorithmSHA256 = "SHA256" AlgorithmSHA512 = "SHA512" TypeTOTP = "totp" TypeHOTP = "hotp" TypeSteam = "steam" )
Variables ¶
This section is empty.
Functions ¶
func BuildOTPAuthURI ¶ added in v1.4.0
func GenerateHOTP ¶ added in v1.4.0
func GenerateQRCodePNG ¶ added in v1.4.0
GenerateQRCodePNG creates a QR code PNG for the account's otpauth URI.
func GenerateSteamCode ¶ added in v1.4.0
func GenerateTOTP ¶
func GenerateTOTPWithAlgorithm ¶ added in v1.4.0
func NormalizeAlgorithm ¶ added in v1.4.0
func NormalizeType ¶ added in v1.4.0
func ParseOtpauthURI ¶
func PreviewSecret ¶
func ReadQRFromFile ¶
func SplitAccountName ¶
func ValidateAccountInput ¶
func ValidateDigits ¶
Types ¶
type Account ¶
type Account struct {
Name string `json:"Name"`
Secret string `json:"Secret"`
Interval int64 `json:"Interval"`
Digits int `json:"Digits"`
Algorithm string `json:"Algorithm,omitempty"`
Type string `json:"Type,omitempty"`
Counter int64 `json:"Counter,omitempty"`
Tags []string `json:"Tags,omitempty"`
Favorite bool `json:"Favorite,omitempty"`
Notes string `json:"Notes,omitempty"`
SortOrder int `json:"SortOrder,omitempty"`
Archived bool `json:"Archived,omitempty"`
}
func ParseQRPayload ¶
type AccountChange ¶
type AccountSnapshot ¶
type AccountSnapshot struct {
Account Account `json:"-"`
Name string `json:"name"`
DisplayName string `json:"displayName"`
Issuer string `json:"issuer"`
Label string `json:"label"`
OTP string `json:"otp"`
FormattedOTP string `json:"formattedOTP"`
TimeRemaining int64 `json:"timeRemaining"`
Interval int64 `json:"interval"`
Digits int `json:"digits"`
Algorithm string `json:"algorithm"`
Type string `json:"type"`
Counter int64 `json:"counter,omitempty"`
Tags []string `json:"tags,omitempty"`
Favorite bool `json:"favorite"`
Notes string `json:"notes,omitempty"`
SortOrder int `json:"sortOrder"`
Archived bool `json:"archived"`
StatusLabel string `json:"statusLabel"`
Tone string `json:"tone"`
ProgressPercent int `json:"progressPercent"`
PolicyLabel string `json:"policyLabel"`
SecretPreview string `json:"secretPreview"`
ErrorText string `json:"errorText,omitempty"`
}
func BuildAccountSnapshot ¶
func BuildAccountSnapshot(account Account) AccountSnapshot
type HealthItem ¶
type HealthItem struct {
Level HealthLevel `json:"level"`
Title string `json:"title"`
Detail string `json:"detail"`
Account string `json:"account,omitempty"`
}
func AnalyzeAccounts ¶
func AnalyzeAccounts(accounts []Account) []HealthItem
type HealthLevel ¶
type HealthLevel string
const ( HealthLevelCritical HealthLevel = "critical" HealthLevelWarning HealthLevel = "warning" HealthLevelInfo HealthLevel = "info" )
type HealthReport ¶
type HealthReport struct {
Items []HealthItem `json:"items"`
Summary HealthSummary `json:"summary"`
Total int `json:"total"`
}
type HealthSummary ¶
type HealthSummary struct {
Critical int `json:"critical"`
Warning int `json:"warning"`
Info int `json:"info"`
}
func SummarizeHealth ¶
func SummarizeHealth(items []HealthItem) HealthSummary
type ImportResult ¶
type ImportResult struct {
Summary UpsertSummary `json:"summary"`
Skipped []string `json:"skipped"`
}
type Service ¶
func NewService ¶
func (Service) HealthReport ¶
func (s Service) HealthReport() (HealthReport, error)
func (Service) ImportAccountsFromQR ¶
func (s Service) ImportAccountsFromQR(qrFile string) (ImportResult, error)
func (Service) LoadAccounts ¶
func (Service) MigrateLegacyFrom ¶
func (s Service) MigrateLegacyFrom(path string, removeSource bool) (UpsertSummary, error)
func (Service) SaveAccounts ¶
func (Service) SetAccountArchived ¶ added in v1.4.0
func (Service) UpdateAccount ¶
func (Service) UpsertAccounts ¶
func (s Service) UpsertAccounts(incoming []Account) (UpsertSummary, error)
type UpsertSummary ¶
type UpsertSummary struct {
Added int `json:"added"`
Replaced int `json:"replaced"`
Changes []AccountChange `json:"changes"`
}
Click to show internal directories.
Click to hide internal directories.