mirror of
https://github.com/aljazceru/haven.git
synced 2025-12-18 22:24:22 +01:00
fix readme, owner npub
This commit is contained in:
10
README.md
10
README.md
@@ -1,16 +1,16 @@
|
||||
# HAVEN
|
||||
|
||||
HAVEN (High Availability Vault for Events on Nostr) is the most comprehensive personal relay for the Nostr network. It provides it's owner with a variety of different relays to connect to, and a web of trust to filter out bad actors.
|
||||
HAVEN (High Availability Vault for Events on Nostr) is the most sovereign personal relay for the Nostr protocol, for storing and backing up sensitive notes like eCash, private chats and drafts. It is a relay that is not so dumb, with features like web of trust, inbox relay, cloud backups, blastr and the ability to import old notes.
|
||||
|
||||
## Four Relays in One
|
||||
|
||||
**Private Relay**: This relay is only accessible by the owner of the relay. It is used for drafts, ecash and other private notes that nobody can read or write to.haven
|
||||
**Private Relay**: This relay is only accessible by the owner of the relay. It is used for drafts, ecash and other private notes that nobody can read or write to. It is protected by Auth.
|
||||
|
||||
**Chat Relay**: This relay is used to contact the owner by DM. Only people in the web of trust can send notes that are private chat kinds.
|
||||
**Chat Relay**: This relay is used to contact the owner by DM. Only people in the web of trust can interact with this relay, protected by Auth. It only accepts encrypted DMs and group chat kinds.
|
||||
|
||||
**Inbox Relay**: This relay is used to send notes to the owner. Only people in the web of trust can send notes that are inbox kinds. Notes are pulled from other relays and stored in the inbox relay.
|
||||
**Inbox Relay**: This relay is where the owner of the relay reads from. Send your zaps, reactions and replies to this relay when you're tagging the owner. You can also pull notes from this relay if you want notes where the owner is tagged. This relay automatically pulls notes from other relays. Only notes where the owner is tagged will be accepted to this relay.
|
||||
|
||||
**Outbox Relay**: This relay is used to send notes to other people. Anyone can read to this relay but only the owner can write to it. Notes sent to the outbox are also blasted to other relays.
|
||||
**Outbox Relay**: This relay is where the owner's notes all live and are publicly accessible. You can import all your old notes to this relay. All notes sent to this relay are blasted to other relays. Only the owner can send to this relay, but anyone can read.
|
||||
|
||||
## Not So Dumb Relay Features
|
||||
|
||||
|
||||
28
main.go
28
main.go
@@ -67,6 +67,17 @@ func makeNewRelay(relayType string) *khatru.Relay {
|
||||
khatru.RequestAuth(ctx)
|
||||
})
|
||||
|
||||
privateRelay.RejectConnection = append(privateRelay.RejectConnection, func(r *http.Request) bool {
|
||||
ctx := r.Context()
|
||||
authenticatedUser := khatru.GetAuthed(ctx)
|
||||
|
||||
if authenticatedUser == nPubToPubkey(config.OwnerNpub) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
})
|
||||
|
||||
privateRelay.StoreEvent = append(privateRelay.StoreEvent, privateDB.SaveEvent)
|
||||
privateRelay.QueryEvents = append(privateRelay.QueryEvents, privateDB.QueryEvents)
|
||||
privateRelay.DeleteEvent = append(privateRelay.DeleteEvent, privateDB.DeleteEvent)
|
||||
@@ -74,7 +85,7 @@ func makeNewRelay(relayType string) *khatru.Relay {
|
||||
privateRelay.RejectFilter = append(privateRelay.RejectFilter, func(ctx context.Context, filter nostr.Filter) (bool, string) {
|
||||
authenticatedUser := khatru.GetAuthed(ctx)
|
||||
|
||||
if authenticatedUser == privateRelay.Info.PubKey {
|
||||
if authenticatedUser == nPubToPubkey(config.OwnerNpub) {
|
||||
return false, ""
|
||||
}
|
||||
|
||||
@@ -88,6 +99,17 @@ func makeNewRelay(relayType string) *khatru.Relay {
|
||||
khatru.RequestAuth(ctx)
|
||||
})
|
||||
|
||||
chatRelay.RejectConnection = append(chatRelay.RejectConnection, func(r *http.Request) bool {
|
||||
ctx := r.Context()
|
||||
authenticatedUser := khatru.GetAuthed(ctx)
|
||||
|
||||
if !wotMap[authenticatedUser] {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
})
|
||||
|
||||
chatRelay.StoreEvent = append(chatRelay.StoreEvent, chatDB.SaveEvent)
|
||||
chatRelay.QueryEvents = append(chatRelay.QueryEvents, chatDB.QueryEvents)
|
||||
chatRelay.DeleteEvent = append(chatRelay.DeleteEvent, chatDB.DeleteEvent)
|
||||
@@ -166,10 +188,10 @@ func makeNewRelay(relayType string) *khatru.Relay {
|
||||
outboxRelay.DeleteEvent = append(outboxRelay.DeleteEvent, outboxDB.DeleteEvent)
|
||||
|
||||
outboxRelay.RejectEvent = append(outboxRelay.RejectEvent, func(ctx context.Context, event *nostr.Event) (bool, string) {
|
||||
if event.PubKey == outboxRelay.Info.PubKey {
|
||||
if event.PubKey == nPubToPubkey(config.OwnerNpub) {
|
||||
return false, ""
|
||||
}
|
||||
return true, "you are not allowed to post to this relay"
|
||||
return true, "only notes signed by the owner of this relay are allowed"
|
||||
})
|
||||
|
||||
return outboxRelay
|
||||
|
||||
Reference in New Issue
Block a user