Documentation
¶
Index ¶
- Constants
- Variables
- type Algorithm
- type Digit
- type OTPAccount
- func (x *OTPAccount) Default()
- func (*OTPAccount) Descriptor() ([]byte, []int)deprecated
- func (x *OTPAccount) Generate() (string, error)
- func (x *OTPAccount) GetAlgorithm() Algorithm
- func (x *OTPAccount) GetCounter() int64
- func (x *OTPAccount) GetDigits() Digit
- func (x *OTPAccount) GetIssuer() string
- func (x *OTPAccount) GetName() string
- func (x *OTPAccount) GetSecret() []byte
- func (x *OTPAccount) GetType() OTPType
- func (x *OTPAccount) Image(width int, height int) (image.Image, error)
- func (*OTPAccount) ProtoMessage()
- func (x *OTPAccount) ProtoReflect() protoreflect.Message
- func (x *OTPAccount) Reset()
- func (x *OTPAccount) String() string
- func (x *OTPAccount) URL() string
- func (x *OTPAccount) ValidFor() time.Duration
- func (x *OTPAccount) Validate(code string) bool
- func (x *OTPAccount) ValidateConfig() error
- type OTPData
- func (x *OTPData) Default()
- func (*OTPData) Descriptor() ([]byte, []int)deprecated
- func (x *OTPData) GetBatchID() int32
- func (x *OTPData) GetBatchIndex() int32
- func (x *OTPData) GetBatchSize() int32
- func (x *OTPData) GetOTPAccounts() []*OTPAccount
- func (x *OTPData) GetVersion() int32
- func (*OTPData) ProtoMessage()
- func (x *OTPData) ProtoReflect() protoreflect.Message
- func (x *OTPData) Reset()
- func (x *OTPData) String() string
- type OTPType
- type Option
Constants ¶
View Source
const (
Period = 30
)
Variables ¶
View Source
var ( Algorithm_name = map[int32]string{ 0: "ALGORITHM_TYPE_UNSPECIFIED", 1: "SHA1", 2: "SHA256", 3: "SHA512", 4: "MD5", } Algorithm_value = map[string]int32{ "ALGORITHM_TYPE_UNSPECIFIED": 0, "SHA1": 1, "SHA256": 2, "SHA512": 3, "MD5": 4, } )
Enum value maps for Algorithm.
View Source
var ( Digit_name = map[int32]string{ 0: "DIGIT_COUNT_UNSPECIFIED", 1: "SIX", 2: "EIGHT", } Digit_value = map[string]int32{ "DIGIT_COUNT_UNSPECIFIED": 0, "SIX": 1, "EIGHT": 2, } )
Enum value maps for DigitCount.
View Source
var ( OTPType_name = map[int32]string{ 0: "OTP_TYPE_UNSPECIFIED", 1: "HOTP", 2: "TOTP", } OTPType_value = map[string]int32{ "OTP_TYPE_UNSPECIFIED": 0, "HOTP": 1, "TOTP": 2, } )
Enum value maps for OtpType.
View Source
var File_gotp_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type Algorithm ¶
type Algorithm int32
func (Algorithm) Descriptor ¶
func (Algorithm) Descriptor() protoreflect.EnumDescriptor
func (Algorithm) EnumDescriptor
deprecated
func (Algorithm) Number ¶
func (x Algorithm) Number() protoreflect.EnumNumber
func (Algorithm) Type ¶
func (Algorithm) Type() protoreflect.EnumType
type Digit ¶
type Digit int32
func (Digit) Descriptor ¶
func (Digit) Descriptor() protoreflect.EnumDescriptor
func (Digit) EnumDescriptor
deprecated
func (Digit) Number ¶
func (x Digit) Number() protoreflect.EnumNumber
func (Digit) Type ¶
func (Digit) Type() protoreflect.EnumType
type OTPAccount ¶
type OTPAccount struct { Secret []byte `protobuf:"bytes,1,opt,name=secret,proto3,oneof" json:"secret,omitempty"` Name *string `protobuf:"bytes,2,opt,name=name,proto3,oneof" json:"name,omitempty"` Issuer *string `protobuf:"bytes,3,opt,name=issuer,proto3,oneof" json:"issuer,omitempty"` Algorithm *Algorithm `protobuf:"varint,4,opt,name=algorithm,proto3,enum=Algorithm,oneof" json:"algorithm,omitempty"` Digits *Digit `protobuf:"varint,5,opt,name=digits,proto3,enum=DigitCount,oneof" json:"digits,omitempty"` Type *OTPType `protobuf:"varint,6,opt,name=type,proto3,enum=OtpType,oneof" json:"type,omitempty"` Counter *int64 `protobuf:"varint,7,opt,name=counter,proto3,oneof" json:"counter,omitempty"` // contains filtered or unexported fields }
func NewOTPAccount ¶
func NewOTPAccount(issuer, name string, opts ...Option) (*OTPAccount, error)
func (*OTPAccount) Default ¶
func (x *OTPAccount) Default()
func (*OTPAccount) Descriptor
deprecated
func (*OTPAccount) Descriptor() ([]byte, []int)
Deprecated: Use OtpAccount.ProtoReflect.Descriptor instead.
func (*OTPAccount) Generate ¶
func (x *OTPAccount) Generate() (string, error)
func (*OTPAccount) GetAlgorithm ¶
func (x *OTPAccount) GetAlgorithm() Algorithm
func (*OTPAccount) GetCounter ¶
func (x *OTPAccount) GetCounter() int64
func (*OTPAccount) GetDigits ¶
func (x *OTPAccount) GetDigits() Digit
func (*OTPAccount) GetIssuer ¶
func (x *OTPAccount) GetIssuer() string
func (*OTPAccount) GetName ¶
func (x *OTPAccount) GetName() string
func (*OTPAccount) GetSecret ¶
func (x *OTPAccount) GetSecret() []byte
func (*OTPAccount) GetType ¶
func (x *OTPAccount) GetType() OTPType
func (*OTPAccount) ProtoMessage ¶
func (*OTPAccount) ProtoMessage()
func (*OTPAccount) ProtoReflect ¶
func (x *OTPAccount) ProtoReflect() protoreflect.Message
func (*OTPAccount) Reset ¶
func (x *OTPAccount) Reset()
func (*OTPAccount) String ¶
func (x *OTPAccount) String() string
func (*OTPAccount) URL ¶
func (x *OTPAccount) URL() string
func (*OTPAccount) ValidFor ¶
func (x *OTPAccount) ValidFor() time.Duration
func (*OTPAccount) Validate ¶
func (x *OTPAccount) Validate(code string) bool
func (*OTPAccount) ValidateConfig ¶
func (x *OTPAccount) ValidateConfig() error
type OTPData ¶
type OTPData struct { OTPAccounts []*OTPAccount `protobuf:"bytes,1,rep,name=otp_accounts,json=otpAccounts,proto3" json:"otp_accounts,omitempty"` Version *int32 `protobuf:"varint,2,opt,name=version,proto3,oneof" json:"version,omitempty"` BatchSize *int32 `protobuf:"varint,3,opt,name=batch_size,json=batchSize,proto3,oneof" json:"batch_size,omitempty"` BatchIndex *int32 `protobuf:"varint,4,opt,name=batch_index,json=batchIndex,proto3,oneof" json:"batch_index,omitempty"` BatchID *int32 `protobuf:"varint,5,opt,name=batch_id,json=batchId,proto3,oneof" json:"batch_id,omitempty"` // contains filtered or unexported fields }
func (*OTPData) Descriptor
deprecated
func (*OTPData) GetBatchID ¶
func (*OTPData) GetBatchIndex ¶
func (*OTPData) GetBatchSize ¶
func (*OTPData) GetOTPAccounts ¶
func (x *OTPData) GetOTPAccounts() []*OTPAccount
func (*OTPData) GetVersion ¶
func (*OTPData) ProtoMessage ¶
func (*OTPData) ProtoMessage()
func (*OTPData) ProtoReflect ¶
func (x *OTPData) ProtoReflect() protoreflect.Message
type OTPType ¶
type OTPType int32
func (OTPType) Descriptor ¶
func (OTPType) Descriptor() protoreflect.EnumDescriptor
func (OTPType) EnumDescriptor
deprecated
func (OTPType) Number ¶
func (x OTPType) Number() protoreflect.EnumNumber
func (OTPType) Type ¶
func (OTPType) Type() protoreflect.EnumType
type Option ¶
type Option func(o *options)
func WithAlgorithm ¶
func WithDigits ¶
func WithSecretSize ¶
Click to show internal directories.
Click to hide internal directories.