Documentation
¶
Index ¶
- Variables
- type BboltMFASecretStorage
- type Export
- type MFAClient
- func (c *MFAClient) Close() error
- func (c *MFAClient) DecryptExportFile(encryptedContent, password string) (string, error)
- func (c *MFAClient) EncryptExportFile(fileContent, password string) (string, error)
- func (c *MFAClient) ExportSecrets() ([]TOTPStored, error)
- func (c *MFAClient) ExportSecretsToUrl(secrets []TOTPStored, isGoogle bool) ([]string, error)
- func (c *MFAClient) GetAllTOTPSecrets() ([]TOTPcode, error)
- func (c *MFAClient) OpenStorage() (*MFAClient, error)
- func (c *MFAClient) RemoveTOTPSecretByCode(code TOTPcode) error
- func (c *MFAClient) StoreTOTPSecret(secret TOTPStored) error
- func (c *MFAClient) StoreTOTPSecretByURL(inputUrl string) error
- type MigrationPayload
- func (*MigrationPayload) Descriptor() ([]byte, []int)deprecated
- func (x *MigrationPayload) GetBatchId() int32
- func (x *MigrationPayload) GetBatchIndex() int32
- func (x *MigrationPayload) GetBatchSize() int32
- func (x *MigrationPayload) GetOtpParameters() []*MigrationPayload_OtpParameters
- func (x *MigrationPayload) GetVersion() int32
- func (*MigrationPayload) ProtoMessage()
- func (x *MigrationPayload) ProtoReflect() protoreflect.Message
- func (x *MigrationPayload) Reset()
- func (x *MigrationPayload) String() string
- type MigrationPayload_Algorithm
- func (MigrationPayload_Algorithm) Descriptor() protoreflect.EnumDescriptor
- func (x MigrationPayload_Algorithm) Enum() *MigrationPayload_Algorithm
- func (MigrationPayload_Algorithm) EnumDescriptor() ([]byte, []int)deprecated
- func (x MigrationPayload_Algorithm) Number() protoreflect.EnumNumber
- func (x MigrationPayload_Algorithm) String() string
- func (MigrationPayload_Algorithm) Type() protoreflect.EnumType
- type MigrationPayload_DigitCount
- func (MigrationPayload_DigitCount) Descriptor() protoreflect.EnumDescriptor
- func (x MigrationPayload_DigitCount) Enum() *MigrationPayload_DigitCount
- func (MigrationPayload_DigitCount) EnumDescriptor() ([]byte, []int)deprecated
- func (x MigrationPayload_DigitCount) Number() protoreflect.EnumNumber
- func (x MigrationPayload_DigitCount) String() string
- func (MigrationPayload_DigitCount) Type() protoreflect.EnumType
- type MigrationPayload_OtpParameters
- func (*MigrationPayload_OtpParameters) Descriptor() ([]byte, []int)deprecated
- func (x *MigrationPayload_OtpParameters) GetAlgorithm() MigrationPayload_Algorithm
- func (x *MigrationPayload_OtpParameters) GetCounter() int64
- func (x *MigrationPayload_OtpParameters) GetDigits() MigrationPayload_DigitCount
- func (x *MigrationPayload_OtpParameters) GetIssuer() string
- func (x *MigrationPayload_OtpParameters) GetName() string
- func (x *MigrationPayload_OtpParameters) GetSecret() []byte
- func (x *MigrationPayload_OtpParameters) GetType() MigrationPayload_OtpType
- func (*MigrationPayload_OtpParameters) ProtoMessage()
- func (x *MigrationPayload_OtpParameters) ProtoReflect() protoreflect.Message
- func (x *MigrationPayload_OtpParameters) Reset()
- func (x *MigrationPayload_OtpParameters) String() string
- type MigrationPayload_OtpType
- func (MigrationPayload_OtpType) Descriptor() protoreflect.EnumDescriptor
- func (x MigrationPayload_OtpType) Enum() *MigrationPayload_OtpType
- func (MigrationPayload_OtpType) EnumDescriptor() ([]byte, []int)deprecated
- func (x MigrationPayload_OtpType) Number() protoreflect.EnumNumber
- func (x MigrationPayload_OtpType) String() string
- func (MigrationPayload_OtpType) Type() protoreflect.EnumType
- type TOTP
- type TOTPImpl
- type TOTPSecretStorage
- type TOTPStored
- type TOTPcode
Constants ¶
This section is empty.
Variables ¶
var ( MigrationPayload_Algorithm_name = map[int32]string{ 0: "ALGORITHM_UNSPECIFIED", 1: "ALGORITHM_SHA1", 2: "ALGORITHM_SHA256", 3: "ALGORITHM_SHA512", 4: "ALGORITHM_MD5", } MigrationPayload_Algorithm_value = map[string]int32{ "ALGORITHM_UNSPECIFIED": 0, "ALGORITHM_SHA1": 1, "ALGORITHM_SHA256": 2, "ALGORITHM_SHA512": 3, "ALGORITHM_MD5": 4, } )
Enum value maps for MigrationPayload_Algorithm.
var ( MigrationPayload_DigitCount_name = map[int32]string{ 0: "DIGIT_COUNT_UNSPECIFIED", 1: "DIGIT_COUNT_SIX", 2: "DIGIT_COUNT_EIGHT", } MigrationPayload_DigitCount_value = map[string]int32{ "DIGIT_COUNT_UNSPECIFIED": 0, "DIGIT_COUNT_SIX": 1, "DIGIT_COUNT_EIGHT": 2, } )
Enum value maps for MigrationPayload_DigitCount.
var ( MigrationPayload_OtpType_name = map[int32]string{ 0: "OTP_TYPE_UNSPECIFIED", 1: "OTP_TYPE_HOTP", 2: "OTP_TYPE_TOTP", } MigrationPayload_OtpType_value = map[string]int32{ "OTP_TYPE_UNSPECIFIED": 0, "OTP_TYPE_HOTP": 1, "OTP_TYPE_TOTP": 2, } )
Enum value maps for MigrationPayload_OtpType.
var File_googleMigration_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type BboltMFASecretStorage ¶
type BboltMFASecretStorage struct {
// contains filtered or unexported fields
}
func NewBboltMFASecretStorage ¶
func NewBboltMFASecretStorage(db *bbolt.DB, aesKey [32]byte) *BboltMFASecretStorage
func (*BboltMFASecretStorage) ClearStorage ¶
func (s *BboltMFASecretStorage) ClearStorage() error
func (*BboltMFASecretStorage) DeleteTOTPSecretBySecret ¶
func (s *BboltMFASecretStorage) DeleteTOTPSecretBySecret(secretStr string) error
func (*BboltMFASecretStorage) GetAllTOTPSecrets ¶
func (s *BboltMFASecretStorage) GetAllTOTPSecrets() ([]TOTPStored, error)
func (*BboltMFASecretStorage) StoreTOTPSecret ¶
func (s *BboltMFASecretStorage) StoreTOTPSecret(secret TOTPStored) error
type MFAClient ¶
type MFAClient struct {
MFASecretStorage TOTPSecretStorage
// contains filtered or unexported fields
}
func (*MFAClient) DecryptExportFile ¶
func (*MFAClient) EncryptExportFile ¶
func (*MFAClient) ExportSecrets ¶
func (c *MFAClient) ExportSecrets() ([]TOTPStored, error)
func (*MFAClient) ExportSecretsToUrl ¶
func (c *MFAClient) ExportSecretsToUrl(secrets []TOTPStored, isGoogle bool) ([]string, error)
func (*MFAClient) GetAllTOTPSecrets ¶
func (*MFAClient) OpenStorage ¶
OpenStorage initializes and opens the storage for MFA secrets. We did this so we can always start the client without risk of errors but only open the storage when experimental features are enabled. so we don't need to restart the whole app when they're toggled and so integration tests run properly.
func (*MFAClient) RemoveTOTPSecretByCode ¶
func (*MFAClient) StoreTOTPSecret ¶
func (c *MFAClient) StoreTOTPSecret(secret TOTPStored) error
func (*MFAClient) StoreTOTPSecretByURL ¶
type MigrationPayload ¶
type MigrationPayload struct {
OtpParameters []*MigrationPayload_OtpParameters `protobuf:"bytes,1,rep,name=otp_parameters,json=otpParameters,proto3" json:"otp_parameters,omitempty"`
Version int32 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
BatchSize int32 `protobuf:"varint,3,opt,name=batch_size,json=batchSize,proto3" json:"batch_size,omitempty"`
BatchIndex int32 `protobuf:"varint,4,opt,name=batch_index,json=batchIndex,proto3" json:"batch_index,omitempty"`
BatchId int32 `protobuf:"varint,5,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"`
// contains filtered or unexported fields
}
func (*MigrationPayload) Descriptor
deprecated
func (*MigrationPayload) Descriptor() ([]byte, []int)
Deprecated: Use MigrationPayload.ProtoReflect.Descriptor instead.
func (*MigrationPayload) GetBatchId ¶
func (x *MigrationPayload) GetBatchId() int32
func (*MigrationPayload) GetBatchIndex ¶
func (x *MigrationPayload) GetBatchIndex() int32
func (*MigrationPayload) GetBatchSize ¶
func (x *MigrationPayload) GetBatchSize() int32
func (*MigrationPayload) GetOtpParameters ¶
func (x *MigrationPayload) GetOtpParameters() []*MigrationPayload_OtpParameters
func (*MigrationPayload) GetVersion ¶
func (x *MigrationPayload) GetVersion() int32
func (*MigrationPayload) ProtoMessage ¶
func (*MigrationPayload) ProtoMessage()
func (*MigrationPayload) ProtoReflect ¶
func (x *MigrationPayload) ProtoReflect() protoreflect.Message
func (*MigrationPayload) Reset ¶
func (x *MigrationPayload) Reset()
func (*MigrationPayload) String ¶
func (x *MigrationPayload) String() string
type MigrationPayload_Algorithm ¶
type MigrationPayload_Algorithm int32
const ( MigrationPayload_ALGORITHM_UNSPECIFIED MigrationPayload_Algorithm = 0 MigrationPayload_ALGORITHM_SHA1 MigrationPayload_Algorithm = 1 MigrationPayload_ALGORITHM_SHA256 MigrationPayload_Algorithm = 2 MigrationPayload_ALGORITHM_SHA512 MigrationPayload_Algorithm = 3 MigrationPayload_ALGORITHM_MD5 MigrationPayload_Algorithm = 4 )
func (MigrationPayload_Algorithm) Descriptor ¶
func (MigrationPayload_Algorithm) Descriptor() protoreflect.EnumDescriptor
func (MigrationPayload_Algorithm) Enum ¶
func (x MigrationPayload_Algorithm) Enum() *MigrationPayload_Algorithm
func (MigrationPayload_Algorithm) EnumDescriptor
deprecated
func (MigrationPayload_Algorithm) EnumDescriptor() ([]byte, []int)
Deprecated: Use MigrationPayload_Algorithm.Descriptor instead.
func (MigrationPayload_Algorithm) Number ¶
func (x MigrationPayload_Algorithm) Number() protoreflect.EnumNumber
func (MigrationPayload_Algorithm) String ¶
func (x MigrationPayload_Algorithm) String() string
func (MigrationPayload_Algorithm) Type ¶
func (MigrationPayload_Algorithm) Type() protoreflect.EnumType
type MigrationPayload_DigitCount ¶
type MigrationPayload_DigitCount int32
const ( MigrationPayload_DIGIT_COUNT_UNSPECIFIED MigrationPayload_DigitCount = 0 MigrationPayload_DIGIT_COUNT_SIX MigrationPayload_DigitCount = 1 MigrationPayload_DIGIT_COUNT_EIGHT MigrationPayload_DigitCount = 2 )
func (MigrationPayload_DigitCount) Descriptor ¶
func (MigrationPayload_DigitCount) Descriptor() protoreflect.EnumDescriptor
func (MigrationPayload_DigitCount) Enum ¶
func (x MigrationPayload_DigitCount) Enum() *MigrationPayload_DigitCount
func (MigrationPayload_DigitCount) EnumDescriptor
deprecated
func (MigrationPayload_DigitCount) EnumDescriptor() ([]byte, []int)
Deprecated: Use MigrationPayload_DigitCount.Descriptor instead.
func (MigrationPayload_DigitCount) Number ¶
func (x MigrationPayload_DigitCount) Number() protoreflect.EnumNumber
func (MigrationPayload_DigitCount) String ¶
func (x MigrationPayload_DigitCount) String() string
func (MigrationPayload_DigitCount) Type ¶
func (MigrationPayload_DigitCount) Type() protoreflect.EnumType
type MigrationPayload_OtpParameters ¶
type MigrationPayload_OtpParameters struct {
Secret []byte `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Issuer string `protobuf:"bytes,3,opt,name=issuer,proto3" json:"issuer,omitempty"`
Algorithm MigrationPayload_Algorithm `protobuf:"varint,4,opt,name=algorithm,proto3,enum=TwoFaGo.MigrationPayload_Algorithm" json:"algorithm,omitempty"`
Digits MigrationPayload_DigitCount `protobuf:"varint,5,opt,name=digits,proto3,enum=TwoFaGo.MigrationPayload_DigitCount" json:"digits,omitempty"`
Type MigrationPayload_OtpType `protobuf:"varint,6,opt,name=type,proto3,enum=TwoFaGo.MigrationPayload_OtpType" json:"type,omitempty"`
Counter int64 `protobuf:"varint,7,opt,name=counter,proto3" json:"counter,omitempty"`
// contains filtered or unexported fields
}
func (*MigrationPayload_OtpParameters) Descriptor
deprecated
func (*MigrationPayload_OtpParameters) Descriptor() ([]byte, []int)
Deprecated: Use MigrationPayload_OtpParameters.ProtoReflect.Descriptor instead.
func (*MigrationPayload_OtpParameters) GetAlgorithm ¶
func (x *MigrationPayload_OtpParameters) GetAlgorithm() MigrationPayload_Algorithm
func (*MigrationPayload_OtpParameters) GetCounter ¶
func (x *MigrationPayload_OtpParameters) GetCounter() int64
func (*MigrationPayload_OtpParameters) GetDigits ¶
func (x *MigrationPayload_OtpParameters) GetDigits() MigrationPayload_DigitCount
func (*MigrationPayload_OtpParameters) GetIssuer ¶
func (x *MigrationPayload_OtpParameters) GetIssuer() string
func (*MigrationPayload_OtpParameters) GetName ¶
func (x *MigrationPayload_OtpParameters) GetName() string
func (*MigrationPayload_OtpParameters) GetSecret ¶
func (x *MigrationPayload_OtpParameters) GetSecret() []byte
func (*MigrationPayload_OtpParameters) GetType ¶
func (x *MigrationPayload_OtpParameters) GetType() MigrationPayload_OtpType
func (*MigrationPayload_OtpParameters) ProtoMessage ¶
func (*MigrationPayload_OtpParameters) ProtoMessage()
func (*MigrationPayload_OtpParameters) ProtoReflect ¶
func (x *MigrationPayload_OtpParameters) ProtoReflect() protoreflect.Message
func (*MigrationPayload_OtpParameters) Reset ¶
func (x *MigrationPayload_OtpParameters) Reset()
func (*MigrationPayload_OtpParameters) String ¶
func (x *MigrationPayload_OtpParameters) String() string
type MigrationPayload_OtpType ¶
type MigrationPayload_OtpType int32
const ( MigrationPayload_OTP_TYPE_UNSPECIFIED MigrationPayload_OtpType = 0 MigrationPayload_OTP_TYPE_HOTP MigrationPayload_OtpType = 1 MigrationPayload_OTP_TYPE_TOTP MigrationPayload_OtpType = 2 )
func (MigrationPayload_OtpType) Descriptor ¶
func (MigrationPayload_OtpType) Descriptor() protoreflect.EnumDescriptor
func (MigrationPayload_OtpType) Enum ¶
func (x MigrationPayload_OtpType) Enum() *MigrationPayload_OtpType
func (MigrationPayload_OtpType) EnumDescriptor
deprecated
func (MigrationPayload_OtpType) EnumDescriptor() ([]byte, []int)
Deprecated: Use MigrationPayload_OtpType.Descriptor instead.
func (MigrationPayload_OtpType) Number ¶
func (x MigrationPayload_OtpType) Number() protoreflect.EnumNumber
func (MigrationPayload_OtpType) String ¶
func (x MigrationPayload_OtpType) String() string
func (MigrationPayload_OtpType) Type ¶
func (MigrationPayload_OtpType) Type() protoreflect.EnumType
type TOTPImpl ¶
type TOTPImpl struct {
// contains filtered or unexported fields
}
func (*TOTPImpl) GetAllCodes ¶
type TOTPSecretStorage ¶
type TOTPSecretStorage interface {
// StoreTOTPSecret stores the given MFA secret. If a secret with the same Secret field already exists, it is updated.
StoreTOTPSecret(secret TOTPStored) error
GetAllTOTPSecrets() ([]TOTPStored, error)
DeleteTOTPSecretBySecret(secretStr string) error
ClearStorage() error
}