package main import ( `sync` `github.com/jessevdk/go-flags` `r00t2.io/goutils/logging` ) var ( logger logging.Logger args *Args = new(Args) parser *flags.Parser = flags.NewParser(args, flags.Default) ) var ( wg sync.WaitGroup existingOtp map[string]struct{} = make(map[string]struct{}) urlChan chan parsedUrl = make(chan parsedUrl) doneChan chan bool = make(chan bool, 1) vaultReady chan bool = make(chan bool, 1) ) const ( // stdScheme is a public standard, documented at https://github.com/google/google-authenticator/wiki/Key-Uri-Format stdScheme string = "otpauth://" /* googleScheme is a "wrapper" around that that has never been, to my knowledge, publicly formally documented because we can't have nice things. */ googleScheme string = "otpauth-migration://" // vaultSep is used to join the issuer and account in a name. vaultSep string = "." // defStoreMnt is used if no mount was provided (but a path was) to -M/--store. defStoreMnt string = "secrets" /* ssCollectionNm is the SecretService collection name used by https://extensions.gnome.org/extension/6793/totp/ (https://github.com/dkosmari/gnome-shell-extension-totp) */ ssCollectionNm string = "OTP" // TODO: Adding to SS /* Will look something like this: if svc, err = gosecret.NewService(); err != nil { return } defer svc.Close() if coll, err = svc.GetCollection(ssCollectionNm); err != nil { return } secret = gosecret.NewSecret( svc.Session, []byte{}, // nil? gosecret.SecretValue(sharedTotpKey), ssContentType, ) itemAttrs = map[string]string{ "type": "TOTP", "algorithm": "(MD5|SHA-1|SHA-256|SHA-512)", "digits": "(6|8)", "issuer": "", "name": "", "period": "" ssSchemaAttr: ssSchemaVal, } if item, err = coll.CreateItem( "::", itemAttrs, secret, true, ); err != nil { return } */ // ssSchemaAttr is used when adding a secret to the SecretService. ssSchemaAttr string = "xdg:schema" /* ssSchemaVal is the value for the attribute specified by ssSchemaAttr. It is also the value used as the [r00t2.io/gosecret.Item.SecretType] when adding. */ ssSchemaVal string = "org.gnome.shell.extensions.totp" // ssContentType is the value to use for [r00t2.io/gosecret.Secret.ContentType] when adding. ssContentType string = "text/plain" )