key

package
v2.8.9 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type AccessControl added in v2.8.0

type AccessControl struct {
	AccessControlTotp   *AccessControlTotp
	AccessControlSecret *AccessControlSecret
}

AccessControl represents access control information, including Time-based One-Time Password (TOTP) and secret-based access.

func (AccessControl) ToProto added in v2.8.0

func (a AccessControl) ToProto() *proto.AccessControl

type AccessControlSecret added in v2.8.0

type AccessControlSecret struct {
	Secret string
}

AccessControlSecret represents a secret used for secret-based access control.

func NewAccessControlSecret added in v2.8.0

func NewAccessControlSecret(secret string) *AccessControlSecret

NewAccessControlSecret creates a new AccessControlSecret instance with the provided secret.

func (AccessControlSecret) ToProto added in v2.8.0

type AccessControlTotp added in v2.8.0

type AccessControlTotp struct {
	Code string
}

AccessControlTotp represents a Time-based One-Time Password (TOTP) code used for access control.

func NewAccessControlTotp added in v2.8.0

func NewAccessControlTotp(code string) *AccessControlTotp

NewAccessControlTotp creates a new AccessControlTotp instance with the provided TOTP code.

func (AccessControlTotp) ToProto added in v2.8.0

type AccessControlType added in v2.8.5

type AccessControlType int32

AccessControlType represents the access control type of a key.

const (
	// ACCESS_CONTROL_NONE indicates that the key is not protected by access control.
	ACCESS_CONTROL_NONE AccessControlType = iota
	// ACCESS_CONTROL_TOTP indicates that the key is protected by a TOTP-based access control.
	ACCESS_CONTROL_TOTP AccessControlType = iota
	// ACCESS_CONTROL_SECRET indicates that the key is protected by a SECRET-based access control.
	ACCESS_CONTROL_SECRET AccessControlType = iota
)

type CertificateType added in v2.7.0

type CertificateType int32

CertificateType represents the type of certificate.

const (
	// PEM is a certificate type.
	PEM CertificateType = iota
	// PFX is a certificate type.
	PFX CertificateType = iota
)

type ImportCertificateParams added in v2.7.0

type ImportCertificateParams struct {
	Password string
}

ImportCertificateParams represents parameters for importing a certificate.

func NewImportCertificateParams added in v2.7.0

func NewImportCertificateParams() ImportCertificateParams

NewImportCertificateParams creates an ImportCertificateParams instance with default values.

type Key added in v2.8.0

type Key struct {
	LocalKey   *LocalKey
	ManagedKey *ManagedKey
}

Key represents a key entity that can be either a ManagedKey or a LocalKey.

func (Key) ToProto added in v2.8.0

func (s Key) ToProto() *proto.Key

type KeyPair

type KeyPair struct {
	PublicKey  string
	PrivateKey string
}

KeyPair represents a pair of public and private keys.

func NewEcdsaKeysFromProto

func NewEcdsaKeysFromProto(k *proto.GenerateLocalKeyResponse) KeyPair

func NewRsaKeyPairFromProto

func NewRsaKeyPairFromProto(k *proto.GenerateLocalKeyResponse) KeyPair

type KeyProtectionLevel

type KeyProtectionLevel int32

KeyProtectionLevel represents the protection level of a cryptographic key.

const (
	// KEY_PROTECTION_SOFTWARE indicates that the key is protected by software.
	KEY_PROTECTION_SOFTWARE KeyProtectionLevel = iota
	// KEY_PROTECTION_HSM indicates that the key is protected by a Hardware Security Module (HSM).
	KEY_PROTECTION_HSM KeyProtectionLevel = iota
)

type KeyType

type KeyType int32

KeyType represents the type of cryptographic key.

const (
	// EcP256k represents the elliptic curve key type P-256k.
	EcP256k KeyType = iota
	// Rsa2048 represents the RSA key type with a 2048-bit modulus.
	Rsa2048 KeyType = iota
	// Rsa3072 represents the RSA key type with a 3072-bit modulus.
	Rsa3072 KeyType = iota
	// Rsa4096 represents the RSA key type with a 4096-bit modulus.
	Rsa4096 KeyType = iota
	// Aes128 represents the AES key type with a 128-bit key length.
	Aes128 KeyType = iota
	// Aes256 represents the AES key type with a 256-bit key length.
	Aes256 KeyType = iota
	// Bjj represents the Baby JubJub key type, elliptic curve defined over the large prime subgroup of BN128.
	Bjj KeyType = iota
)

type LocalCertificate added in v2.7.0

type LocalCertificate struct {
	Pkcs12   []byte
	Password string
}

LocalCertificate represents a local certificate along with its password.

func NewLocalCertificateFromProto added in v2.7.0

func NewLocalCertificateFromProto(s *proto.LocalCertificate) LocalCertificate

func (LocalCertificate) ToProto added in v2.7.0

type LocalCertificateParams added in v2.7.0

type LocalCertificateParams struct {
	KeyType          KeyType
	Password         string
	Subject          SubjectCertificateParams
	ExpirationMonths int32
}

LocalCertificateParams represents the parameters for generating a local certificate.

func NewLocalCertificateParamsFromProto added in v2.7.0

func NewLocalCertificateParamsFromProto(s *proto.LocalCertificateParams) LocalCertificateParams

func (LocalCertificateParams) ToProto added in v2.7.0

type LocalKey

type LocalKey struct {
	// Key is the public key.
	Key string
	// PrivateKey is the private key.
	PrivateKey string
	// KeyType is the type of the key.
	KeyType KeyType
}

LocalKey represents a local key with its public and private components.

func NewLocalKeyFromProto

func NewLocalKeyFromProto(s *proto.LocalKey) LocalKey

func (LocalKey) ToProto

func (s LocalKey) ToProto() *proto.LocalKey

type Managed added in v2.8.0

type Managed struct {
	ManagedKey         *ManagedKey
	ManagedCertificate *ManagedCertificate
}

Managed represents a managed entity that can be either a ManagedKey or a ManagedCertificate.

type ManagedCertificate added in v2.7.0

type ManagedCertificate struct {
	// ID is the identifier of the managed certificate (ex: 2abae00b-f3d9-410c-abdf-1ea391d633aa).
	ID string
	// Protection is the protection level for the key.
	Protection KeyProtectionLevel
	// KeyType is the type of the key.
	KeyType KeyType
	// Expiration is the timestamp indicating when the certificate expires.
	Expiration int64
	// Key is the certificate public key.
	Key string
	// AccessControlType is the access control type for the key.
	AccessControlType AccessControlType
}

ManagedCertificate represents a managed certificate with its details.

func NewManagedCertificateFromProto added in v2.7.0

func NewManagedCertificateFromProto(s *proto.ManagedCertificate) ManagedCertificate

func (ManagedCertificate) ToProto added in v2.7.0

type ManagedCertificateParams added in v2.7.0

type ManagedCertificateParams struct {
	// KeyType is the type of the key.
	KeyType KeyType
	// Subject represents the subject details of the certificate.
	Subject SubjectCertificateParams
	// ExpirationMonths is the number of months until the certificate expiration.
	ExpirationMonths int32
}

ManagedCertificateParams represents parameters for creating a managed certificate.

func NewManagedCertificateParamsFromProto added in v2.7.0

func NewManagedCertificateParamsFromProto(s *proto.ManagedCertificateParams) ManagedCertificateParams

func (ManagedCertificateParams) ToProto added in v2.7.0

type ManagedKey

type ManagedKey struct {
	// ID is the unique identifier of the managed key (ex: 46c49ee7-ef44-472c-a873-ce81a2d5d764).
	ID string
	// Name is the name of the managed key.
	Name string
	// Protection is the protection level for the key.
	Protection KeyProtectionLevel
	// KeyType is the type of the key.
	KeyType KeyType
	// Expiration is the timestamp indicating when the key expires.
	Expiration int64
	// Key is the actual public key.
	Key string
	// AccessControlType is the access control type for the key.
	AccessControlType AccessControlType
}

ManagedKey represents a managed key.

func NewManagedKeyFromProto

func NewManagedKeyFromProto(s *proto.ManagedKey) ManagedKey

func (ManagedKey) ToProto

func (s ManagedKey) ToProto() *proto.ManagedKey

func (ManagedKey) Type added in v2.8.0

func (s ManagedKey) Type() KeyType

type ManagedKeyParams

type ManagedKeyParams struct {
	// Name is the name of the managed key.
	Name string
	// Protection is the protection level for the key.
	Protection KeyProtectionLevel
	// KeyType is the type of the key.
	KeyType KeyType
	// Expiration is the timestamp indicating when the key expires.
	Expiration int64
}

ManagedKeyParams represents the parameters for creating a managed key.

func NewManagedKeyParamsFromProto

func NewManagedKeyParamsFromProto(s *proto.ManagedKeyParams) ManagedKeyParams

func (ManagedKeyParams) ToProto

type SubjectCertificateParams added in v2.7.0

type SubjectCertificateParams struct {
	// CommonName is the common name (CN) for the certificate. Required.
	CommonName string
	// Organization is the organization (O) for the certificate. (Optional)
	Organization *string
	// OrganizationUnit is the organizational unit (OU) for the certificate. (Optional)
	OrganizationUnit *string
	// Location is the location (L) for the certificate. (Optional)
	Location *string
	// State is the state or province (ST) for the certificate. (Optional)
	State *string
	// Country is the country (C) for the certificate. (Optional)
	Country *string
}

SubjectCertificateParams represents parameters for generating a subject certificate.

type TotpAccessControlReceipt added in v2.8.0

type TotpAccessControlReceipt struct {
	Secret        string
	SecretQr      string
	RecoveryCodes []string
}

TotpAccessControlReceipt represents a receipt for a Time-based One-Time Password (TOTP) access control.

func New added in v2.8.0

func New(secret, secretQr string, recoveryCodes []string) TotpAccessControlReceipt

New creates a new TotpAccessControlReceipt with the provided secret, secret QR code, and recovery codes.

Jump to

Keyboard shortcuts

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