proto

package
v0.0.0-...-80f7e85 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: MIT Imports: 4 Imported by: 0

README

gopasslib Proto Definitions

Files in this directory contain the proto definitions for gopasslib. These are used for serialization/deserialization for storage only.

Updating

Run tools/protogen.sh to regenerate the Go files. The generated files should be checked in to the repo for easier audit.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PasswordArgon2_Variant_name = map[int32]string{
		0: "VARIANT_UNDEFINED",
		1: "VARIANT_I",
		2: "VARIANT_ID",
	}
	PasswordArgon2_Variant_value = map[string]int32{
		"VARIANT_UNDEFINED": 0,
		"VARIANT_I":         1,
		"VARIANT_ID":        2,
	}
)

Enum value maps for PasswordArgon2_Variant.

View Source
var (
	PasswordBcrypt_Version_name = map[int32]string{
		0: "VERSION_UNDEFINED",
		1: "VERSION_2A",
	}
	PasswordBcrypt_Version_value = map[string]int32{
		"VERSION_UNDEFINED": 0,
		"VERSION_2A":        1,
	}
)

Enum value maps for PasswordBcrypt_Version.

View Source
var (
	PasswordPBKDF2_HashAlgorithm_name = map[int32]string{
		0: "PBKDF2_HASH_UNDEFINED",
		1: "PBKDF2_HASH_SHA1",
		2: "PBKDF2_HASH_SHA256",
		3: "PBKDF2_HASH_SHA384",
		4: "PBKDF2_HASH_SHA512",
		5: "PBKDF2_HASH_SHA3",
		6: "PBKDF2_HASH_MD5",
	}
	PasswordPBKDF2_HashAlgorithm_value = map[string]int32{
		"PBKDF2_HASH_UNDEFINED": 0,
		"PBKDF2_HASH_SHA1":      1,
		"PBKDF2_HASH_SHA256":    2,
		"PBKDF2_HASH_SHA384":    3,
		"PBKDF2_HASH_SHA512":    4,
		"PBKDF2_HASH_SHA3":      5,
		"PBKDF2_HASH_MD5":       6,
	}
)

Enum value maps for PasswordPBKDF2_HashAlgorithm.

View Source
var (
	TOTP_HashAlgorithm_name = map[int32]string{
		0: "HASH_ALGORITHM_UNDEFINED",
		1: "HASH_ALGORITHM_SHA_1",
		2: "HASH_ALGORITHM_SHA_256",
		3: "HASH_ALGORITHM_SHA_512",
	}
	TOTP_HashAlgorithm_value = map[string]int32{
		"HASH_ALGORITHM_UNDEFINED": 0,
		"HASH_ALGORITHM_SHA_1":     1,
		"HASH_ALGORITHM_SHA_256":   2,
		"HASH_ALGORITHM_SHA_512":   3,
	}
)

Enum value maps for TOTP_HashAlgorithm.

View Source
var File_proto_gopasslib_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type PasswordArgon2

type PasswordArgon2 struct {

	// The hashed Argon2 password.
	Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	// Variant is the Argon2 variant. Go's argon2 library provides i and id, so
	// we support both.
	Variant PasswordArgon2_Variant `` /* 137-byte string literal not displayed */
	// Version is the version of the Argon 2 algorithm. This should usually be
	// version 0x13.
	Version uint32 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"`
	// Salt is a randomly generated salt used in the hashing rounds.
	Salt []byte `protobuf:"bytes,4,opt,name=salt,proto3" json:"salt,omitempty"`
	// Time is the number of passes over the memory.
	Time uint32 `protobuf:"varint,5,opt,name=time,proto3" json:"time,omitempty"`
	// The amount of memory to use for hashing in KiB.
	MemoryKib uint32 `protobuf:"varint,6,opt,name=memory_kib,json=memoryKib,proto3" json:"memory_kib,omitempty"`
	// The number of CPU threads to use.
	Threads uint32 `protobuf:"varint,7,opt,name=threads,proto3" json:"threads,omitempty"`
	// contains filtered or unexported fields
}

PasswordArgon2 serializes a hashed Argon 2 password into a protobuf format.

func (*PasswordArgon2) Descriptor deprecated

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

Deprecated: Use PasswordArgon2.ProtoReflect.Descriptor instead.

func (*PasswordArgon2) GetHash

func (x *PasswordArgon2) GetHash() []byte

func (*PasswordArgon2) GetMemoryKib

func (x *PasswordArgon2) GetMemoryKib() uint32

func (*PasswordArgon2) GetSalt

func (x *PasswordArgon2) GetSalt() []byte

func (*PasswordArgon2) GetThreads

func (x *PasswordArgon2) GetThreads() uint32

func (*PasswordArgon2) GetTime

func (x *PasswordArgon2) GetTime() uint32

func (*PasswordArgon2) GetVariant

func (x *PasswordArgon2) GetVariant() PasswordArgon2_Variant

func (*PasswordArgon2) GetVersion

func (x *PasswordArgon2) GetVersion() uint32

func (*PasswordArgon2) ProtoMessage

func (*PasswordArgon2) ProtoMessage()

func (*PasswordArgon2) ProtoReflect

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

func (*PasswordArgon2) Reset

func (x *PasswordArgon2) Reset()

func (*PasswordArgon2) String

func (x *PasswordArgon2) String() string

type PasswordArgon2_Variant

type PasswordArgon2_Variant int32

Argon2 variants. Go currently supports argon2i and argon2id, so both are provided.

const (
	PasswordArgon2_VARIANT_UNDEFINED PasswordArgon2_Variant = 0
	PasswordArgon2_VARIANT_I         PasswordArgon2_Variant = 1
	PasswordArgon2_VARIANT_ID        PasswordArgon2_Variant = 2
)

func (PasswordArgon2_Variant) Descriptor

func (PasswordArgon2_Variant) Enum

func (PasswordArgon2_Variant) EnumDescriptor deprecated

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

Deprecated: Use PasswordArgon2_Variant.Descriptor instead.

func (PasswordArgon2_Variant) Number

func (PasswordArgon2_Variant) String

func (x PasswordArgon2_Variant) String() string

func (PasswordArgon2_Variant) Type

type PasswordBcrypt

type PasswordBcrypt struct {

	// The version of the bcrypt algorithm used.
	Version PasswordBcrypt_Version `` /* 137-byte string literal not displayed */
	// The hashed password.
	Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
	// The salt used in hashing.
	Salt []byte `protobuf:"bytes,3,opt,name=salt,proto3" json:"salt,omitempty"`
	// The bcrypt cost parameter.
	Cost uint32 `protobuf:"varint,4,opt,name=cost,proto3" json:"cost,omitempty"`
	// contains filtered or unexported fields
}

PasswordBcrypt provides protobuf encoding of bcrypted hashes.

func (*PasswordBcrypt) Descriptor deprecated

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

Deprecated: Use PasswordBcrypt.ProtoReflect.Descriptor instead.

func (*PasswordBcrypt) GetCost

func (x *PasswordBcrypt) GetCost() uint32

func (*PasswordBcrypt) GetHash

func (x *PasswordBcrypt) GetHash() []byte

func (*PasswordBcrypt) GetSalt

func (x *PasswordBcrypt) GetSalt() []byte

func (*PasswordBcrypt) GetVersion

func (x *PasswordBcrypt) GetVersion() PasswordBcrypt_Version

func (*PasswordBcrypt) ProtoMessage

func (*PasswordBcrypt) ProtoMessage()

func (*PasswordBcrypt) ProtoReflect

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

func (*PasswordBcrypt) Reset

func (x *PasswordBcrypt) Reset()

func (*PasswordBcrypt) String

func (x *PasswordBcrypt) String() string

type PasswordBcrypt_Version

type PasswordBcrypt_Version int32

Go only provides support for generating bcrypt 2a hashes.

const (
	PasswordBcrypt_VERSION_UNDEFINED PasswordBcrypt_Version = 0
	PasswordBcrypt_VERSION_2A        PasswordBcrypt_Version = 1
)

func (PasswordBcrypt_Version) Descriptor

func (PasswordBcrypt_Version) Enum

func (PasswordBcrypt_Version) EnumDescriptor deprecated

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

Deprecated: Use PasswordBcrypt_Version.Descriptor instead.

func (PasswordBcrypt_Version) Number

func (PasswordBcrypt_Version) String

func (x PasswordBcrypt_Version) String() string

func (PasswordBcrypt_Version) Type

type PasswordContainer

type PasswordContainer struct {

	// Types that are assignable to HashedPassword:
	//
	//	*PasswordContainer_Argon2
	//	*PasswordContainer_Bcrypt
	//	*PasswordContainer_Scrypt
	//	*PasswordContainer_Pbkdf2
	HashedPassword isPasswordContainer_HashedPassword `protobuf_oneof:"hashed_password"`
	// contains filtered or unexported fields
}

PasswordContainer stores hashed passwords. All serialization/deserialization of passwords should use this rather than algorithm-specific messages. Doing as such helps for easier fallback to old algorithms when the default algorithm is changed.

func (*PasswordContainer) Descriptor deprecated

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

Deprecated: Use PasswordContainer.ProtoReflect.Descriptor instead.

func (*PasswordContainer) GetArgon2

func (x *PasswordContainer) GetArgon2() *PasswordArgon2

func (*PasswordContainer) GetBcrypt

func (x *PasswordContainer) GetBcrypt() *PasswordBcrypt

func (*PasswordContainer) GetHashedPassword

func (m *PasswordContainer) GetHashedPassword() isPasswordContainer_HashedPassword

func (*PasswordContainer) GetPbkdf2

func (x *PasswordContainer) GetPbkdf2() *PasswordPBKDF2

func (*PasswordContainer) GetScrypt

func (x *PasswordContainer) GetScrypt() *PasswordScrypt

func (*PasswordContainer) ProtoMessage

func (*PasswordContainer) ProtoMessage()

func (*PasswordContainer) ProtoReflect

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

func (*PasswordContainer) Reset

func (x *PasswordContainer) Reset()

func (*PasswordContainer) String

func (x *PasswordContainer) String() string

type PasswordContainer_Argon2

type PasswordContainer_Argon2 struct {
	Argon2 *PasswordArgon2 `protobuf:"bytes,1,opt,name=argon2,proto3,oneof"`
}

type PasswordContainer_Bcrypt

type PasswordContainer_Bcrypt struct {
	Bcrypt *PasswordBcrypt `protobuf:"bytes,2,opt,name=bcrypt,proto3,oneof"`
}

type PasswordContainer_Pbkdf2

type PasswordContainer_Pbkdf2 struct {
	Pbkdf2 *PasswordPBKDF2 `protobuf:"bytes,4,opt,name=pbkdf2,proto3,oneof"`
}

type PasswordContainer_Scrypt

type PasswordContainer_Scrypt struct {
	Scrypt *PasswordScrypt `protobuf:"bytes,3,opt,name=scrypt,proto3,oneof"`
}

type PasswordPBKDF2

type PasswordPBKDF2 struct {

	// The hash algorithm used in the PBKDF2 operation.
	HashAlgorithm PasswordPBKDF2_HashAlgorithm `` /* 176-byte string literal not displayed */
	// The hashed password.
	Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
	// The salt used in hashing.
	Salt []byte `protobuf:"bytes,3,opt,name=salt,proto3" json:"salt,omitempty"`
	// Number of iterations performed on each block.
	Iterations uint64 `protobuf:"varint,4,opt,name=iterations,proto3" json:"iterations,omitempty"`
	// contains filtered or unexported fields
}

PasswordPBKDF2 provides protobuf serialization for PBKDF2-hashed passwords.

func (*PasswordPBKDF2) Descriptor deprecated

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

Deprecated: Use PasswordPBKDF2.ProtoReflect.Descriptor instead.

func (*PasswordPBKDF2) GetHash

func (x *PasswordPBKDF2) GetHash() []byte

func (*PasswordPBKDF2) GetHashAlgorithm

func (x *PasswordPBKDF2) GetHashAlgorithm() PasswordPBKDF2_HashAlgorithm

func (*PasswordPBKDF2) GetIterations

func (x *PasswordPBKDF2) GetIterations() uint64

func (*PasswordPBKDF2) GetSalt

func (x *PasswordPBKDF2) GetSalt() []byte

func (*PasswordPBKDF2) ProtoMessage

func (*PasswordPBKDF2) ProtoMessage()

func (*PasswordPBKDF2) ProtoReflect

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

func (*PasswordPBKDF2) Reset

func (x *PasswordPBKDF2) Reset()

func (*PasswordPBKDF2) String

func (x *PasswordPBKDF2) String() string

type PasswordPBKDF2_HashAlgorithm

type PasswordPBKDF2_HashAlgorithm int32

Accepted hash algorithms. PBKDF2 is quite flexible and can support many more than this, but we'll stick to what Go's standard and crypto libraries provide.

const (
	PasswordPBKDF2_PBKDF2_HASH_UNDEFINED PasswordPBKDF2_HashAlgorithm = 0
	PasswordPBKDF2_PBKDF2_HASH_SHA1      PasswordPBKDF2_HashAlgorithm = 1
	PasswordPBKDF2_PBKDF2_HASH_SHA256    PasswordPBKDF2_HashAlgorithm = 2
	PasswordPBKDF2_PBKDF2_HASH_SHA384    PasswordPBKDF2_HashAlgorithm = 3
	PasswordPBKDF2_PBKDF2_HASH_SHA512    PasswordPBKDF2_HashAlgorithm = 4
	PasswordPBKDF2_PBKDF2_HASH_SHA3      PasswordPBKDF2_HashAlgorithm = 5
	PasswordPBKDF2_PBKDF2_HASH_MD5       PasswordPBKDF2_HashAlgorithm = 6
)

func (PasswordPBKDF2_HashAlgorithm) Descriptor

func (PasswordPBKDF2_HashAlgorithm) Enum

func (PasswordPBKDF2_HashAlgorithm) EnumDescriptor deprecated

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

Deprecated: Use PasswordPBKDF2_HashAlgorithm.Descriptor instead.

func (PasswordPBKDF2_HashAlgorithm) Number

func (PasswordPBKDF2_HashAlgorithm) String

func (PasswordPBKDF2_HashAlgorithm) Type

type PasswordScrypt

type PasswordScrypt struct {

	// Hash is the checksum generated from the scrypt algorithm.
	Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	// The salt used in the hashing operation.
	Salt []byte `protobuf:"bytes,2,opt,name=salt,proto3" json:"salt,omitempty"`
	// The CPU/memory cost parameter, often called N.
	Cost uint64 `protobuf:"varint,3,opt,name=cost,proto3" json:"cost,omitempty"`
	// The block size used. Also called r.
	BlockSize uint64 `protobuf:"varint,4,opt,name=block_size,json=blockSize,proto3" json:"block_size,omitempty"`
	// The parallel count parameter for scrypt. Also called p.
	ParallelCount uint64 `protobuf:"varint,5,opt,name=parallel_count,json=parallelCount,proto3" json:"parallel_count,omitempty"`
	// contains filtered or unexported fields
}

PasswordScrypt provides protobuf serialization for scrypt hashed passwords.

func (*PasswordScrypt) Descriptor deprecated

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

Deprecated: Use PasswordScrypt.ProtoReflect.Descriptor instead.

func (*PasswordScrypt) GetBlockSize

func (x *PasswordScrypt) GetBlockSize() uint64

func (*PasswordScrypt) GetCost

func (x *PasswordScrypt) GetCost() uint64

func (*PasswordScrypt) GetHash

func (x *PasswordScrypt) GetHash() []byte

func (*PasswordScrypt) GetParallelCount

func (x *PasswordScrypt) GetParallelCount() uint64

func (*PasswordScrypt) GetSalt

func (x *PasswordScrypt) GetSalt() []byte

func (*PasswordScrypt) ProtoMessage

func (*PasswordScrypt) ProtoMessage()

func (*PasswordScrypt) ProtoReflect

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

func (*PasswordScrypt) Reset

func (x *PasswordScrypt) Reset()

func (*PasswordScrypt) String

func (x *PasswordScrypt) String() string

type TOTP

type TOTP struct {

	// The secret used in the HMAC operation.
	Secret []byte `protobuf:"bytes,1,opt,name=secret,proto3" json:"secret,omitempty"`
	// The hash algorithm used in the HMAC operation.
	HashAlgorithm TOTP_HashAlgorithm `` /* 166-byte string literal not displayed */
	// The issuer of the TOTP secret.
	Issuer string `protobuf:"bytes,3,opt,name=issuer,proto3" json:"issuer,omitempty"`
	// The account tied to the TOTP secret. We store it here so this library
	// can also be used in client apps, which often accept the account.
	AccountName string `protobuf:"bytes,4,opt,name=account_name,json=accountName,proto3" json:"account_name,omitempty"`
	// The number of digits to generate. This should be between 6 and 9
	// inclusive.
	Digits uint32 `protobuf:"varint,5,opt,name=digits,proto3" json:"digits,omitempty"`
	// The number of seconds for each period. The recommendation is 30.
	PeriodSeconds uint32 `protobuf:"varint,6,opt,name=period_seconds,json=periodSeconds,proto3" json:"period_seconds,omitempty"`
	// The number of periods to look back through during verification. Must be a
	// minimum of 1 to account for network delay. The recommendation is 1.
	LookbackPeriods uint32 `protobuf:"varint,7,opt,name=lookback_periods,json=lookbackPeriods,proto3" json:"lookback_periods,omitempty"`
	// contains filtered or unexported fields
}

Stores a TOTP secret and other metadata for generation and verification of TOTP tokens.

func (*TOTP) Descriptor deprecated

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

Deprecated: Use TOTP.ProtoReflect.Descriptor instead.

func (*TOTP) GetAccountName

func (x *TOTP) GetAccountName() string

func (*TOTP) GetDigits

func (x *TOTP) GetDigits() uint32

func (*TOTP) GetHashAlgorithm

func (x *TOTP) GetHashAlgorithm() TOTP_HashAlgorithm

func (*TOTP) GetIssuer

func (x *TOTP) GetIssuer() string

func (*TOTP) GetLookbackPeriods

func (x *TOTP) GetLookbackPeriods() uint32

func (*TOTP) GetPeriodSeconds

func (x *TOTP) GetPeriodSeconds() uint32

func (*TOTP) GetSecret

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

func (*TOTP) ProtoMessage

func (*TOTP) ProtoMessage()

func (*TOTP) ProtoReflect

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

func (*TOTP) Reset

func (x *TOTP) Reset()

func (*TOTP) String

func (x *TOTP) String() string

type TOTP_HashAlgorithm

type TOTP_HashAlgorithm int32

The HTOP specification defines the use of SHA-1, while TOTP extends to SHA-256 and SHA-512.

const (
	TOTP_HASH_ALGORITHM_UNDEFINED TOTP_HashAlgorithm = 0
	TOTP_HASH_ALGORITHM_SHA_1     TOTP_HashAlgorithm = 1
	TOTP_HASH_ALGORITHM_SHA_256   TOTP_HashAlgorithm = 2
	TOTP_HASH_ALGORITHM_SHA_512   TOTP_HashAlgorithm = 3
)

func (TOTP_HashAlgorithm) Descriptor

func (TOTP_HashAlgorithm) Enum

func (TOTP_HashAlgorithm) EnumDescriptor deprecated

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

Deprecated: Use TOTP_HashAlgorithm.Descriptor instead.

func (TOTP_HashAlgorithm) Number

func (TOTP_HashAlgorithm) String

func (x TOTP_HashAlgorithm) String() string

func (TOTP_HashAlgorithm) Type

Jump to

Keyboard shortcuts

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