migration

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2023 License: ISC Imports: 25 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Payload_OtpParameters_Algorithm_name = map[int32]string{
		0: "ALGORITHM_UNSPECIFIED",
		1: "ALGORITHM_SHA1",
		2: "ALGORITHM_SHA256",
		3: "ALGORITHM_SHA512",
		4: "ALGORITHM_MD5",
	}
	Payload_OtpParameters_Algorithm_value = map[string]int32{
		"ALGORITHM_UNSPECIFIED": 0,
		"ALGORITHM_SHA1":        1,
		"ALGORITHM_SHA256":      2,
		"ALGORITHM_SHA512":      3,
		"ALGORITHM_MD5":         4,
	}
)

Enum value maps for Payload_OtpParameters_Algorithm.

View Source
var (
	Payload_OtpParameters_DigitCount_name = map[int32]string{
		0: "DIGIT_COUNT_UNSPECIFIED",
		1: "DIGIT_COUNT_SIX",
		2: "DIGIT_COUNT_EIGHT",
	}
	Payload_OtpParameters_DigitCount_value = map[string]int32{
		"DIGIT_COUNT_UNSPECIFIED": 0,
		"DIGIT_COUNT_SIX":         1,
		"DIGIT_COUNT_EIGHT":       2,
	}
)

Enum value maps for Payload_OtpParameters_DigitCount.

View Source
var (
	Payload_OtpParameters_OtpType_name = map[int32]string{
		0: "OTP_TYPE_UNSPECIFIED",
		1: "OTP_TYPE_HOTP",
		2: "OTP_TYPE_TOTP",
	}
	Payload_OtpParameters_OtpType_value = map[string]int32{
		"OTP_TYPE_UNSPECIFIED": 0,
		"OTP_TYPE_HOTP":        1,
		"OTP_TYPE_TOTP":        2,
	}
)

Enum value maps for Payload_OtpParameters_OtpType.

View Source
var ErrUnknown = errors.New("unknown")

ErrUnknown scheme or host

View Source
var File_migration_proto protoreflect.FileDescriptor

Functions

func Data

func Data(link string) ([]byte, error)

Data extracts data part from URL string

func PNG added in v0.4.3

func PNG(filename string, u *url.URL) error

PNG writes QR code as PNG to specified file

func QR added in v0.4.3

func QR(u *url.URL) ([]byte, error)

QR image bytes as PNG

func URL added in v0.4.3

func URL(data []byte) *url.URL

URL constructs migration URL

Types

type Payload

type Payload struct {
	OtpParameters []*Payload_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 Unmarshal

func Unmarshal(data []byte) (*Payload, error)

Unmarshal otpauth-migration data

func UnmarshalURL

func UnmarshalURL(link string) (*Payload, error)

UnmarshalURL decodes otpauth-migration from URL

func (*Payload) Descriptor deprecated

func (*Payload) Descriptor() ([]byte, []int)

Deprecated: Use Payload.ProtoReflect.Descriptor instead.

func (*Payload) GetBatchId

func (x *Payload) GetBatchId() int32

func (*Payload) GetBatchIndex

func (x *Payload) GetBatchIndex() int32

func (*Payload) GetBatchSize

func (x *Payload) GetBatchSize() int32

func (*Payload) GetOtpParameters

func (x *Payload) GetOtpParameters() []*Payload_OtpParameters

func (*Payload) GetVersion

func (x *Payload) GetVersion() int32

func (*Payload) ProtoMessage

func (*Payload) ProtoMessage()

func (*Payload) ProtoReflect

func (x *Payload) ProtoReflect() protoreflect.Message

func (*Payload) Reset

func (x *Payload) Reset()

func (*Payload) String

func (x *Payload) String() string

type Payload_OtpParameters

type Payload_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 Payload_OtpParameters_Algorithm  `protobuf:"varint,4,opt,name=algorithm,proto3,enum=migration.Payload_OtpParameters_Algorithm" json:"algorithm,omitempty"`
	Digits    Payload_OtpParameters_DigitCount `protobuf:"varint,5,opt,name=digits,proto3,enum=migration.Payload_OtpParameters_DigitCount" json:"digits,omitempty"`
	Type      Payload_OtpParameters_OtpType    `protobuf:"varint,6,opt,name=type,proto3,enum=migration.Payload_OtpParameters_OtpType" json:"type,omitempty"`
	Counter   uint64                           `protobuf:"varint,7,opt,name=counter,proto3" json:"counter,omitempty"`
	// contains filtered or unexported fields
}

func (*Payload_OtpParameters) Descriptor deprecated

func (*Payload_OtpParameters) Descriptor() ([]byte, []int)

Deprecated: Use Payload_OtpParameters.ProtoReflect.Descriptor instead.

func (*Payload_OtpParameters) Evaluate

func (op *Payload_OtpParameters) Evaluate() int

Evaluate OTP parameters

func (*Payload_OtpParameters) EvaluateString

func (op *Payload_OtpParameters) EvaluateString() string

EvaluateString returns OTP as formatted string

func (*Payload_OtpParameters) FileName

func (op *Payload_OtpParameters) FileName() string

FileName returns sanitized filename without path delimiters

func (*Payload_OtpParameters) GetAlgorithm

func (*Payload_OtpParameters) GetCounter

func (x *Payload_OtpParameters) GetCounter() uint64

func (*Payload_OtpParameters) GetDigits

func (*Payload_OtpParameters) GetIssuer

func (x *Payload_OtpParameters) GetIssuer() string

func (*Payload_OtpParameters) GetName

func (x *Payload_OtpParameters) GetName() string

func (*Payload_OtpParameters) GetSecret

func (x *Payload_OtpParameters) GetSecret() []byte

func (*Payload_OtpParameters) GetType

func (*Payload_OtpParameters) ProtoMessage

func (*Payload_OtpParameters) ProtoMessage()

func (*Payload_OtpParameters) ProtoReflect

func (x *Payload_OtpParameters) ProtoReflect() protoreflect.Message

func (*Payload_OtpParameters) Reset

func (x *Payload_OtpParameters) Reset()

func (*Payload_OtpParameters) Seconds added in v0.4.1

func (op *Payload_OtpParameters) Seconds() float64

Seconds of current validity frame

func (*Payload_OtpParameters) SecretString added in v0.3.1

func (op *Payload_OtpParameters) SecretString() string

SecretString returns Secret as a base32 encoded String

func (*Payload_OtpParameters) SecretTuples added in v0.3.1

func (op *Payload_OtpParameters) SecretTuples() []string

SecretTuples returns Secret as a base32 string splitted into tuples of 4

func (*Payload_OtpParameters) ServeHTTP

func (op *Payload_OtpParameters) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Payload_OtpParameters) String

func (x *Payload_OtpParameters) String() string

func (*Payload_OtpParameters) URL

func (op *Payload_OtpParameters) URL() *url.URL

URL of otp parameters

func (*Payload_OtpParameters) UUID

func (op *Payload_OtpParameters) UUID() uuid.UUID

UUID of OTP parameter

type Payload_OtpParameters_Algorithm added in v0.5.1

type Payload_OtpParameters_Algorithm int32
const (
	Payload_OtpParameters_ALGORITHM_UNSPECIFIED Payload_OtpParameters_Algorithm = 0
	Payload_OtpParameters_ALGORITHM_SHA1        Payload_OtpParameters_Algorithm = 1
	Payload_OtpParameters_ALGORITHM_SHA256      Payload_OtpParameters_Algorithm = 2
	Payload_OtpParameters_ALGORITHM_SHA512      Payload_OtpParameters_Algorithm = 3
	Payload_OtpParameters_ALGORITHM_MD5         Payload_OtpParameters_Algorithm = 4
)

func (Payload_OtpParameters_Algorithm) Descriptor added in v0.5.1

func (Payload_OtpParameters_Algorithm) Enum added in v0.5.1

func (Payload_OtpParameters_Algorithm) EnumDescriptor deprecated added in v0.5.1

func (Payload_OtpParameters_Algorithm) EnumDescriptor() ([]byte, []int)

Deprecated: Use Payload_OtpParameters_Algorithm.Descriptor instead.

func (Payload_OtpParameters_Algorithm) Hash added in v0.5.1

func (x Payload_OtpParameters_Algorithm) Hash() func() hash.Hash

func (Payload_OtpParameters_Algorithm) Name added in v0.5.1

func (Payload_OtpParameters_Algorithm) Number added in v0.5.1

func (Payload_OtpParameters_Algorithm) String added in v0.5.1

func (Payload_OtpParameters_Algorithm) Type added in v0.5.1

type Payload_OtpParameters_DigitCount added in v0.5.1

type Payload_OtpParameters_DigitCount int32
const (
	Payload_OtpParameters_DIGIT_COUNT_UNSPECIFIED Payload_OtpParameters_DigitCount = 0
	Payload_OtpParameters_DIGIT_COUNT_SIX         Payload_OtpParameters_DigitCount = 1
	Payload_OtpParameters_DIGIT_COUNT_EIGHT       Payload_OtpParameters_DigitCount = 2
)

func (Payload_OtpParameters_DigitCount) Count added in v0.5.1

func (Payload_OtpParameters_DigitCount) Descriptor added in v0.5.1

func (Payload_OtpParameters_DigitCount) Enum added in v0.5.1

func (Payload_OtpParameters_DigitCount) EnumDescriptor deprecated added in v0.5.1

func (Payload_OtpParameters_DigitCount) EnumDescriptor() ([]byte, []int)

Deprecated: Use Payload_OtpParameters_DigitCount.Descriptor instead.

func (Payload_OtpParameters_DigitCount) Number added in v0.5.1

func (Payload_OtpParameters_DigitCount) String added in v0.5.1

func (Payload_OtpParameters_DigitCount) Type added in v0.5.1

type Payload_OtpParameters_OtpType added in v0.5.1

type Payload_OtpParameters_OtpType int32
const (
	Payload_OtpParameters_OTP_TYPE_UNSPECIFIED Payload_OtpParameters_OtpType = 0
	Payload_OtpParameters_OTP_TYPE_HOTP        Payload_OtpParameters_OtpType = 1
	Payload_OtpParameters_OTP_TYPE_TOTP        Payload_OtpParameters_OtpType = 2
)

func (Payload_OtpParameters_OtpType) Count added in v0.5.1

func (Payload_OtpParameters_OtpType) Descriptor added in v0.5.1

func (Payload_OtpParameters_OtpType) Enum added in v0.5.1

func (Payload_OtpParameters_OtpType) EnumDescriptor deprecated added in v0.5.1

func (Payload_OtpParameters_OtpType) EnumDescriptor() ([]byte, []int)

Deprecated: Use Payload_OtpParameters_OtpType.Descriptor instead.

func (Payload_OtpParameters_OtpType) Name added in v0.5.1

func (Payload_OtpParameters_OtpType) Number added in v0.5.1

func (Payload_OtpParameters_OtpType) String added in v0.5.1

func (Payload_OtpParameters_OtpType) Type added in v0.5.1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL