diff options
| author | James Elliott <james-d-elliott@users.noreply.github.com> | 2022-12-23 15:00:23 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-23 15:00:23 +1100 |
| commit | d7ab3bb6333af2c7bede8c10b99b216bbe215d07 (patch) | |
| tree | 1e30120a586f7f76a694a91d6f49ae5eca1e2078 /internal/commands/util.go | |
| parent | 0130edb870137b86ceb686505616796bd20c9b1a (diff) | |
feat(commands): storage import/export commands (#4545)
This adds commands to export and import TOTP configurations and Webauthn devices as YAML.
Diffstat (limited to 'internal/commands/util.go')
| -rw-r--r-- | internal/commands/util.go | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/internal/commands/util.go b/internal/commands/util.go index 8d1eb95d4..19072f9a4 100644 --- a/internal/commands/util.go +++ b/internal/commands/util.go @@ -46,37 +46,6 @@ func flagsGetUserIdentifiersGenerateOptions(flags *pflag.FlagSet) (users, servic return users, services, sectors, nil } -func flagsGetTOTPExportOptions(flags *pflag.FlagSet) (format, dir string, err error) { - if format, err = flags.GetString(cmdFlagNameFormat); err != nil { - return "", "", err - } - - if dir, err = flags.GetString("dir"); err != nil { - return "", "", err - } - - switch format { - case storageTOTPExportFormatCSV, storageTOTPExportFormatURI: - break - case storageTOTPExportFormatPNG: - if dir == "" { - dir = utils.RandomString(8, utils.CharSetAlphaNumeric, false) - } - - if _, err = os.Stat(dir); !os.IsNotExist(err) { - return "", "", errors.New("output directory must not exist") - } - - if err = os.MkdirAll(dir, 0700); err != nil { - return "", "", err - } - default: - return "", "", errors.New("format must be csv, uri, or png") - } - - return format, dir, nil -} - //nolint:gocyclo func flagsGetRandomCharacters(flags *pflag.FlagSet, flagNameLength, flagNameCharSet, flagNameCharacters string) (r string, err error) { var ( |
