Help us shape the future of Go! Take the 2026 Go Developer Survey

metadata

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FileFormatVersion is the current version of the lockbox file format
	FileFormatVersion = 1
	// MagicBytes identifies a lockbox file
	MagicBytes = "LOCKBOX\x00"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessEntry

type AccessEntry struct {
	Timestamp time.Time `json:"timestamp"`
	Principal string    `json:"principal"`
	Action    string    `json:"action"`
	Resource  string    `json:"resource"`
	Success   bool      `json:"success"`
	Details   string    `json:"details,omitempty"`
}

AccessEntry represents a single access event

type AccessPolicy

type AccessPolicy struct {
	Version    int         `json:"version"`
	Principals []Principal `json:"principals"`
	Resources  []Resource  `json:"resources"`
	Actions    []string    `json:"actions"`
	Conditions []Condition `json:"conditions"`
	CreatedAt  time.Time   `json:"createdAt"`
	ModifiedAt time.Time   `json:"modifiedAt"`
}

AccessPolicy represents access control rules

type AuditTrail

type AuditTrail struct {
	CreatedAt  time.Time     `json:"createdAt"`
	CreatedBy  string        `json:"createdBy"`
	ModifiedAt time.Time     `json:"modifiedAt"`
	ModifiedBy string        `json:"modifiedBy"`
	AccessLog  []AccessEntry `json:"accessLog"`
	Version    int           `json:"version"`
}

AuditTrail holds audit information

type BlockInfo

type BlockInfo struct {
	ColumnName string `json:"columnName"`
	Offset     int64  `json:"offset"`
	Length     int64  `json:"length"`
	RowCount   int64  `json:"rowCount"`
	Compressed bool   `json:"compressed"`
	Checksum   []byte `json:"checksum"`
	OrigSize   int64  `json:"origSize,omitempty"`
	MimeType   string `json:"mimeType,omitempty"`
}

BlockInfo describes an encrypted data block

type Condition

type Condition struct {
	Type  string      `json:"type"` // "time", "ip", "custom"
	Value interface{} `json:"value"`
}

Condition represents access conditions

type EncryptionParams

type EncryptionParams struct {
	Algorithm     string            `json:"algorithm"`     // "AES-256-GCM"
	KeyDerivation string            `json:"keyDerivation"` // "PBKDF2"
	Iterations    int               `json:"iterations"`
	SaltSize      int               `json:"saltSize"`
	ColumnSalts   map[string][]byte `json:"columnSalts"` // Column name -> salt
	MasterSalt    []byte            `json:"masterSalt"`
}

EncryptionParams holds encryption configuration

type FileHeader

type FileHeader struct {
	Magic    [8]byte `json:"magic"`
	Version  uint32  `json:"version"`
	Flags    uint32  `json:"flags"`
	Reserved uint32  `json:"reserved"`
}

FileHeader represents the lockbox file header

type Metadata

type Metadata struct {
	Header       FileHeader       `json:"header"`
	Schema       *arrow.Schema    `json:"-"` // Serialized separately
	SchemaBytes  []byte           `json:"schemaBytes"`
	Encryption   EncryptionParams `json:"encryption"`
	AccessPolicy *AccessPolicy    `json:"accessPolicy,omitempty"`
	AuditTrail   AuditTrail       `json:"auditTrail"`
	BlockInfo    []BlockInfo      `json:"blockInfo"`
}

Metadata represents the complete lockbox metadata

func Deserialize

func Deserialize(data []byte) (*Metadata, error)

Deserialize deserializes metadata from JSON

func NewMetadata

func NewMetadata(schema *arrow.Schema, masterSalt []byte, createdBy string) (*Metadata, error)

NewMetadata creates new metadata for a lockbox file

func (*Metadata) AddBlockInfo

func (m *Metadata) AddBlockInfo(columnName string, offset, length, rowCount int64, checksum []byte, origSize int64, mime string)

AddBlockInfo adds information about an encrypted block

func (*Metadata) LogAccess

func (m *Metadata) LogAccess(principal, action, resource string, success bool, details string)

LogAccess logs an access event

func (*Metadata) Serialize

func (m *Metadata) Serialize() ([]byte, error)

Serialize serializes metadata to JSON

type Principal

type Principal struct {
	Type string `json:"type"` // "user", "role", "service"
	Name string `json:"name"`
}

Principal represents a user, role, or service account

type Resource

type Resource struct {
	Type string `json:"type"` // "column", "table", "dataset"
	Name string `json:"name"`
}

Resource represents a column, table, or dataset

Jump to

Keyboard shortcuts

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