Documentation
¶
Overview ¶
Package lanid manages this device's persistent LAN identity (an Ed25519 keypair) and the trusted-devices store, shared by the `s2u` CLI and the desktop GUI. Both store under os.UserConfigDir()/share2us (the same base cli-core uses for credentials/config), so a device's identity and the devices it trusts are shared across the CLI and GUI on one machine.
Trust is keyed by the peer's verified public-key fingerprint (never its name or IP), so a device recognised once needs no per-transfer verify code — and can be revoked.
Index ¶
- func ActivityAppend(e ActivityEntry)
- func ActivityClear()
- func Code() string
- func Fingerprint() string
- func GetScanInterval() int
- func Identity() (ed25519.PrivateKey, error)
- func SetScanInterval(sec int) error
- func Trust(fingerprint, name string) error
- func Untrust(fingerprint string) error
- type ActivityEntry
- type TrustedDevice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivityAppend ¶
func ActivityAppend(e ActivityEntry)
ActivityAppend records an event, keeping the newest maxActivity entries.
func Code ¶
func Code() string
Code is the short human-verifiable code for this device's fingerprint.
func GetScanInterval ¶
func GetScanInterval() int
GetScanInterval returns the broadcast-discovery scan interval in seconds (default 60; 0 = manual refresh only).
func Identity ¶
func Identity() (ed25519.PrivateKey, error)
Identity returns this device's persistent Ed25519 identity, creating and saving it (0600) on first use.
func SetScanInterval ¶
SetScanInterval persists the scan interval (seconds; 0 = manual only).
Types ¶
type ActivityEntry ¶
type ActivityEntry struct {
Kind string `json:"kind"` // sent | received | downloaded | broadcast | link
Peer string `json:"peer"`
Name string `json:"name"`
Size int64 `json:"size"`
Link string `json:"link,omitempty"` // for kind "link": the share URL (re-copyable)
TS int64 `json:"ts"` // unix seconds
}
ActivityEntry is one logged transfer/broadcast event. Metadata only — never file contents.
type TrustedDevice ¶
TrustedDevice is a device we've trusted, keyed by its verified Ed25519 key fingerprint. Trusted = auto-accept (its transfers land without a prompt); untrusted devices always prompt. Revocable.
func Lookup ¶
func Lookup(fingerprint string) (TrustedDevice, bool)
Lookup returns the trusted device for a fingerprint (ok=false if untrusted or the fingerprint is empty/anonymous).