Documentation ¶
Index ¶
- Variables
- type AccessControl
- type AccessControlSecret
- type AccessControlTotp
- type AccessControlType
- type CertificateType
- type ImportCertificateParams
- type Key
- type KeyPair
- type KeyProtectionLevel
- type KeyType
- type LocalCertificate
- type LocalCertificateParams
- type LocalKey
- type Managed
- type ManagedCertificate
- type ManagedCertificateParams
- type ManagedKey
- type ManagedKeyParams
- type SubjectCertificateParams
- type TotpAccessControlReceipt
Constants ¶
This section is empty.
Variables ¶
var ( AccessControlTypeFromProto = map[proto.AccessControlType]AccessControlType{ proto.AccessControlType_NO_ACCESS_CONTROL: ACCESS_CONTROL_NONE, proto.AccessControlType_TOTP: ACCESS_CONTROL_TOTP, proto.AccessControlType_SECRET: ACCESS_CONTROL_SECRET, } AccessControlTypeToProto = map[AccessControlType]proto.AccessControlType{ ACCESS_CONTROL_NONE: proto.AccessControlType_NO_ACCESS_CONTROL, ACCESS_CONTROL_TOTP: proto.AccessControlType_TOTP, ACCESS_CONTROL_SECRET: proto.AccessControlType_SECRET, } )
var ( CertificateTypeFromProto = map[proto.CertificateType]CertificateType{ proto.CertificateType_PEM: PEM, proto.CertificateType_PFX: PFX, } CertificateTypeToProto = map[CertificateType]proto.CertificateType{ PEM: proto.CertificateType_PEM, PFX: proto.CertificateType_PFX, } )
var ( KeyProtectionLevelFromProto = map[proto.KeyProtectionLevel]KeyProtectionLevel{ proto.KeyProtectionLevel_SOFTWARE: KEY_PROTECTION_SOFTWARE, proto.KeyProtectionLevel_HSM: KEY_PROTECTION_HSM, } KeyProtectionLevelToProto = map[KeyProtectionLevel]proto.KeyProtectionLevel{ KEY_PROTECTION_SOFTWARE: proto.KeyProtectionLevel_SOFTWARE, KEY_PROTECTION_HSM: proto.KeyProtectionLevel_HSM, } )
var ( KeyTypeFromProto = map[proto.KeyType]KeyType{ proto.KeyType_EcP256k: EcP256k, proto.KeyType_Rsa2048: Rsa2048, proto.KeyType_Rsa3072: Rsa3072, proto.KeyType_Rsa4096: Rsa4096, proto.KeyType_Aes128: Aes128, proto.KeyType_Aes256: Aes256, proto.KeyType_Bjj: Bjj, } KeyTypeToProto = map[KeyType]proto.KeyType{ EcP256k: proto.KeyType_EcP256k, Rsa2048: proto.KeyType_Rsa2048, Rsa3072: proto.KeyType_Rsa3072, Rsa4096: proto.KeyType_Rsa4096, Aes128: proto.KeyType_Aes128, Aes256: proto.KeyType_Aes256, Bjj: proto.KeyType_Bjj, } )
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
func (a AccessControlSecret) ToProto() *proto.AccessControlSecret
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
func (a AccessControlTotp) ToProto() *proto.AccessControlTotp
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.
type KeyPair ¶
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
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
func (s LocalCertificate) ToProto() *proto.LocalCertificate
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
func (s LocalCertificateParams) ToProto() *proto.LocalCertificateParams
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 ¶
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
func (s ManagedCertificate) ToProto() *proto.ManagedCertificate
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
func (s ManagedCertificateParams) ToProto() *proto.ManagedCertificateParams
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 ¶
func (s ManagedKeyParams) ToProto() *proto.ManagedKeyParams
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
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.
Source Files ¶
- access_control.go
- access_control_secret.go
- access_control_totp.go
- access_control_type.go
- certificate_subject.go
- certificate_type.go
- ecdsa_key_pair.go
- key.go
- key_pair.go
- key_protection.go
- key_type.go
- local_certificate.go
- local_certificate_params.go
- local_key.go
- managed.go
- managed_certificate.go
- managed_certificate_params.go
- managed_key.go
- managed_key_params.go
- rsa_key_pair.go
- totp_access_control_receipt.go