tinyrelayfile
tinyrelay/tinygit/api.go/

tinygit/api.go raw
1package tinygit
2
3import (
4 "github.com/FelineStateMachine/tinyrelay/protocol/nostr"
5)
6
7// Event is the signed Nostr wire event accepted by the Git engine. Clients
8// sign events themselves; the server never needs their private keys.
9type Event = nostr.Event
10
11// Policy contains the policy values used by the Git engine. Hosts may keep a
12// richer policy internally and adapt these values at the integration boundary.
13type Policy struct {
14 Owner string
15 Reads string
16 PrivatePeers []string
17 Features PolicyFeatures
18}
19
20// PolicyFeatures selects optional Git protocol capabilities.
21type PolicyFeatures struct {
22 Grasp bool
23 Grasp02 bool
24 Grasp03 bool
25 Grasp05 bool
26 Grasp06 bool
27 Grasp08 bool
28}
29
30func (p Policy) PrivateServiceEnabled() bool {
31 return p.Features.Grasp && p.Features.Grasp08 && p.Reads == "members"
32}
33
34// DefaultPolicy returns the defaults for an embedded engine.
35func DefaultPolicy(owner string) Policy {
36 return Policy{Owner: owner, Reads: "open"}
37}
38
39func (g *GitRelay) policyValue() Policy {
40 if g.policy == nil {
41 return DefaultPolicy("")
42 }
43 return g.policy()
44}

About

ownerc01503e8035f
visibilitypublic
headd730679639bf

Maintainers

  • c01503e8035f owner
  • ba1b5beed5b5 agent hermes

Clone

  • https://012.run/npub1cq2s86qrtadf36eqq3epm38wmhdynrrcwxf84eldk3f94dkv7ttsrulrz5/tinyrelay.git

Refs