Documentation
¶
Index ¶
- Constants
- func GetKnownDestination(hash string) ([]interface{}, bool)
- func GetRandomHash() []byte
- func HashFromString(hash string) ([]byte, error)
- func Remember(packet []byte, destHash []byte, publicKey []byte, appData []byte)
- func TruncatedHash(data []byte) []byte
- func ValidateAnnounce(packet []byte, destHash []byte, publicKey []byte, signature []byte, ...) bool
- type Identity
- func FromBytes(data []byte) (*Identity, error)
- func FromFile(path string) (*Identity, error)
- func FromPublicKey(publicKey []byte) *Identity
- func LoadOrCreateTransportIdentity() (*Identity, error)
- func New() (*Identity, error)
- func NewIdentity() (*Identity, error)
- func Recall(hash []byte) (*Identity, error)
- func RecallIdentity(path string) (*Identity, error)
- func (i *Identity) CleanupExpiredRatchets()
- func (i *Identity) ComputeHMAC(key, message []byte) []byte
- func (i *Identity) Decrypt(ciphertextToken []byte, ratchets [][]byte, enforceRatchets bool, ...) ([]byte, error)
- func (i *Identity) DecryptWithHMAC(data []byte, key []byte) ([]byte, error)
- func (i *Identity) Encrypt(plaintext []byte, ratchet []byte) ([]byte, error)
- func (i *Identity) EncryptWithHMAC(plaintext []byte, key []byte) ([]byte, error)
- func (i *Identity) GenerateHMACKey() []byte
- func (i *Identity) GetContext() []byte
- func (i *Identity) GetCurrentRatchetKey() []byte
- func (i *Identity) GetEncryptionKey() []byte
- func (i *Identity) GetHexHash() string
- func (i *Identity) GetNameHash() []byte
- func (i *Identity) GetPrivateKey() []byte
- func (i *Identity) GetPublicKey() []byte
- func (i *Identity) GetRatchetID(ratchetPubBytes []byte) []byte
- func (i *Identity) GetRatchetKey(id string) ([]byte, bool)
- func (i *Identity) GetRatchets() [][]byte
- func (i *Identity) GetSalt() []byte
- func (i *Identity) GetSigningKey() []byte
- func (i *Identity) Hash() []byte
- func (i *Identity) Hex() string
- func (i *Identity) RotateRatchet() ([]byte, error)
- func (i *Identity) SetRatchetKey(id string, key []byte)
- func (i *Identity) Sign(data []byte) []byte
- func (i *Identity) String() string
- func (i *Identity) ToFile(path string) error
- func (i *Identity) ValidateAnnounce(data []byte, destHash []byte, appData []byte) bool
- func (i *Identity) ValidateHMAC(key, message, messageHMAC []byte) bool
- func (i *Identity) Verify(data []byte, signature []byte) bool
Constants ¶
View Source
const ( CURVE = "Curve25519" KEYSIZE = 512 // Combined length of encryption key (256) and signing key (256) RATCHETSIZE = 256 RATCHET_EXPIRY = 2592000 // 30 days in seconds TRUNCATED_HASHLENGTH = 128 NAME_HASH_LENGTH = 80 // Token constants for Fernet-like spec TOKEN_OVERHEAD = 16 // AES block size AES128_BLOCKSIZE = 16 HASHLENGTH = 256 SIGLENGTH = KEYSIZE RATCHET_ROTATION_INTERVAL = 1800 // Default 30 minutes in seconds MAX_RETAINED_RATCHETS = 512 // Maximum number of retained ratchet keys )
Variables ¶
This section is empty.
Functions ¶
func GetKnownDestination ¶
func GetRandomHash ¶
func GetRandomHash() []byte
func HashFromString ¶
func TruncatedHash ¶
Types ¶
type Identity ¶
type Identity struct {
// contains filtered or unexported fields
}
func FromPublicKey ¶
func NewIdentity ¶
NewIdentity creates a new Identity instance with fresh keys
func RecallIdentity ¶
func (*Identity) CleanupExpiredRatchets ¶
func (i *Identity) CleanupExpiredRatchets()
func (*Identity) ComputeHMAC ¶
func (*Identity) DecryptWithHMAC ¶
func (*Identity) EncryptWithHMAC ¶
func (*Identity) GenerateHMACKey ¶
func (*Identity) GetContext ¶
func (*Identity) GetCurrentRatchetKey ¶
func (*Identity) GetEncryptionKey ¶
GetEncryptionKey returns the X25519 public key used for encryption
func (*Identity) GetHexHash ¶
func (*Identity) GetNameHash ¶
GetNameHash returns a 10-byte hash derived from the identity's public key
func (*Identity) GetPrivateKey ¶
func (*Identity) GetPublicKey ¶
func (*Identity) GetRatchetID ¶
func (*Identity) GetRatchets ¶
func (*Identity) GetSigningKey ¶
GetSigningKey returns the Ed25519 public key used for signing
func (*Identity) RotateRatchet ¶
func (*Identity) SetRatchetKey ¶
func (*Identity) ValidateAnnounce ¶
ValidateAnnounce validates an announce packet's signature
func (*Identity) ValidateHMAC ¶
Click to show internal directories.
Click to hide internal directories.