add Name to auth.Account as a user friendly alias (#1992)

* add Name to auth.Account as a user friendly alias
This commit is contained in:
Dominic Wong
2020-09-10 14:49:51 +01:00
committed by GitHub
parent 04d2aa4696
commit 601b223cfb
6 changed files with 58 additions and 5 deletions

View File

@@ -110,6 +110,8 @@ type GenerateOptions struct {
Secret string
// Issuer of the account, e.g. micro
Issuer string
// Name of the acouunt e.g. an email or username
Name string
}
type GenerateOption func(o *GenerateOptions)
@@ -156,6 +158,13 @@ func WithIssuer(i string) GenerateOption {
}
}
// WithName for the generated account
func WithName(n string) GenerateOption {
return func(o *GenerateOptions) {
o.Name = n
}
}
// NewGenerateOptions from a slice of options
func NewGenerateOptions(opts ...GenerateOption) GenerateOptions {
var options GenerateOptions