Documentation
¶
Index ¶
- Constants
- Variables
- func CipherTextDecoder() ports.CipherTextDecoder
- func GenericIdentityOpener() ports.IdentityOpener
- func GenericKeyValidator() ports.KeyValidator
- type AesGcm
- type Argon2IDKeyDeriver
- type Argon2Params
- type CipherTextDecoderFunc
- type DefaultCipherTextEncoder
- type GenericIdentitySealer
- type IdentityOpenerFunc
- type KeyValidatorFunc
- type Pbkdf2KeyDeriver
- type Pbkdf2Params
- type XChaCha20Poly1305
Constants ¶
View Source
const ( AlgorithmArgon2ID = "argon2id" AlgorithmPbkdf2 = "pbkdf2" AlgorithmNone = "none" AlgorithmXChaCha20Poly1305 = "xchacha20-poly1305" AlgorithmAesGcm = "aes-gcm" )
Variables ¶
View Source
var DefaultArgon2Params = Argon2Params{
Iterations: 3,
Memory: 64 * 1024,
Threads: 2,
}
View Source
var DefaultPbkdf2Params = Pbkdf2Params{
Iterations: 210_000,
}
View Source
var ErrNoSealer = errors.New("can't seal identity without sealer")
Functions ¶
func CipherTextDecoder ¶
func CipherTextDecoder() ports.CipherTextDecoder
func GenericIdentityOpener ¶
func GenericIdentityOpener() ports.IdentityOpener
func GenericKeyValidator ¶
func GenericKeyValidator() ports.KeyValidator
Types ¶
type Argon2IDKeyDeriver ¶
type Argon2IDKeyDeriver struct {
Argon2Params
}
func (*Argon2IDKeyDeriver) Algorithm ¶
func (*Argon2IDKeyDeriver) Algorithm() string
func (*Argon2IDKeyDeriver) GenerateKey ¶
func (a *Argon2IDKeyDeriver) GenerateKey(password, existingSalt []byte, keyLength int) (key, salt []byte)
type Argon2Params ¶
func (*Argon2Params) MarshalText ¶
func (p *Argon2Params) MarshalText() (text []byte, err error)
MarshalText implements encoding.TextMarshaler.
func (*Argon2Params) UnmarshalText ¶
func (p *Argon2Params) UnmarshalText(text []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
type CipherTextDecoderFunc ¶
type CipherTextDecoderFunc func(text []byte) (*ports.CipherTextDecoderResult, error)
func (CipherTextDecoderFunc) Decode ¶
func (f CipherTextDecoderFunc) Decode(text []byte) (*ports.CipherTextDecoderResult, error)
type DefaultCipherTextEncoder ¶
type DefaultCipherTextEncoder struct {
}
func (DefaultCipherTextEncoder) EncodeCipherText ¶
func (DefaultCipherTextEncoder) EncodeCipherText(cipherText, salt, nonce []byte, deriver ports.KeyDeriver, cipher ports.Cipher) []byte
func (DefaultCipherTextEncoder) EncodeHash ¶
func (DefaultCipherTextEncoder) EncodeHash(hash, salt []byte, deriver ports.KeyDeriver) []byte
type GenericIdentitySealer ¶
type GenericIdentitySealer struct {
Deriver ports.KeyDeriver
Cipher ports.Cipher
Encoder ports.CipherTextEncoder
}
func NewGenericIdentitySealer ¶
func NewGenericIdentitySealer( sealer ports.Cipher, deriver ports.KeyDeriver, encoder ports.CipherTextEncoder, ) (*GenericIdentitySealer, error)
func (GenericIdentitySealer) KeyLength ¶
func (g GenericIdentitySealer) KeyLength() int
func (GenericIdentitySealer) SealIdentity ¶
func (g GenericIdentitySealer) SealIdentity(identity *age.X25519Identity, key []byte) ([]byte, error)
type IdentityOpenerFunc ¶
type IdentityOpenerFunc func(cipherText, key []byte) (*age.X25519Identity, error)
func (IdentityOpenerFunc) OpenIdentity ¶
func (f IdentityOpenerFunc) OpenIdentity(cipherText, key []byte) (*age.X25519Identity, error)
type KeyValidatorFunc ¶
type Pbkdf2KeyDeriver ¶
type Pbkdf2KeyDeriver struct {
Pbkdf2Params
}
func (*Pbkdf2KeyDeriver) Algorithm ¶
func (*Pbkdf2KeyDeriver) Algorithm() string
func (*Pbkdf2KeyDeriver) GenerateKey ¶
func (p *Pbkdf2KeyDeriver) GenerateKey(password, existingSalt []byte, keyLength int) (key, salt []byte)
type Pbkdf2Params ¶
type Pbkdf2Params struct {
Iterations int
}
func (*Pbkdf2Params) MarshalText ¶
func (p *Pbkdf2Params) MarshalText() (text []byte, err error)
func (*Pbkdf2Params) UnmarshalText ¶
func (p *Pbkdf2Params) UnmarshalText(text []byte) error
type XChaCha20Poly1305 ¶
type XChaCha20Poly1305 struct {
}
func (XChaCha20Poly1305) Algorithm ¶
func (XChaCha20Poly1305) Algorithm() string
func (XChaCha20Poly1305) KeyLength ¶
func (p XChaCha20Poly1305) KeyLength() int
Source Files
¶
Click to show internal directories.
Click to hide internal directories.