1package tinygit23import (4 "github.com/FelineStateMachine/tinyrelay/protocol/nostr"5)67// Event is the signed Nostr wire event accepted by the Git engine. Clients8// sign events themselves; the server never needs their private keys.9type Event = nostr.Event1011// Policy contains the policy values used by the Git engine. Hosts may keep a12// richer policy internally and adapt these values at the integration boundary.13type Policy struct {14 Owner string15 Reads string16 PrivatePeers []string17 Features PolicyFeatures18}1920// PolicyFeatures selects optional Git protocol capabilities.21type PolicyFeatures struct {22 Grasp bool23 Grasp02 bool24 Grasp03 bool25 Grasp05 bool26 Grasp06 bool27 Grasp08 bool28}2930func (p Policy) PrivateServiceEnabled() bool {31 return p.Features.Grasp && p.Features.Grasp08 && p.Reads == "members"32}3334// DefaultPolicy returns the defaults for an embedded engine.35func DefaultPolicy(owner string) Policy {36 return Policy{Owner: owner, Reads: "open"}37}3839func (g *GitRelay) policyValue() Policy {40 if g.policy == nil {41 return DefaultPolicy("")42 }43 return g.policy()44}