Documentation
¶
Index ¶
- func GenerateProjectID() (string, error)
- func SaveProjectConfig(pc *ProjectConfig) error
- type IntegrityIssue
- type Peer
- func (p *Peer) CanSync() bool
- func (p *Peer) EffectiveTransportFingerprint() string
- func (p *Peer) IsRevoked() bool
- func (p *Peer) MatchesTransportPublicKey(publicKey []byte) bool
- func (p *Peer) Normalize()
- func (p *Peer) PromoteToTrusted() error
- func (p *Peer) Revoke() error
- func (p *Peer) StatusIcon() string
- func (p *Peer) TransportPublicKeyBytes() ([]byte, error)
- func (p *Peer) Validate() error
- type ProjectConfig
- type Registry
- func (r *Registry) DeletePeer(teamID, fingerprint string) error
- func (r *Registry) FindPeerByLabel(label string) (*Peer, string, error)
- func (r *Registry) FindPeerInTeam(teamID, selector string) (*Peer, error)
- func (r *Registry) ListPeers(teamID string) ([]Peer, error)
- func (r *Registry) ListTeams() ([]string, error)
- func (r *Registry) LoadPeer(teamID, fingerprint string) (*Peer, error)
- func (r *Registry) LoadTeam(teamID string) (*Team, error)
- func (r *Registry) SavePeer(teamID string, p *Peer) error
- func (r *Registry) SaveTeam(team *Team) error
- func (r *Registry) ScanIntegrity(teamID string) ([]IntegrityIssue, error)
- type Team
- type TrustState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateProjectID ¶
GenerateProjectID creates a stable random project identifier for a repository.
func SaveProjectConfig ¶
func SaveProjectConfig(pc *ProjectConfig) error
SaveProjectConfig writes .devcontract.toml in the current directory.
Types ¶
type IntegrityIssue ¶
type Peer ¶
type Peer struct {
// DisplayName is the human-facing label for the peer.
DisplayName string `toml:"display_name,omitempty"`
// LegacyGitHubUsername keeps older peer files readable.
LegacyGitHubUsername string `toml:"github_username,omitempty"`
// RelayUsername is the relay-side member name used for display.
RelayUsername string `toml:"relay_username,omitempty"`
// Fingerprint is the Ed25519 identity fingerprint (SHA256:...).
Fingerprint string `toml:"fingerprint"`
// Ed25519Public is the identity public key (base64).
Ed25519Public string `toml:"ed25519_public,omitempty"`
// X25519Public is the transport public key (base64).
X25519Public string `toml:"x25519_public,omitempty"`
// TransportFingerprint is the fingerprint of the X25519 transport key.
TransportFingerprint string `toml:"transport_fingerprint,omitempty"`
// DeviceName is an optional human-readable device label.
DeviceName string `toml:"device_name,omitempty"`
// Trust is the current trust state.
Trust TrustState `toml:"trust"`
// FirstSeen is when this peer was first encountered.
FirstSeen time.Time `toml:"first_seen"`
// LastSeen is the last successful sync with this peer.
LastSeen time.Time `toml:"last_seen"`
// TrustedAt is when the peer was explicitly trusted.
TrustedAt time.Time `toml:"trusted_at,omitempty"`
// RevokedAt is when the peer was revoked.
RevokedAt time.Time `toml:"revoked_at,omitempty"`
}
Peer represents a known peer in the registry.
func (*Peer) EffectiveTransportFingerprint ¶
EffectiveTransportFingerprint returns the fingerprint used for transport verification.
func (*Peer) MatchesTransportPublicKey ¶
MatchesTransportPublicKey returns true if the provided key matches the stored transport identity.
func (*Peer) Normalize ¶
func (p *Peer) Normalize()
Normalize keeps compatibility with older peer files while writing the canonical display_name field for current builds.
func (*Peer) PromoteToTrusted ¶
PromoteToTrusted moves the peer from pending to trusted.
func (*Peer) StatusIcon ¶
StatusIcon returns a visual indicator for the peer's trust state.
func (*Peer) TransportPublicKeyBytes ¶
TransportPublicKeyBytes decodes the stored X25519 public key.
type ProjectConfig ¶
type ProjectConfig struct {
ConfigVersion int `toml:"config_version,omitempty"`
ProjectID string `toml:"project_id,omitempty"`
LegacyTeamID string `toml:"team_id,omitempty"`
Name string `toml:"name,omitempty"`
DefaultFile string `toml:"default_file,omitempty"`
SyncStrategy string `toml:"sync_strategy,omitempty"`
RelayURL string `toml:"relay_url,omitempty"`
}
ProjectConfig represents the per-project .devcontract.toml file.
func LoadProjectConfig ¶
func LoadProjectConfig() (*ProjectConfig, error)
LoadProjectConfig reads the .devcontract.toml from the current (or parent) directory.
func NewProjectConfig ¶
func NewProjectConfig(name, defaultFile, syncStrategy, relayURL string) (*ProjectConfig, error)
NewProjectConfig creates a fresh per-project config with a stable project ID.
func (*ProjectConfig) CanonicalProjectID ¶
func (pc *ProjectConfig) CanonicalProjectID() string
CanonicalProjectID returns the single project/team ID used throughout the CLI.
func (*ProjectConfig) Normalize ¶
func (pc *ProjectConfig) Normalize()
Normalize backfills defaults and migrates legacy team_id data into project_id.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages the persistent store of known peers and teams.
func NewRegistry ¶
NewRegistry creates a new peer registry backed by the filesystem.
func (*Registry) DeletePeer ¶
DeletePeer removes a peer from a team.
func (*Registry) FindPeerByLabel ¶
FindPeerByLabel searches all projects for a peer with the given display label.
func (*Registry) FindPeerInTeam ¶
FindPeerInTeam resolves a member by exact fingerprint, relay username, or display label within one project.
func (*Registry) ListPeers ¶
ListPeers returns all peers in a team and fails if any peer file is unreadable or malformed.
func (*Registry) ScanIntegrity ¶
func (r *Registry) ScanIntegrity(teamID string) ([]IntegrityIssue, error)
ScanIntegrity reports unreadable or malformed registry files without loading them into active state.
type Team ¶
type Team struct {
// ID is a unique team identifier.
ID string `toml:"id"`
// Name is a human-readable team name.
Name string `toml:"name"`
// CreatedBy is the identity fingerprint of the team creator.
CreatedBy string `toml:"created_by"`
// CreatedAt is when the team was created.
CreatedAt time.Time `toml:"created_at"`
// Members is the list of identity fingerprints in this team.
Members []string `toml:"members"`
}
Team represents a team of peers sharing .env files.
func (*Team) RemoveMember ¶
RemoveMember removes a fingerprint from the team's member list.
type TrustState ¶
type TrustState string
TrustState represents the trust level of a peer.
const ( TrustUnknown TrustState = "unknown" TrustPending TrustState = "pending" TrustTrusted TrustState = "trusted" TrustRevoked TrustState = "revoked" )