1
0
Files
vault_totp/internal/consts.go
2025-12-23 20:58:56 -05:00

45 lines
1.3 KiB
Go

package internal
import (
`log`
`github.com/go-playground/validator/v10`
`r00t2.io/goutils/logging`
)
const (
ParseNsDelim string = "-"
ParseEnvNsDelim string = "_"
)
const (
cmdPfx string = "vault_totp"
logFlags int = log.LstdFlags | log.Lmsgprefix
logFlagsDebug int = logFlags | log.Llongfile
)
const (
// These attrs need to be added to new SecretService TOTP secrets
// ~/.local/share/gnome-shell/extensions/totp@dkosmari.github.com/schemas/org.gnome.shell.extensions.totp.gschema.xml
SsSchemaName string = "xdg:schema"
SsSchemaVal string = "org.gnome.shell.extensions.totp" // also the gosecret.ItemType
)
var (
Logger *logging.MultiLogger
validate *validator.Validate = validator.New(validator.WithRequiredStructEnabled())
)
var (
/*
These map from one form to the other using introspection.
ext: The GNOME Shell extension, ~/.local/share/gnome-shell/extensions/totp@dkosmari.github.com/secretUtils.js (makeSchema())
Also found at https://github.com/dkosmari/gnome-shell-extension-totp/blob/master/secretUtils.js#L33-L45
vault: A https://pkg.go.dev/github.com/hashicorp/vault-client-go@/schema#TotpCreateKeyRequest
(reading a key returns a map[string]interface{} for ...some reason)
url: A https://pkg.go.dev/github.com/creachadair/otp/otpauth#URL
*/
// TODO?
)