Documentation ¶
Index ¶
- Constants
- Variables
- func AppendToSignedHash(s SignedHash, i Identity) error
- func DecryptBlock(key []byte, nonce []byte, cipherdata []byte) ([]byte, error)
- func EcDecrypt(identity Identity, data []byte) ([]byte, error)
- func EcEncrypt(identity Identity, data []byte) ([]byte, error)
- func EncryptBlock(key []byte, nonce []byte, data []byte) ([]byte, error)
- func EncryptingReader(keyId uint64, keyFunc func(uint64) []byte, r io.ReadSeekCloser) (io.ReadSeekCloser, error)
- func FileHash(name string) ([]byte, error)
- func GenerateBytesKey(size int) []byte
- func Marshal(identity Identity, v any, signatureField string) ([]byte, error)
- func NewHash() hash.Hash
- func QuickHash(data []byte) []byte
- func SameIdentity(a, b Identity) bool
- func SetAlias(i Identity, alias string) error
- func SetIdentity(i Identity) error
- func Sign(identity Identity, data []byte) ([]byte, error)
- func Trust(i Identity, trusted bool) error
- func Unmarshal(data []byte, v any, signatureField string) (id string, err error)
- func Verify(id string, data []byte, sig []byte) bool
- func VerifySignedHash(s SignedHash, trusts []Identity, hash []byte) bool
- type HashReader
- type HashWriter
- type Identity
- type Key
- type PrivateKey
- type Public
- type PublicKey
- type SignedData
- type SignedHash
- type SignedHashEvidence
- type StreamReader
- type StreamWriter
Constants ¶
View Source
const ( Secp256k1 = "secp256k1" Ed25519 = "ed25519" )
View Source
const ( PublicKeySize = ed25519.PublicKeySize PrivateKeySize = ed25519.PrivateKeySize SignatureSize = ed25519.SignatureSize )
View Source
const AESHeaderSize = 8 + aes.BlockSize
View Source
const SignatureField = "dgst_ed25519_blake2b"
Variables ¶
View Source
var ErrInvalidSignature = errors.New("signature is invalid")
Functions ¶
func AppendToSignedHash ¶
func AppendToSignedHash(s SignedHash, i Identity) error
func EncryptingReader ¶
func EncryptingReader(keyId uint64, keyFunc func(uint64) []byte, r io.ReadSeekCloser) (io.ReadSeekCloser, error)
EncryptedWriter wraps w with an OFB cipher stream.
func GenerateBytesKey ¶
func SameIdentity ¶
func SetIdentity ¶
func VerifySignedHash ¶
func VerifySignedHash(s SignedHash, trusts []Identity, hash []byte) bool
Types ¶
type HashReader ¶
func NewHashReader ¶
func NewHashReader(r io.ReadSeekCloser) (*HashReader, error)
func (*HashReader) Close ¶
func (s *HashReader) Close() error
type HashWriter ¶
func NewHashWriter ¶
func NewHashWriter(w io.Writer) (*HashWriter, error)
type Identity ¶
type Identity struct { Nick string `json:"n"` Email string `json:"m"` SignatureKey Key `json:"s"` EncryptionKey Key `json:"e"` Trusted []string `json:"t"` Avatar []byte `json:"a"` }
func Identities ¶
func IdentityFromBase64 ¶
func IdentityFromId ¶
func NewIdentity ¶
type PrivateKey ¶
type PrivateKey ed25519.PrivateKey
type SignedData ¶
type SignedData struct { Signature [SignatureSize]byte Signer PublicKey }
type SignedHash ¶
func NewSignedHash ¶
func NewSignedHash(hash []byte, i Identity) (SignedHash, error)
type SignedHashEvidence ¶
type StreamReader ¶
type StreamReader struct {
// contains filtered or unexported fields
}
func (*StreamReader) Close ¶
func (sr *StreamReader) Close() error
type StreamWriter ¶
type StreamWriter struct {
// contains filtered or unexported fields
}
func DecryptingWriter ¶
EncryptedWriter wraps w with an OFB cipher stream.
Click to show internal directories.
Click to hide internal directories.