privacy

package
v1.3.111 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package privacy pkg/skychat/privacy/store.go c3-app-chat

Package privacy keeps who may message this visor: a block list, and, when approval is on, the people already let in. Local, never sent to a peer.

Index

Constants

View Source
const MaxEntries = 5000

MaxEntries bounds each list, since the file is rewritten whole on a change.

Variables

View Source
var ErrFull = errors.New("skychat privacy: list is full")

ErrFull is returned when a list would grow past MaxEntries.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is the on-disk privacy state. Safe for concurrent use.

func OpenStore

func OpenStore(path string) (*Store, error)

OpenStore opens the store at path. A missing file is an empty store.

func (*Store) Accept

func (s *Store) Accept(pk string) error

Accept lets pk in when approval is on.

func (*Store) Accepted

func (s *Store) Accepted(pk string) bool

Accepted reports whether pk was let in explicitly.

func (*Store) Approval

func (s *Store) Approval() bool

Approval reports whether new peers must be accepted before they are let in.

func (*Store) Blocked

func (s *Store) Blocked(pk string) bool

Blocked reports whether pk is blocked.

func (*Store) BlockedList

func (s *Store) BlockedList() []string

BlockedList returns the blocked keys, sorted.

func (*Store) SetApproval

func (s *Store) SetApproval(on bool, existing []string) error

SetApproval turns approval on or off. Turning it on accepts every key in existing, so conversations already under way do not become requests.

func (*Store) SetBlocked

func (s *Store) SetBlocked(pk string, blocked bool) error

SetBlocked blocks or unblocks pk.

func (*Store) Unaccept

func (s *Store) Unaccept(pk string) error

Unaccept revokes an earlier Accept: the peer's next message is a request again. Blocking is untouched — it is a stronger, separate decision.

func (*Store) Verdict

func (s *Store) Verdict(pk string, known bool) Verdict

Verdict decides a message from pk. known reports whether pk is let in for a reason this store does not hold, such as a name in the address book.

type Verdict

type Verdict int

Verdict is what to do with a message from a peer.

const (
	// Allow delivers the message as usual.
	Allow Verdict = iota
	// Request keeps the message but shows it as a request to accept or block.
	Request
	// Reject drops the message: the peer is blocked.
	Reject
)

Jump to

Keyboard shortcuts

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