Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeFromBase64(encoded string) ([]byte, error)
- func DecodeFromHex(encoded string) ([]byte, error)
- func Decrypt(cipherText []byte, key []byte, nonce []byte) ([]byte, error)
- func DecryptMessage(key []byte, data []byte) ([]byte, uint64, error)
- func DeriveSharedKey(privateKey *ecdh.PrivateKey, publicKey *ecdh.PublicKey) ([]byte, error)
- func DeserializeFromJSON(jsonStr string, data interface{}) error
- func EncodeToBase64(data []byte) string
- func EncodeToHex(data []byte) string
- func Encrypt(data []byte, key []byte) ([]byte, []byte, error)
- func EncryptMessage(key []byte, sequence uint64, payload interface{}) ([]byte, error)
- func GenerateCommandID() string
- func GenerateFingerprint(publicKey ed25519.PublicKey) (string, error)
- func GetCurrentTimestamp() int64
- func HasRequiredRole(role Identity, Role string) bool
- func LoadKeyFromFile(filename string) ([]byte, error)
- func RunCryptoHealthChecks() error
- func SecureKeyMemory(key []byte)
- func SerializeToJSON(data interface{}) (string, error)
- func Sign(data []byte, privateKey ed25519.PrivateKey) ([]byte, error)
- func ValidateKeyID(keyID string) error
- func Verify(data []byte, signature []byte, publicKey ed25519.PublicKey) (bool, error)
- func VerifyMessageSignature(msg AgentMessage) bool
- func ZeroKey(key []byte)
- type AgentMessage
- type AgentType
- type AuditLogEntry
- type AuthPayload
- type CommandPayload
- type ECCSignature
- type EncryptedEnv
- type EnvFile
- type Envelope
- type ErrorPayload
- type EventPayload
- type Identity
- type KeyPair
- type LogLevel
- type Logger
- func (l *Logger) Debug(msg string, args ...interface{})
- func (l *Logger) EnableBanner(enable bool)
- func (l *Logger) EnableCallerInfo(enable bool)
- func (l *Logger) EnableColor(enable bool)
- func (l *Logger) EnableTimestamp(enable bool)
- func (l *Logger) Error(msg string, args ...interface{})
- func (l *Logger) Fatal(msg string, args ...interface{})
- func (l *Logger) Indent() *Logger
- func (l *Logger) Info(msg string, args ...interface{})
- func (l *Logger) JSON(level LogLevel, data interface{})
- func (l *Logger) Log(level LogLevel, msg string, args ...interface{})
- func (l *Logger) Progress(level LogLevel, current, total int, label string)
- func (l *Logger) RegisterPackage(pkg string, displayName string)
- func (l *Logger) SetLevel(level LogLevel)
- func (l *Logger) SetOutput(w io.Writer)
- func (l *Logger) SetTimeFormat(format string)
- func (l *Logger) Success(msg string, args ...interface{})
- func (l *Logger) Table(level LogLevel, headers []string, rows [][]string)
- func (l *Logger) Timed(label string, fn func())
- func (l *Logger) Trace(msg string, args ...interface{})
- func (l *Logger) Warn(msg string, args ...interface{})
- func (l *Logger) WithPrefix(prefix string) *Logger
- type MessageHeader
- type MessageType
- type PublicKeyResponse
- type SecureMessage
- type StatusPayload
- type SystemLoad
- type TrustStore
- type TrustedKey
Constants ¶
View Source
const ( KeyIDLength = 32 NonceSize = 12 SignatureSize = ed25519.SignatureSize // 64 bytes for Ed25519 signature PublicKeySize = 32 PrivateKeySize = 32 FingerprintLength = 16 )
View Source
const ( RoleOwner = "owner" RoleAdmin = "admin" RoleDeployer = "deployer" RoleReader = "reader" )
View Source
const Version = "v0.1.55"
Variables ¶
View Source
var ( ErrNilKey = errors.New("crypto: nil key provided") ErrInvalidClientID = errors.New("auth: invalid client ID") ErrInvalidSigningMethod = errors.New("auth: invalid signing method") ErrKeyMismatch = errors.New("auth: key ID mismatch") ErrInvalidAudience = errors.New("auth: invalid audience") ErrInvalidToken = errors.New("auth: invalid token") ErrAuthKeyNotInitialized = errors.New("auth: WebSocket auth key not initialized") ErrEmptyClientID = errors.New("auth: empty client ID") )
View Source
var (
)
Functions ¶
func DecodeFromBase64 ¶
func DecodeFromHex ¶
func DeriveSharedKey ¶
func DeserializeFromJSON ¶
func EncodeToBase64 ¶
func EncodeToHex ¶
func EncryptMessage ¶
func GenerateCommandID ¶
func GenerateCommandID() string
func GetCurrentTimestamp ¶
func GetCurrentTimestamp() int64
func HasRequiredRole ¶
func LoadKeyFromFile ¶
func RunCryptoHealthChecks ¶
func RunCryptoHealthChecks() error
func SecureKeyMemory ¶
func SecureKeyMemory(key []byte)
func SerializeToJSON ¶
func VerifyMessageSignature ¶
func VerifyMessageSignature(msg AgentMessage) bool
Types ¶
type AgentMessage ¶
type AgentMessage struct {
Source AgentType `json:"source"`
Target AgentType `json:"target"`
Type MessageType `json:"type"`
Payload json.RawMessage `json:"payload"`
Timestamp int64 `json:"timestamp"`
AgentID string `json:"agent_id"`
Signature string `json:"signature,omitempty"`
Context map[string]string `json:"context,omitempty"`
}
func NewCommandMessage ¶
func NewCommandMessage(agentID string, command CommandPayload) (AgentMessage, error)
func NewStatusMessage ¶
func NewStatusMessage(agentID string, status StatusPayload) (AgentMessage, error)
func SignMessage ¶
func SignMessage(msg AgentMessage, privateKey *ecdsa.PrivateKey) (AgentMessage, error)
type AuditLogEntry ¶
type AuthPayload ¶
type CommandPayload ¶
type EncryptedEnv ¶
type EnvFile ¶
func ParseEnvFile ¶
type ErrorPayload ¶
type EventPayload ¶
type EventPayload struct {
Type string `json:"type"`
Data interface{} `json:"data"`
}
type KeyPair ¶
type KeyPair struct {
ECDHPrivate *ecdh.PrivateKey
ECDHPublic *ecdh.PublicKey
SignPrivate ed25519.PrivateKey
SignPublic ed25519.PublicKey
ECDSAKey *ecdsa.PrivateKey
KeyID string
}
func GenerateKeyPair ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func DefaultLogger ¶
func DefaultLogger() *Logger
func PackageLogger ¶
func (*Logger) EnableBanner ¶
func (*Logger) EnableCallerInfo ¶
func (*Logger) EnableColor ¶
func (*Logger) EnableTimestamp ¶
func (*Logger) RegisterPackage ¶
func (*Logger) SetTimeFormat ¶
func (*Logger) WithPrefix ¶
type MessageHeader ¶
type MessageType ¶
type MessageType string
const ( TypeCommand MessageType = "command" TypeCommandResponse MessageType = "command_response" TypeStatus MessageType = "status" TypeResponse MessageType = "response" TypeEvent MessageType = "event" TypeLog MessageType = "log" TypeError MessageType = "error" TypeAuth MessageType = "auth" TypeStatusAck MessageType = "status_ack" TypeAuthResponse MessageType = "auth_response" )
type PublicKeyResponse ¶
type SecureMessage ¶
type StatusPayload ¶
type StatusPayload struct {
Status string `json:"status"`
Metrics map[string]interface{} `json:"metrics,omitempty"`
Load SystemLoad `json:"load,omitempty"`
}
type SystemLoad ¶
type TrustStore ¶
type TrustStore struct {
Keys []TrustedKey `json:"keys"`
Identities []Identity `json:"identities"`
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
NOTE: CROSS COMPILE SAFE
|
NOTE: CROSS COMPILE SAFE |
|
Package sanitizer provides security-focused sanitization functions to prevent common vulnerabilities like command injection, path traversal, and other security issues.
|
Package sanitizer provides security-focused sanitization functions to prevent common vulnerabilities like command injection, path traversal, and other security issues. |
Click to show internal directories.
Click to hide internal directories.