identity

package module
v0.0.0-...-60af40a Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: BSD-3-Clause Imports: 30 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RSAError = errors.New("IDENTITYKIT_SECRET environment variable is incompatible with rsa secrets")

Functions

func DefaultPath

func DefaultPath(domain string) string

Types

type CertOpts

type CertOpts struct {
	DNSNames []string
}

type FileVault

type FileVault struct {
	// contains filtered or unexported fields
}

func (*FileVault) Domain

func (self *FileVault) Domain(domain string) VaultI

func (*FileVault) ExportRSASecret

func (self *FileVault) ExportRSASecret() (*RSASecret, error)

func (*FileVault) ExportSecret

func (self *FileVault) ExportSecret() (*Secret, error)

func (*FileVault) Identity

func (self *FileVault) Identity() (*Identity, error)

func (*FileVault) Init

func (self *FileVault) Init(interactive bool) error

func (*FileVault) RSAPublic

func (self *FileVault) RSAPublic() (*RSAPublic, error)

func (*FileVault) RSASecret

func (self *FileVault) RSASecret() (*RSASecret, error)

func (*FileVault) Secret

func (self *FileVault) Secret() (*Secret, error)

func (*FileVault) Sign

func (self *FileVault) Sign(subject string, message []byte) (*Signature, error)

func (*FileVault) SignCertificate

func (self *FileVault) SignCertificate(template *x509.Certificate, pub *Identity) ([]byte, error)

func (*FileVault) SignContext

func (self *FileVault) SignContext(subject string, message []byte) (*Signature, error)

func (*FileVault) SignPrehashed

func (self *FileVault) SignPrehashed(subject string, sha512 []byte) (*Signature, error)

func (*FileVault) SignRSACertificate

func (self *FileVault) SignRSACertificate(template *x509.Certificate, pub *RSAPublic) ([]byte, error)

func (*FileVault) XPublic

func (self *FileVault) XPublic() (*XPublic, error)

type Identity

type Identity [32]byte // type 9

func IdentityFromSecret

func IdentityFromSecret(secret *Secret) *Identity

func IdentityFromString

func IdentityFromString(from string) (*Identity, error)

func (*Identity) Equal

func (self *Identity) Equal(other *Identity) bool

func (*Identity) MarshalJSON

func (b *Identity) MarshalJSON() ([]byte, error)

func (*Identity) String

func (self *Identity) String() string

func (*Identity) String58

func (self *Identity) String58() string

func (*Identity) ToCertificate

func (self *Identity) ToCertificate(opts ...CertOpts) (*x509.Certificate, error)

func (*Identity) ToGo

func (self *Identity) ToGo() crypto.PublicKey

func (*Identity) UnmarshalJSON

func (b *Identity) UnmarshalJSON(data []byte) (err error)

func (*Identity) XPublic

func (self *Identity) XPublic() (*XPublic, error)

type Message

type Message struct {
	Key   string
	Value []byte

} // type 14

func MessageFromString

func MessageFromString(from string) (*Message, error)

func (*Message) String

func (self *Message) String() string

func (*Message) ToString

func (self *Message) ToString() string

type RSAPublic

type RSAPublic rsa.PublicKey // type 8

func (*RSAPublic) String

func (self *RSAPublic) String() string

no implicit conversion for safety

func (*RSAPublic) ToCertificate

func (self *RSAPublic) ToCertificate(opts ...CertOpts) (*x509.Certificate, error)

func (*RSAPublic) ToGo

func (self *RSAPublic) ToGo() crypto.PublicKey

func (*RSAPublic) ToString

func (self *RSAPublic) ToString() string

type RSASecret

type RSASecret rsa.PrivateKey // type 5

func CreateRSASecret

func CreateRSASecret(size int) (*RSASecret, error)

func RSASecretFromString

func RSASecretFromString(from string) (*RSASecret, error)

func (*RSASecret) RSAPublic

func (self *RSASecret) RSAPublic() *RSAPublic

func (*RSASecret) String

func (self *RSASecret) String() string

no implicit conversion for safety

func (*RSASecret) ToGo

func (self *RSASecret) ToGo() crypto.Signer

func (*RSASecret) ToPem

func (self *RSASecret) ToPem() ([]byte, error)

func (*RSASecret) ToString

func (self *RSASecret) ToString() string

type Secret

type Secret [32]byte // type 3

func CreateSecret

func CreateSecret() (*Secret, error)

func SecretFromString

func SecretFromString(from string) (*Secret, error)

func (*Secret) Clear

func (self *Secret) Clear()

func (*Secret) Domain

func (self *Secret) Domain(domain string) VaultI

func (*Secret) ExportRSASecret

func (self *Secret) ExportRSASecret() (*RSASecret, error)

func (*Secret) ExportSecret

func (self *Secret) ExportSecret() (*Secret, error)

func (*Secret) Identity

func (self *Secret) Identity() (*Identity, error)

func (*Secret) Init

func (self *Secret) Init(interactive bool) error

func (*Secret) RSAPublic

func (self *Secret) RSAPublic() (*RSAPublic, error)

func (*Secret) Sign

func (self *Secret) Sign(subject string, message []byte) (*Signature, error)

func (*Secret) SignCertificate

func (self *Secret) SignCertificate(template *x509.Certificate, pub *Identity) ([]byte, error)

func (*Secret) SignContext

func (self *Secret) SignContext(subject string, message []byte) (*Signature, error)

func (*Secret) SignPrehashed

func (self *Secret) SignPrehashed(subject string, sha512 []byte) (*Signature, error)

func (*Secret) SignRSACertificate

func (self *Secret) SignRSACertificate(template *x509.Certificate, pub *RSAPublic) ([]byte, error)

func (*Secret) String

func (self *Secret) String() string

no implicit conversion for safety

func (*Secret) ToGo

func (self *Secret) ToGo() crypto.Signer

func (*Secret) ToPem

func (self *Secret) ToPem() ([]byte, error)

func (*Secret) ToString

func (self *Secret) ToString() string

func (*Secret) XPublic

func (self *Secret) XPublic() (*XPublic, error)

func (*Secret) XSecret

func (self *Secret) XSecret() *XSecret

func (*Secret) Xor

func (self *Secret) Xor(otp *Secret) Secret

type SecretKit

type SecretKit struct {
	Identity Secret
	Network  Secret

} // type 1

type 2^4 = max 15.

func SecretKitFromString

func SecretKitFromString(from string) (*SecretKit, error)

func (*SecretKit) ToString

func (self *SecretKit) ToString() string

type Serial

type Serial uint64 // type 11

func SerialFromString

func SerialFromString(from string) (Serial, error)

func (Serial) String

func (self Serial) String() string

func (Serial) ToString

func (self Serial) ToString() string

type Signature

type Signature [64]byte // type 10

func SignatureFromString

func SignatureFromString(from string) (*Signature, error)

func (*Signature) MarshalJSON

func (b *Signature) MarshalJSON() ([]byte, error)

func (*Signature) String

func (self *Signature) String() string

func (*Signature) UnmarshalJSON

func (b *Signature) UnmarshalJSON(data []byte) (err error)

func (*Signature) Verify

func (self *Signature) Verify(subject string, message []byte, signer *Identity) bool

func (*Signature) VerifyContext

func (self *Signature) VerifyContext(context string, message []byte, signer *Identity) error

func (*Signature) VerifyPrehashed

func (self *Signature) VerifyPrehashed(context string, sha512 []byte, signer *Identity) error

type Signer

type Signer interface {
	Sign(subject string, message []byte) (*Signature, error)
	Identity() (*Identity, error)
}

type VaultI

type VaultI interface {
	Init(interactive bool) error

	Domain(string) VaultI

	Identity() (*Identity, error)
	XPublic() (*XPublic, error)
	RSAPublic() (*RSAPublic, error)

	// Deprecated: use SignContext instead, which is the standardized Ed25519ctx variant
	Sign(context string, message []byte) (*Signature, error)

	SignContext(context string, message []byte) (*Signature, error)
	SignPrehashed(context string, sha512 []byte) (*Signature, error)

	SignCertificate(template *x509.Certificate, pub *Identity) ([]byte, error)
	SignRSACertificate(template *x509.Certificate, pub *RSAPublic) ([]byte, error)

	// will error for HSM, so use the other methods
	ExportSecret() (*Secret, error)
	ExportRSASecret() (*RSASecret, error)
}

func Vault

func Vault() VaultI

type XPublic

type XPublic [32]byte // type 6

func XPublicFromSecret

func XPublicFromSecret(from *XSecret) *XPublic

func XPublicFromString

func XPublicFromString(from string) (*XPublic, error)

func (*XPublic) MarshalJSON

func (b *XPublic) MarshalJSON() ([]byte, error)

func (*XPublic) String

func (self *XPublic) String() string

func (*XPublic) UnmarshalJSON

func (b *XPublic) UnmarshalJSON(data []byte) (err error)

type XSecret

type XSecret [32]byte // type 4

func CreateXSecret

func CreateXSecret() (*XSecret, error)

func XSecretFromString

func XSecretFromString(from string) (*XSecret, error)

func (*XSecret) String

func (self *XSecret) String() string

no implicit conversion for safety

func (*XSecret) ToString

func (self *XSecret) ToString() string

func (*XSecret) X25519

func (self *XSecret) X25519(pub *XPublic) *Secret

func (*XSecret) XPublic

func (self *XSecret) XPublic() *XPublic

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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