Documentation
¶
Index ¶
- Constants
- Variables
- func APIBaseFromBaseURL(baseURL string) (string, error)
- func CacheBaseDir() (string, error)
- func CacheEntryIsLocal(entry CacheEntry) bool
- func CacheManifestPath() (string, error)
- func CacheObjectsDir() (string, error)
- func ConfigPath() (string, error)
- func ContentClassForNameAndType(name, contentType string) string
- func CredentialPath() (string, error)
- func DaemonRuntimeDir() (string, error)
- func DaemonSocketPath() (string, error)
- func DaemonTokenPath() (string, error)
- func DecodeKey(encoded string) ([]byte, error)
- func DecryptStream(dst io.Writer, src io.Reader, key []byte) error
- func DefaultExpiry() string
- func DeleteCredential() error
- func DownloadGatewayURL(apiBase, publicID string) (string, error)
- func DownloadsDir() string
- func DurationForAPI(value string) (string, error)
- func EncodeKey(key []byte) string
- func EncryptStream(dst io.Writer, src io.Reader, key []byte) error
- func EnvAPIToken() string
- func ExpiryForAPI(value string) (expiresIn string, noExpiry bool, err error)
- func FileSHA256(path string) (string, error)
- func ForgetAllRetainedKeys() error
- func ForgetRetainedKey(sharePublicID string) error
- func FullVersion() string
- func IsAPIToken(token string) bool
- func IsAuthorizationPending(err error) bool
- func IsDeviceLimitReached(err error) bool
- func IsHighConfidenceSecretRule(ruleID string) bool
- func KeyFromShareURL(raw string) ([]byte, error)
- func ListIndexPath() (string, error)
- func NewContentKey() ([]byte, error)
- func NewDataKey() ([]byte, error)
- func NewHopNonce() (string, error)
- func NewInstallID() string
- func NormalizeAPIHost(value string) (string, error)
- func NormalizeBaseURL(value string) (string, error)
- func NormalizeShareBase(value string) (string, error)
- func NormalizeUpdateChannel(value string) (string, error)
- func OpenBrowser(rawURL string) error
- func OpenSealedContentKey(sealedKey, publicKey, privateKey string) ([]byte, error)
- func OpenSealedForDevice(sealed, publicKey, privateKey string) ([]byte, error)
- func P2PStreamingEnabled() bool
- func ParseDuration(value string) (time.Duration, error)
- func PendingResealPath() (string, error)
- func QRIsText(b []byte) bool
- func RandomTip(command string) string
- func RedactSecretFinding(match, secret string) string
- func RenderQR(content string) (string, error)
- func ResolveAPIBase() (string, string, error)
- func ResolveBaseURL() (string, string, error)
- func ResolveShareBase() (string, string, error)
- func ResolveUpdateChannel(config Config) string
- func RetainContentKey(sharePublicID, contentKeyB64, recipientEmail string) error
- func SaveCacheManifest(manifest CacheManifest) error
- func SaveCacheManifestAt(path string, manifest CacheManifest) error
- func SaveConfig(config Config) error
- func SaveConfigAt(path string, config Config) error
- func SaveCredential(credential Credential) error
- func SaveCredentialAt(path string, credential Credential) error
- func SaveListIndex(entries []ListIndexEntry) error
- func SaveListIndexAt(path string, entries []ListIndexEntry) error
- func SavePendingReseal(store PendingResealStore) error
- func SaveSourceRegistry(registry SourceRegistry) error
- func SaveSourceRegistryAt(path string, registry SourceRegistry) error
- func SaveTrustList(list LanTrustList) error
- func SaveUpdateCheckCache(cache UpdateCheckCache) error
- func SaveUpdateCheckCacheAt(path string, cache UpdateCheckCache) error
- func SealContentKeyForDevice(contentKey []byte, targetPublicKey string) (string, error)
- func SealForDevice(plaintext []byte, targetPublicKey string) (string, error)
- func SecretFindingsError(count int) error
- func SetReceiveAuto(auto bool) error
- func SetReceiveDir(dir string) error
- func ShareBaseFromBaseURL(baseURL string) (string, error)
- func ShareURLWithKey(base, publicID string, key []byte) string
- func SignHop(c HopClaims, privateKey string) (string, error)
- func SleepInterval(interval int) time.Duration
- func SourceRefForPath(path string) (string, string, error)
- func SourceRegistryPath() (string, error)
- func Tips(command string) []string
- func UniquePath(p string) string
- func UpdateCheckCachePath() (string, error)
- func Usage(command string) string
- func VerificationURL(code DeviceCodeResponse) string
- func VerifyHop(c HopClaims, signature, publicKey string) error
- func VerifyHopFresh(c HopClaims, signature, publicKey string, now time.Time, window time.Duration) error
- type APIError
- type APITokenInfo
- type AccessControlsRequest
- type AgentGrant
- type AgentInjectInput
- type AgentInjectResult
- type AgentInjectState
- type AgentInvite
- type AgentJoinResult
- type AgentRegisterInput
- type AgentRequest
- type AgentSessionInfo
- type AnalyticsTimelinePoint
- type CacheEntry
- type CacheManifest
- type Client
- func (c *Client) AcceptAgentInvite(ctx context.Context, id string) error
- func (c *Client) AckInboxShare(ctx context.Context, publicID string) error
- func (c *Client) AgentAllow(ctx context.Context, senderDeviceID string) error
- func (c *Client) AgentAllowed(ctx context.Context) ([]AgentGrant, error)
- func (c *Client) AgentApproveOnce(ctx context.Context, id string) error
- func (c *Client) AgentDownloadContent(ctx context.Context, id string, dst io.Writer) error
- func (c *Client) AgentInject(ctx context.Context, in AgentInjectInput) (AgentInjectResult, error)
- func (c *Client) AgentInjectStatus(ctx context.Context, id string) (AgentInjectState, error)
- func (c *Client) AgentJoin(ctx context.Context, code, agentID string) (AgentJoinResult, error)
- func (c *Client) AgentLongPoll(ctx context.Context, waitSeconds int) ([]AgentRequest, error)
- func (c *Client) AgentPending(ctx context.Context) ([]AgentRequest, error)
- func (c *Client) AgentReportResult(ctx context.Context, id, status, result string) error
- func (c *Client) AgentRevoke(ctx context.Context, senderDeviceID string) error
- func (c *Client) AgentUploadContent(ctx context.Context, ciphertext []byte) (string, error)
- func (c *Client) ApprovePendingInbox(ctx context.Context, publicID string) error
- func (c *Client) AuthorizeP2PRoom(ctx context.Context, room, role string) (P2PRoomAuth, error)
- func (c *Client) CheckUpdate(ctx context.Context, version, osName, arch string) (UpdateCheckResponse, error)
- func (c *Client) CheckUpdateChannel(ctx context.Context, version, osName, arch, channel string) (UpdateCheckResponse, error)
- func (c *Client) CloseGoal(ctx context.Context, id, state, reason, evidence string) (Goal, error)
- func (c *Client) CompleteUpload(ctx context.Context, uploadSessionID string) (UploadCompleteResponse, error)
- func (c *Client) CreateAPIToken(ctx context.Context, label string, scopes []string, expiresInDays *int) (CreateAPITokenResponse, error)
- func (c *Client) CreateGoal(ctx context.Context, in NewGoal) (Goal, error)
- func (c *Client) CreateReplaceUpload(ctx context.Context, publicID string, upload UploadCreateRequest) (UploadCreateResponse, error)
- func (c *Client) CreateUpload(ctx context.Context, upload UploadCreateRequest) (UploadCreateResponse, error)
- func (c *Client) DeclineAgentInvite(ctx context.Context, id string) error
- func (c *Client) DeleteShare(ctx context.Context, publicID string) error
- func (c *Client) DeleteTeammateSender(ctx context.Context, email string) error
- func (c *Client) DeregisterAgentSession(ctx context.Context, sessionID string) error
- func (c *Client) DisableShare(ctx context.Context, publicID string) (Share, error)
- func (c *Client) DownloadInboxContent(ctx context.Context, publicID string, dst io.Writer) error
- func (c *Client) DownloadURL(ctx context.Context, rawURL string, dst io.Writer) error
- func (c *Client) EnableShare(ctx context.Context, publicID string) (Share, error)
- func (c *Client) ExposeDeviceToContact(ctx context.Context, email, deviceSessionID string) error
- func (c *Client) ExtendExpiry(ctx context.Context, publicID string, expiresIn time.Duration) (Share, error)
- func (c *Client) FlushShare(ctx context.Context, publicID string) (LiveFlushResponse, error)
- func (c *Client) GetGoal(ctx context.Context, id string) (Goal, error)
- func (c *Client) GetOnboarding(ctx context.Context) (OnboardingStatus, error)
- func (c *Client) GetShare(ctx context.Context, publicID string) (Share, error)
- func (c *Client) GetTeammatePolicy(ctx context.Context) (TeammatePolicy, error)
- func (c *Client) Inbox(ctx context.Context) (InboxResponse, error)
- func (c *Client) LanTrustOpen(ctx context.Context, fingerprint, name, mode string) (LanTrustChallenge, error)
- func (c *Client) LanTrustRevoke(ctx context.Context, fingerprint string) (LanTrustList, error)
- func (c *Client) LanTrustSetMode(ctx context.Context, fingerprint, mode string) (LanTrustList, error)
- func (c *Client) LanTrustVerify(ctx context.Context, challengeID, code string) (LanTrustList, error)
- func (c *Client) LanTrusted(ctx context.Context) (LanTrustList, error)
- func (c *Client) ListAgentInvites(ctx context.Context) ([]AgentInvite, error)
- func (c *Client) ListAgentSessions(ctx context.Context) ([]AgentSessionInfo, error)
- func (c *Client) ListAgentSessionsIncludingOffline(ctx context.Context) ([]AgentSessionInfo, error)
- func (c *Client) ListDevices(ctx context.Context) (ListDevicesResponse, error)
- func (c *Client) ListExposedDevicesForContact(ctx context.Context, email string) ([]string, error)
- func (c *Client) ListGoals(ctx context.Context, liveOnly bool, limit int) ([]Goal, error)
- func (c *Client) ListPendingInbox(ctx context.Context) (PendingInboxResponse, error)
- func (c *Client) ListProjectAgents(ctx context.Context, projectID string) ([]ProjectAgentAddress, error)
- func (c *Client) ListProjectAgentsIncludingOffline(ctx context.Context, projectID string) ([]ProjectAgentAddress, error)
- func (c *Client) ListShares(ctx context.Context) (ListSharesResponse, error)
- func (c *Client) Logout(ctx context.Context) error
- func (c *Client) Me(ctx context.Context) (MeResponse, error)
- func (c *Client) PollDeviceToken(ctx context.Context, deviceCode string) (DeviceTokenResponse, error)
- func (c *Client) PutLive(ctx context.Context, publicID string, request LivePutRequest) (LivePutResponse, error)
- func (c *Client) PutUpload(ctx context.Context, upload PresignedUpload, body io.Reader, size int64) error
- func (c *Client) RegisterAgentSession(ctx context.Context, in AgentRegisterInput) error
- func (c *Client) RegisterDeviceKey(ctx context.Context, publicKey string) error
- func (c *Client) RegisterSigningKey(ctx context.Context, publicKey string) error
- func (c *Client) RejectPendingInbox(ctx context.Context, publicID string) error
- func (c *Client) ReportInstall(ctx context.Context, e InstallEvent) error
- func (c *Client) ResealQueue(ctx context.Context) (ResealQueueResponse, error)
- func (c *Client) RevokeAllShares(ctx context.Context) (RevokeAllResponse, error)
- func (c *Client) RevokeDeviceSession(ctx context.Context, sessionID string) error
- func (c *Client) RevokeDeviceSessionWithDeviceCode(ctx context.Context, deviceCode, sessionID string) error
- func (c *Client) RevokeShare(ctx context.Context, publicID string) (Share, error)
- func (c *Client) SetGoalState(ctx context.Context, id, state string) (Goal, error)
- func (c *Client) SetTeammatePolicy(ctx context.Context, mode string) error
- func (c *Client) SetTeammateSender(ctx context.Context, email, mode string) error
- func (c *Client) ShareAnalytics(ctx context.Context, publicID string) (ShareAnalyticsResponse, error)
- func (c *Client) StartDeviceCode(ctx context.Context, request ...DeviceCodeRequest) (DeviceCodeResponse, error)
- func (c *Client) SubmitConsent(ctx context.Context, version string) error
- func (c *Client) SubmitReseal(ctx context.Context, publicID, targetSessionID, sealedKey string) error
- func (c *Client) TeammateDevices(ctx context.Context, email string) (TeammateDeviceList, error)
- func (c *Client) UnexposeDeviceFromContact(ctx context.Context, email, deviceSessionID string) error
- func (c *Client) UnlockOwnShare(ctx context.Context, publicID string) (string, error)
- func (c *Client) UpdateAccessControls(ctx context.Context, publicID string, controls AccessControlsRequest) (Share, error)
- func (c *Client) Usage(ctx context.Context) (UsageResponse, error)
- func (c *Client) WithdrawAgent(ctx context.Context, projectID, membershipID string) error
- type Config
- func (c Config) DaemonSettings() ResolvedDaemon
- func (c *Config) DeleteDeviceAlias(name string) bool
- func (c *Config) DeleteTrustedPeer(ref string) bool
- func (c Config) ReceiveSettings() ResolvedReceive
- func (c Config) ResolveDeviceAlias(name string) (string, bool)
- func (c Config) ResolvedReshareDefault() *bool
- func (c *Config) SetDeviceAlias(name, addr string)
- func (c *Config) SetTrustedPeer(ref string)
- func (c Config) TrustedIPs() []string
- type CreateAPITokenResponse
- type Credential
- type DaemonConfig
- type DeviceAlias
- type DeviceCodeRequest
- type DeviceCodeResponse
- type DeviceKeyPair
- type DeviceLimitDetails
- type DeviceMetadata
- type DeviceRef
- type DeviceSession
- type DeviceTokenResponse
- type Goal
- type HopClaims
- type InboxResponse
- type InboxShare
- type InstallEvent
- type LanTrustChallenge
- type LanTrustList
- type LanTrustedDevice
- type ListDevicesResponse
- type ListIndexEntry
- type ListSharesResponse
- type LiveFlushResponse
- type LivePutRequest
- type LivePutResponse
- type LocalMatch
- type MatchOptions
- type MeResponse
- type NewGoal
- type OnboardingStatus
- type P2PICEServer
- type P2PRoomAuth
- type PendingInboxResponse
- type PendingInboxShare
- type PendingResealEntry
- type PendingResealStore
- type PresignedUpload
- type ProjectAgentAddress
- type ReceiveConfig
- type ResealEntry
- type ResealQueueResponse
- type ResolvedDaemon
- type ResolvedReceive
- type RevokeAllResponse
- type SecretFinding
- type SecretScanOptions
- type SecretScanResult
- type Share
- type ShareAccessEvent
- type ShareAnalyticsResponse
- type ShareRef
- type SigningKeyPair
- type SourceRegistry
- type SourceRegistryEntry
- type TeammateDevice
- type TeammateDeviceList
- type TeammatePolicy
- type TeammateSenderPref
- type UpdateCheckCache
- type UpdateCheckResponse
- type UpdateDownloads
- type UploadCompleteResponse
- type UploadCreateRequest
- type UploadCreateResponse
- type UploadDefaults
- type UploadTarget
- type UsageResponse
Constants ¶
const ( APIBaseSourceEnv = "env" APIBaseSourceConfig = "config" APIBaseSourceDefault = "default" )
const ( UpdateChannelStable = "stable" UpdateChannelBeta = "beta" UpdateChannelEnv = "SHARE2US_UPDATE_CHANNEL" )
const ( DefaultBaseURL = "share2.us" DefaultAPIBase = "https://api.share2.us" )
const ( // ApprovalPolicyStrict rejects everything that is not a trusted+auto device. // A trusted+ask or untrusted request is notified and declined. This is the // default: a resident receiver must not widen what lands without a human. ApprovalPolicyStrict = "strict" // ApprovalPolicyNotifyWait notifies for a trusted+ask device and waits for a // decision (action buttons or, until those land, a timeout that declines). // Untrusted is still rejected. Opt-in. ApprovalPolicyNotifyWait = "notify-wait" )
Approval policies for the background daemon's headless LAN receiver. Trust itself is never granted here (ADR-034/ADR-035): these only decide what an already-known device's inbound transfer does when no human is at a terminal.
const APITokenEnv = "SHARE2US_API_TOKEN"
APITokenEnv is the environment variable a caller (CI, automation) can set to authenticate with a personal access token instead of an interactive login.
const APITokenPrefix = "s2u_pat_"
APITokenPrefix marks a Share2Us personal access token (PAT) on the wire. Mirrors the server-side prefix; used to recognise env-provided tokens.
const ContentClassFolder = "folder"
const CredentialSchemaVersion = 1
const DefaultSecretScanMaxBytes int64 = 5 * 1024 * 1024
const (
EncryptionAlgoAES256GCM = "aes256gcm"
)
const PendingResealTTL = 14 * 24 * time.Hour
const QRContentMaxBytes = 1000
QRContentMaxBytes caps an in-terminal *content* QR so it stays scannable by a phone camera. It is far below the raw QR byte-mode ceiling (2953 bytes / a 177x177-module code): a terminal renders each module ~one character cell, so a dense high-version code can't be resolved from a screen. Tunable.
const QRContentWarnBytes = 300
QRContentWarnBytes: above this (but under the hard cap) a content QR still encodes, but the code is dense enough that it may be harder to scan.
Variables ¶
var ( BuildVersion = "dev" Version = "dev" // P2PEnabled gates the direct peer-to-peer streaming commands (`p2p send/recv` // and the `stream` alias). Build-time flag, set with: // // -ldflags "-X github.com/share2us/cli-core.P2PEnabled=true" // // It DEFAULTS OFF and is fail-safe: any value other than "true" disables the // commands and hides them from the usage text. P2P is also gated server-side // (SHARE2US_P2P_ENABLED + the p2p_streaming_enabled plan entitlement), so this // is a shipping switch, not a security control — a rebuilt binary cannot turn // the feature on by itself. P2PEnabled = "false" )
var DefaultHTTPClient = &http.Client{ Transport: &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{Timeout: 15 * time.Second, KeepAlive: 30 * time.Second}).DialContext, ForceAttemptHTTP2: true, MaxIdleConns: 100, IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ResponseHeaderTimeout: 30 * time.Second, ExpectContinueTimeout: 1 * time.Second, }, }
DefaultHTTPClient bounds connection setup and slow-header responses so a slow or malicious server (including a presigned-URL host) cannot pin the CLI during setup. It deliberately sets no overall Timeout: file up/downloads can be long, and the per-request context is what bounds total call duration.
var ErrHopSignature = errors.New("hop signature is not valid")
ErrHopSignature covers every way a hop signature can fail: wrong key, altered field, malformed signature. Callers should not distinguish them to a remote party — "this hop is not authentic" is the whole answer.
var ErrHopStale = errors.New("hop signature is outside the freshness window")
ErrHopStale is a valid signature outside the freshness window: a replay, or a clock far enough out that it cannot be told apart from one.
var (
ErrInvalidKey = errors.New("invalid encryption key")
)
Functions ¶
func APIBaseFromBaseURL ¶
func CacheBaseDir ¶
func CacheEntryIsLocal ¶
func CacheEntryIsLocal(entry CacheEntry) bool
func CacheManifestPath ¶
func CacheObjectsDir ¶
func ConfigPath ¶
func CredentialPath ¶
CredentialPath is where the CLI stores its saved login. It mirrors ConfigPath (os.UserConfigDir) so the token and config.json live together: ~/.config/share2us on Linux/macOS (honoring XDG_CONFIG_HOME) and %AppData%\Roaming\share2us on Windows. Before 2026-07 this used XDG/HOME directly, which on Windows put the token under %USERPROFILE%\.config instead — see legacyCredentialPath.
func DaemonRuntimeDir ¶ added in v0.15.0
DaemonRuntimeDir is the per-user runtime directory for the daemon's control socket and pid. It prefers XDG_RUNTIME_DIR (systemd's %t, cleaned on logout); when that is unset (common over SSH or on minimal sessions) it falls back to a "run" dir under the user cache. The directory is created 0700.
func DaemonSocketPath ¶ added in v0.15.0
DaemonSocketPath is the daemon's local control endpoint (unix socket on Linux/macOS). Windows uses a named pipe instead (see the daemon package).
func DaemonTokenPath ¶ added in v0.15.0
DaemonTokenPath is the per-user token file authenticating control requests. It sits next to config.json (0700 dir) and is written 0600.
func DecryptStream ¶
DecryptStream reads any format this package has ever written. The version byte decides how much header follows it and which key the chunks were sealed under, so a ciphertext written years ago still opens.
func DefaultExpiry ¶
func DefaultExpiry() string
DefaultExpiry is what to send as expires_in when the user did not ask for a duration. EMPTY MEANS "let the server decide", which is the correct answer: the expiry policy is the plan's, the server already holds it (default_expiry_hours), and expiry.Validate applies it when the request names nothing.
It used to return "7d". That was a client guessing at a server policy, and on 2026-09-16 the guess became wrong: the Free plan's maximum dropped to 48h, so every default CLI upload was refused with expiry_denied -- the whole free tier broken by a constant in the client. Found by a two-node container test doing an ordinary `s2u <file> --device <name>`.
SHARE2US_DEFAULT_EXPIRY still overrides, for anyone who wants a fixed value.
func DeleteCredential ¶
func DeleteCredential() error
func DownloadGatewayURL ¶
func DownloadsDir ¶ added in v0.33.0
func DownloadsDir() string
DownloadsDir resolves the user's Downloads folder: $XDG_DOWNLOAD_DIR when set (Linux), otherwise ~/Downloads, which also covers %USERPROFILE%\Downloads on Windows. Falls back to "." only when there is no home directory at all.
func DurationForAPI ¶
func EncryptStream ¶
EncryptStream writes the (1,3) format: a random per-stream salt in the header, a stream key derived from it, and a pure counter nonce. The data key may be used for as many streams as the caller likes.
func EnvAPIToken ¶
func EnvAPIToken() string
EnvAPIToken returns the trimmed value of SHARE2US_API_TOKEN, or "" if unset. When non-empty it takes precedence over the on-disk device credential.
func ExpiryForAPI ¶ added in v0.4.0
ExpiryForAPI translates a user-supplied expiry value into the wire fields for the upload/reshare API. "0", "none", "never", "keep", and "forever" mean the share is kept indefinitely (no expiry): noExpiry=true with an empty duration. Anything else is validated as a positive finite duration via DurationForAPI.
func FileSHA256 ¶
func ForgetAllRetainedKeys ¶ added in v0.33.0
func ForgetAllRetainedKeys() error
ForgetAllRetainedKeys deletes the whole store. Called at logout: these are plaintext data keys for shares this login sent, and a key that cannot be revoked must not outlive the session that created it (§AJ #23).
func ForgetRetainedKey ¶
ForgetRetainedKey drops a retained content key once its share has been delivered.
func FullVersion ¶
func FullVersion() string
func IsAPIToken ¶
IsAPIToken reports whether token is a personal access token. PATs carry no device identity, so device end-to-end features are unavailable with one.
func IsAuthorizationPending ¶
func IsDeviceLimitReached ¶
func IsHighConfidenceSecretRule ¶
IsHighConfidenceSecretRule reports whether a gitleaks rule ID denotes a high-confidence secret. This is the concrete definition of "high confidence" used to hard-block agent uploads.
func KeyFromShareURL ¶
func ListIndexPath ¶
func NewContentKey ¶ added in v0.20.0
NewContentKey returns a fresh 32-byte AES-256 content key for EncryptStream.
func NewDataKey ¶
func NewHopNonce ¶ added in v0.40.0
NewHopNonce returns a random nonce for HopClaims.Nonce.
func NormalizeAPIHost ¶
func NormalizeBaseURL ¶
func NormalizeShareBase ¶
func NormalizeUpdateChannel ¶ added in v0.11.0
NormalizeUpdateChannel canonicalises a channel name ("" means stable).
func OpenBrowser ¶
func OpenSealedContentKey ¶
func OpenSealedForDevice ¶ added in v0.19.0
OpenSealedForDevice opens a payload sealed with SealForDevice using the device's own keypair.
func P2PStreamingEnabled ¶
func P2PStreamingEnabled() bool
P2PStreamingEnabled reports whether this build exposes the P2P commands.
func PendingResealPath ¶
PendingResealPath sits beside credentials.json, via os.UserConfigDir.
It used to build the path from XDG_CONFIG_HOME/HOME directly, which is the bug credentials.go documents: on Windows that is %USERPROFILE%\.config, not %AppData%\Roaming, so this file -- plaintext content keys -- was written to a different, less expected directory than every other piece of CLI state, and was missed by anything that cleaned up the real one (§AJ #23). A file left at the old path is migrated on first use and removed.
func QRIsText ¶
QRIsText reports whether b is safe to embed as QR text — valid UTF-8 with no NUL bytes (the same heuristic used to gate --live text streaming).
func RedactSecretFinding ¶
func RenderQR ¶
RenderQR returns a QR code of content drawn with Unicode half-blocks (two modules per character row) at error-correction level M, with a quiet-zone border. It errors only if content exceeds the absolute QR capacity; callers should enforce QRContentMaxBytes first for scannability.
func ResolveAPIBase ¶
func ResolveBaseURL ¶
func ResolveShareBase ¶
func ResolveUpdateChannel ¶ added in v0.11.0
ResolveUpdateChannel picks the channel for an update check: the env var wins, then the saved config, then stable. An unparseable value falls back to stable rather than failing a passive check.
func RetainContentKey ¶
RetainContentKey records a content key so the share can be re-sealed later. A best-effort helper: a store error is returned but callers may choose to warn-and-continue rather than fail the send (retention is a recovery aid, not core to delivery).
func SaveCacheManifest ¶
func SaveCacheManifest(manifest CacheManifest) error
func SaveCacheManifestAt ¶
func SaveCacheManifestAt(path string, manifest CacheManifest) error
func SaveConfig ¶
func SaveConfigAt ¶
func SaveCredential ¶
func SaveCredential(credential Credential) error
func SaveCredentialAt ¶
func SaveCredentialAt(path string, credential Credential) error
func SaveListIndex ¶
func SaveListIndex(entries []ListIndexEntry) error
func SaveListIndexAt ¶
func SaveListIndexAt(path string, entries []ListIndexEntry) error
func SavePendingReseal ¶
func SavePendingReseal(store PendingResealStore) error
func SaveSourceRegistry ¶
func SaveSourceRegistry(registry SourceRegistry) error
func SaveSourceRegistryAt ¶
func SaveSourceRegistryAt(path string, registry SourceRegistry) error
func SaveTrustList ¶ added in v0.13.0
func SaveTrustList(list LanTrustList) error
SaveTrustList verifies and caches a fetched list so lanid.Lookup can use it. The list was just obtained over the authenticated session, so its account is authoritative: a login saved before credentials carried an account id learns it here; a list for a DIFFERENT account than the one already bound is an error, never a silent rebind.
func SaveUpdateCheckCache ¶
func SaveUpdateCheckCache(cache UpdateCheckCache) error
func SaveUpdateCheckCacheAt ¶
func SaveUpdateCheckCacheAt(path string, cache UpdateCheckCache) error
func SealContentKeyForDevice ¶
func SealForDevice ¶ added in v0.19.0
SealForDevice anonymously seals arbitrary bytes (e.g. an injected prompt) to a target device's public key, so only that device can open it (ADR-036 E2E). The server relays the ciphertext and cannot read it. Unlike SealContentKeyForDevice this places no length constraint on the payload.
func SecretFindingsError ¶
func SetReceiveAuto ¶ added in v0.33.0
SetReceiveAuto records whether arrivals are saved automatically. This is also what ANSWERS the first-arrival question, so calling it with either value stops the prompt from coming back.
func SetReceiveDir ¶ added in v0.33.0
SetReceiveDir stores the receive folder. An empty value clears it, restoring the Downloads default. The path is expanded and made absolute so a later reader is not at the mercy of the working directory that set it.
func ShareBaseFromBaseURL ¶
func ShareURLWithKey ¶
func SleepInterval ¶
func SourceRegistryPath ¶
func UniquePath ¶ added in v0.33.0
UniquePath returns p, or the first "name (n).ext" variant that does not exist.
It is for names the LOCAL USER did not choose: a file name that came from a sender, or from a gateway's Content-Disposition. Writing those straight to disk let a sender pick the name and silently replace whatever was already there -- .bashrc, Makefile, a document being edited -- with no prompt and no way back (§AJ #24). A name the user typed themselves is their own choice and is not routed through here.
func UpdateCheckCachePath ¶
func VerificationURL ¶
func VerificationURL(code DeviceCodeResponse) string
func VerifyHop ¶ added in v0.40.0
VerifyHop checks a hop's signature against the sender's public signing key. It does not check freshness; use VerifyHopFresh on the paths that must refuse a replay, which is all of them that act on a hop.
func VerifyHopFresh ¶ added in v0.40.0
func VerifyHopFresh(c HopClaims, signature, publicKey string, now time.Time, window time.Duration) error
VerifyHopFresh is VerifyHop plus a freshness window around now. A hop issued too long ago is refused as a replay, and one issued too far in the future is refused too — otherwise a sender with a skewed clock (or an attacker) could mint hops that stay "fresh" for as long as they like.
The signature is checked FIRST, so an attacker cannot learn anything about the window by sending unsigned hops with chosen timestamps.
Types ¶
type APIError ¶
type APIError struct {
Status int
Code string
Message string
RequestID string
DeviceLimit *DeviceLimitDetails
}
type APITokenInfo ¶
type APITokenInfo struct {
ID string `json:"id"`
Label string `json:"label"`
Scopes []string `json:"scopes"`
TokenHint string `json:"token_hint"`
ExpiresAt string `json:"expires_at,omitempty"`
}
APITokenInfo is the non-secret metadata of a personal API token.
type AccessControlsRequest ¶
type AgentGrant ¶ added in v0.21.0
type AgentGrant struct {
SenderDeviceID string `json:"sender_device_id"`
ApprovedAt string `json:"approved_at"`
}
AgentGrant is a standing allow held by this device.
type AgentInjectInput ¶ added in v0.18.0
type AgentInjectInput struct {
TargetDeviceID string `json:"target_device_id"`
TargetSessionID string `json:"target_session_id"`
Tool string `json:"tool"`
SealedPrompt string `json:"sealed_prompt"`
ObjectKey string `json:"object_key,omitempty"`
SealedFileKey string `json:"sealed_file_key,omitempty"`
// GoalID makes this a counted hop against a goal's budget instead of an ask.
GoalID string `json:"goal_id,omitempty"`
// The signed envelope; required on every hop (ADR-041 §5).
Signature string `json:"signature,omitempty"`
IssuedAt string `json:"issued_at,omitempty"`
Nonce string `json:"nonce,omitempty"`
// ProjectID and SenderAgentID let a hop reach an agent in ANOTHER account
// (ADR-041 §2a): both agents must be accepted members of this project, and
// the sending agent must run on this device. SenderAgentID alone also lets a
// same-account hop spend a project goal owned by another account.
ProjectID string `json:"project_id,omitempty"`
SenderAgentID string `json:"sender_agent_id,omitempty"`
// TargetAgentID is the agent the sender means to reach (signed, v2). The
// server refuses the hop if the target session is not that agent.
TargetAgentID string `json:"target_agent_id,omitempty"`
}
AgentInjectInput submits a file+prompt for a target session. SealedPrompt (and SealedFileKey) are sealed to the target device's key by the caller (E2E).
type AgentInjectResult ¶ added in v0.18.0
type AgentInjectResult struct {
ID string `json:"id"`
Status string `json:"status"` // "queued" or "pending"
TargetStatus string `json:"target_status"`
Busy bool `json:"busy"`
}
AgentInjectResult is the server's response to an inject.
type AgentInjectState ¶ added in v0.18.0
type AgentInjectState struct {
ID string `json:"id"`
Status string `json:"status"`
Result string `json:"result"`
}
AgentInjectState is a sender's view of a request's progress.
type AgentInvite ¶ added in v0.42.0
type AgentInvite struct {
ID string `json:"id"`
AgentID string `json:"agent_id"`
Function string `json:"function"`
Pending bool `json:"pending"`
InvitedAt string `json:"invited_at"`
AcceptedAt string `json:"accepted_at,omitempty"`
ProjectID string `json:"project_id"`
ProjectName string `json:"project_name"`
}
AgentInvite is an invitation for one of this account's agents to join a project, or (Pending false) a membership it already holds.
type AgentJoinResult ¶ added in v0.43.0
type AgentJoinResult struct {
// Status is "pending" (a host must approve in the portal) or "admitted".
Status string `json:"status"`
RequestID string `json:"request_id,omitempty"`
ProjectName string `json:"project_name"`
}
AgentJoinResult is what redeeming a join code did (phase-7 §10).
type AgentRegisterInput ¶ added in v0.18.0
type AgentRegisterInput struct {
// AgentID is the stable identity of the agent behind this session (ADR-041
// §1a): created by `s2u agent bind`, kept in the binding, and unchanged across
// the session forks and recreations that rotate SessionID. Invitations into
// another owner's project are granted against it, not against a session.
AgentID string `json:"agent_id,omitempty"`
SessionID string `json:"session_id"`
Tool string `json:"tool"`
Name string `json:"name"`
Project string `json:"project"`
Status string `json:"status"`
}
AgentRegisterInput registers/heartbeats one live session.
type AgentRequest ¶ added in v0.18.0
type AgentRequest struct {
ID string `json:"id"`
SenderDeviceID string `json:"sender_device_id"`
TargetSessionID string `json:"target_session_id"`
Tool string `json:"tool"`
SealedPrompt string `json:"sealed_prompt"`
// HasFile reports whether a file rides with this request. The storage key is
// deliberately NOT exposed — download by request id with AgentDownloadContent.
HasFile bool `json:"has_file"`
SealedFileKey string `json:"sealed_file_key"`
GoalID string `json:"goal_id"`
CreatedAt string `json:"created_at"`
// The signed envelope (ADR-041 §5). Empty for a hop from a sender that has no
// signing key yet. SenderSigningPublicKey is what the SERVER says the sender's
// key is — a receiver must trust its own pinned copy over this, and treat a
// mismatch as the server lying.
Signature string `json:"signature"`
IssuedAt string `json:"issued_at"`
Nonce string `json:"nonce"`
SenderSigningPublicKey string `json:"sender_signing_public_key"`
// The signed project and agents (v2), which the receiver verifies with the
// rest of the claims. Empty for a hop that names none.
ProjectID string `json:"project_id,omitempty"`
SenderAgentID string `json:"sender_agent_id,omitempty"`
TargetAgentID string `json:"target_agent_id,omitempty"`
}
AgentRequest is a relayed inject request delivered to (or pending on) a target device. The target decrypts SealedPrompt locally with its device key.
type AgentSessionInfo ¶ added in v0.18.0
type AgentSessionInfo struct {
AgentID string `json:"agent_id,omitempty"`
SessionID string `json:"session_id"`
Tool string `json:"tool"`
Name string `json:"name"`
Project string `json:"project"`
Status string `json:"status"`
DeviceID string `json:"device_id"`
DeviceName string `json:"device_name"`
DevicePublicKey string `json:"device_public_key"`
LastSeen string `json:"last_seen"`
}
AgentSessionInfo is a session in the reachable directory.
type AnalyticsTimelinePoint ¶
type CacheEntry ¶
type CacheManifest ¶
type CacheManifest map[string]CacheEntry
func AddCacheEntry ¶
func AddCacheEntry(manifest CacheManifest, publicID string, entry CacheEntry) CacheManifest
func LoadCacheManifest ¶
func LoadCacheManifest() (CacheManifest, error)
func LoadCacheManifestAt ¶
func LoadCacheManifestAt(path string) (CacheManifest, error)
func RemoveCacheEntry ¶
func RemoveCacheEntry(manifest CacheManifest, publicID string) CacheManifest
type Client ¶
func (*Client) AcceptAgentInvite ¶ added in v0.42.0
AcceptAgentInvite admits the invited agent into the project.
func (*Client) AckInboxShare ¶
AckInboxShare tells the server a received share was delivered to this device, so it stops flagging the share for re-seal and the sender can prune its retained content key.
func (*Client) AgentAllow ¶ added in v0.18.0
AgentAllow auto-allows a sender device to inject into this device (target side).
func (*Client) AgentAllowed ¶ added in v0.21.0
func (c *Client) AgentAllowed(ctx context.Context) ([]AgentGrant, error)
AgentAllowed lists the sender devices this device currently grants standing access to.
func (*Client) AgentApproveOnce ¶ added in v0.21.0
AgentApproveOnce approves a single pending request WITHOUT granting the sender standing access (target side).
func (*Client) AgentDownloadContent ¶ added in v0.20.0
AgentDownloadContent streams the ciphertext for a delivered inject request to dst (target side); decrypt it with the content key opened from SealedFileKey.
func (*Client) AgentInject ¶ added in v0.18.0
func (c *Client) AgentInject(ctx context.Context, in AgentInjectInput) (AgentInjectResult, error)
AgentInject submits a file+prompt for a target session.
func (*Client) AgentInjectStatus ¶ added in v0.18.0
AgentInjectStatus reads a request's status/result (sender side).
func (*Client) AgentJoin ¶ added in v0.43.0
AgentJoin redeems a join code for the agent agentID, which must be registered on this device. It files a join request that a host approves in the portal.
func (*Client) AgentLongPoll ¶ added in v0.18.0
AgentLongPoll holds a request open up to waitSeconds and returns any queued requests for this device (target side). The caller should pass a context whose deadline exceeds waitSeconds.
func (*Client) AgentPending ¶ added in v0.18.0
func (c *Client) AgentPending(ctx context.Context) ([]AgentRequest, error)
AgentPending lists inject requests awaiting this device's approval (target side).
func (*Client) AgentReportResult ¶ added in v0.18.0
AgentReportResult reports a request's progress/outcome (target side).
func (*Client) AgentRevoke ¶ added in v0.21.0
AgentRevoke withdraws a sender device's standing access to this device.
func (*Client) AgentUploadContent ¶ added in v0.20.0
AgentUploadContent uploads a ciphertext blob (an encrypted file for an inject) and returns its object key, to pass as AgentInjectInput.ObjectKey.
func (*Client) ApprovePendingInbox ¶
func (*Client) AuthorizeP2PRoom ¶
AuthorizeP2PRoom asks the API for permission to create ("send") or join ("recv") a relay room. The room is only the PUBLIC half of the pairing code — the secret half never leaves this machine.
func (*Client) CheckUpdate ¶
func (c *Client) CheckUpdate(ctx context.Context, version, osName, arch string) (UpdateCheckResponse, error)
CheckUpdate checks the stable channel. See CheckUpdateChannel.
func (*Client) CheckUpdateChannel ¶ added in v0.11.0
func (c *Client) CheckUpdateChannel(ctx context.Context, version, osName, arch, channel string) (UpdateCheckResponse, error)
CheckUpdateChannel asks the server for the newest build on a release channel ("stable" or "beta"; "" means stable).
func (*Client) CloseGoal ¶ added in v0.39.0
CloseGoal ends a goal. Completing one requires evidence — the command that was run and its output — because a completion is a claim about the world; failing and cancelling are outcomes anyone may report.
func (*Client) CompleteUpload ¶
func (*Client) CreateAPIToken ¶
func (c *Client) CreateAPIToken(ctx context.Context, label string, scopes []string, expiresInDays *int) (CreateAPITokenResponse, error)
CreateAPIToken mints a scoped personal API token (ADR-015). Session-only on the server, so the caller must be an interactive login, not another PAT. Pass expiresInDays=nil for no expiry, or a positive day count.
func (*Client) CreateGoal ¶ added in v0.39.0
CreateGoal opens a goal for this account.
func (*Client) CreateReplaceUpload ¶
func (c *Client) CreateReplaceUpload(ctx context.Context, publicID string, upload UploadCreateRequest) (UploadCreateResponse, error)
func (*Client) CreateUpload ¶
func (c *Client) CreateUpload(ctx context.Context, upload UploadCreateRequest) (UploadCreateResponse, error)
func (*Client) DeclineAgentInvite ¶ added in v0.42.0
DeclineAgentInvite refuses the invitation.
func (*Client) DeleteShare ¶
func (*Client) DeleteTeammateSender ¶
func (*Client) DeregisterAgentSession ¶ added in v0.18.0
DeregisterAgentSession removes a session the daemon no longer advertises.
func (*Client) DisableShare ¶
func (*Client) DownloadInboxContent ¶
func (*Client) DownloadURL ¶
func (*Client) EnableShare ¶
func (*Client) ExposeDeviceToContact ¶ added in v0.5.0
ExposeDeviceToContact allows the given contact (by email) to target one of the caller's own devices under the 'approvals' inbound mode.
func (*Client) ExtendExpiry ¶
func (*Client) FlushShare ¶
func (*Client) GetGoal ¶ added in v0.39.0
GetGoal reads one goal, including how much of its budget is spent.
func (*Client) GetOnboarding ¶
func (c *Client) GetOnboarding(ctx context.Context) (OnboardingStatus, error)
func (*Client) GetTeammatePolicy ¶
func (c *Client) GetTeammatePolicy(ctx context.Context) (TeammatePolicy, error)
func (*Client) LanTrustOpen ¶ added in v0.13.0
func (c *Client) LanTrustOpen(ctx context.Context, fingerprint, name, mode string) (LanTrustChallenge, error)
LanTrustOpen opens a trust challenge for a device fingerprint (mode ask|auto). The server delivers the second factor (email OTP, or TOTP when enrolled).
func (*Client) LanTrustRevoke ¶ added in v0.13.0
LanTrustRevoke removes a device from the account's trusted list.
func (*Client) LanTrustSetMode ¶ added in v0.13.0
func (c *Client) LanTrustSetMode(ctx context.Context, fingerprint, mode string) (LanTrustList, error)
LanTrustSetMode downgrades a device to "ask". Upgrading to "auto" must go through LanTrustOpen/LanTrustVerify (the server answers 409 mfa_required here).
func (*Client) LanTrustVerify ¶ added in v0.13.0
func (c *Client) LanTrustVerify(ctx context.Context, challengeID, code string) (LanTrustList, error)
LanTrustVerify submits the code; on success the device is trusted and the signed list is returned. A wrong code is an *APIError with Code "invalid_code" (retry) or "too_many_attempts" / "challenge_not_found" (start over).
func (*Client) LanTrusted ¶ added in v0.13.0
func (c *Client) LanTrusted(ctx context.Context) (LanTrustList, error)
LanTrusted fetches the account's trusted devices and the signed list.
func (*Client) ListAgentInvites ¶ added in v0.42.0
func (c *Client) ListAgentInvites(ctx context.Context) ([]AgentInvite, error)
ListAgentInvites returns invitations addressed to the signed-in account's email and the memberships its agents already hold.
func (*Client) ListAgentSessions ¶ added in v0.18.0
func (c *Client) ListAgentSessions(ctx context.Context) ([]AgentSessionInfo, error)
ListAgentSessions returns the reachable session directory.
func (*Client) ListAgentSessionsIncludingOffline ¶ added in v0.44.0
func (c *Client) ListAgentSessionsIncludingOffline(ctx context.Context) ([]AgentSessionInfo, error)
ListAgentSessionsIncludingOffline is ListAgentSessions plus sessions seen in the last day that have stopped heartbeating, with Status "offline". It is for explaining a failed lookup ("offline since ..."); an offline session is not a target. A server that predates this returns only the reachable sessions.
func (*Client) ListDevices ¶
func (c *Client) ListDevices(ctx context.Context) (ListDevicesResponse, error)
func (*Client) ListExposedDevicesForContact ¶ added in v0.5.0
ListExposedDevicesForContact returns the caller's device session ids currently exposed to the given contact.
func (*Client) ListPendingInbox ¶
func (c *Client) ListPendingInbox(ctx context.Context) (PendingInboxResponse, error)
func (*Client) ListProjectAgents ¶ added in v0.42.0
func (c *Client) ListProjectAgents(ctx context.Context, projectID string) ([]ProjectAgentAddress, error)
ListProjectAgents returns the reachable member agents of a project. Only a device that runs a member agent of the project may ask.
func (*Client) ListProjectAgentsIncludingOffline ¶ added in v0.44.0
func (c *Client) ListProjectAgentsIncludingOffline(ctx context.Context, projectID string) ([]ProjectAgentAddress, error)
ListProjectAgentsIncludingOffline is ListProjectAgents plus member agents seen in the last day that have stopped heartbeating, with Status "offline" (see ListAgentSessionsIncludingOffline).
func (*Client) ListShares ¶
func (c *Client) ListShares(ctx context.Context) (ListSharesResponse, error)
func (*Client) PollDeviceToken ¶
func (*Client) PutLive ¶
func (c *Client) PutLive(ctx context.Context, publicID string, request LivePutRequest) (LivePutResponse, error)
func (*Client) RegisterAgentSession ¶ added in v0.18.0
func (c *Client) RegisterAgentSession(ctx context.Context, in AgentRegisterInput) error
RegisterAgentSession advertises (or heartbeats) a live session.
func (*Client) RegisterDeviceKey ¶
RegisterDeviceKey publishes this device's sealed-box public key, and alongside it the fingerprint of this device's LAN identity.
The fingerprint is what lets the account's OTHER devices recognise this one as a peer they can see on the local network, and hand a file over directly rather than paying to route it through the cloud. Without it the two identities -- a server-side device session and a device card discovered over mDNS or a tailnet -- have nothing in common to match on, so "send to my laptop" uploads even when the laptop is in the same room.
It is sent from here rather than added to the signature because every caller is this device registering itself with its owner's account, and all of them would pass exactly this value. The fingerprint is sha256 of a public key the device already broadcasts in every device card it presents on that network, so publishing it to its own account discloses nothing new. A device with no LAN identity yet sends nothing, and the server treats a missing fingerprint as "cannot be matched locally" rather than an error.
func (*Client) RegisterSigningKey ¶ added in v0.40.0
RegisterSigningKey records this device's Ed25519 signing key with the server. Write-once on the server: the same key again is fine, a different key is refused.
func (*Client) RejectPendingInbox ¶
func (*Client) ReportInstall ¶
func (c *Client) ReportInstall(ctx context.Context, e InstallEvent) error
ReportInstall posts an anonymous install/update ping (unauthenticated).
func (*Client) ResealQueue ¶
func (c *Client) ResealQueue(ctx context.Context) (ResealQueueResponse, error)
ResealQueue lists in-flight shares the caller sent that need re-sealing to a recipient's new device key.
func (*Client) RevokeAllShares ¶
func (c *Client) RevokeAllShares(ctx context.Context) (RevokeAllResponse, error)
func (*Client) RevokeDeviceSession ¶
func (*Client) RevokeDeviceSessionWithDeviceCode ¶
func (*Client) RevokeShare ¶
func (*Client) SetGoalState ¶ added in v0.39.0
SetGoalState records that a goal is waiting for a human, or running again. Terminal states go through CloseGoal, which demands evidence.
func (*Client) SetTeammatePolicy ¶
func (*Client) SetTeammateSender ¶
func (*Client) ShareAnalytics ¶
func (*Client) StartDeviceCode ¶
func (c *Client) StartDeviceCode(ctx context.Context, request ...DeviceCodeRequest) (DeviceCodeResponse, error)
func (*Client) SubmitConsent ¶
SubmitConsent records acceptance of the given terms/data-share version.
func (*Client) SubmitReseal ¶
func (c *Client) SubmitReseal(ctx context.Context, publicID, targetSessionID, sealedKey string) error
SubmitReseal uploads a content key re-sealed to a recipient's new device public key.
func (*Client) TeammateDevices ¶
TeammateDevices fetches the recipient's registered device public keys (the release gate); a disallowed policy returns an APIError with code "recipient_not_accepting"; an unregistered recipient returns Code "recipient_not_registered" with no devices.
func (*Client) UnexposeDeviceFromContact ¶ added in v0.5.0
func (c *Client) UnexposeDeviceFromContact(ctx context.Context, email, deviceSessionID string) error
UnexposeDeviceFromContact revokes a contact's access to one of the caller's devices.
func (*Client) UnlockOwnShare ¶ added in v0.33.0
UnlockOwnShare mints a short-lived gateway unlock token for a share this account OWNS, so the owner can download their own recipient-restricted share without a browser (ADR-022, 2026-09-09 amendment).
The other three verification layers are browser-shaped -- the invite link arrives in a recipient's mailbox, the session hop is a portal form-POST, the code needs an HTML form -- and none of them is reachable from a CLI. This mints the SAME token they produce, for the caller's own email, to be replayed as the gateway's ?u= parameter.
Requires an interactive login: the endpoint is session-only, so a personal API token is refused server-side.
func (*Client) UpdateAccessControls ¶
type Config ¶
type Config struct {
BaseURL string `json:"base_url,omitempty"`
Host string `json:"host,omitempty"`
MachineID string `json:"machine_id,omitempty"`
// InstallID is a random, anonymous id generated once on first run and used
// only for install counting (todo §J.4). Not tied to the account.
InstallID string `json:"install_id,omitempty"`
// InstallReported is set once the one-time install ping has been attempted.
InstallReported bool `json:"install_reported,omitempty"`
// Defaults.Reshare (O-C1); still read for back-compat. nil = unset.
Reshare *bool `json:"reshare,omitempty"`
// Defaults are standing per-user defaults for SAFE upload options (O-C1). Only
// options that can't silently over-expose are defaultable here; an explicit flag
// always overrides. Footgun options (password, one-time, recipients, visibility,
// allow-secrets, device/contact) are deliberately NOT defaultable.
Defaults *UploadDefaults `json:"defaults,omitempty"`
// Devices are saved offline-share destinations, usable as `--dest <name>`.
Devices []DeviceAlias `json:"devices,omitempty"`
// TrustedPeers are alias names or IPs whose inbound offline transfers are
// auto-accepted without a password (security trade-off; set with a warning).
TrustedPeers []string `json:"trusted_peers,omitempty"`
// UpdateChannel is the self-update channel this install follows: "" or
// "stable" (default) or "beta". Set with `update --channel`; the
// SHARE2US_UPDATE_CHANNEL env var overrides it for one run.
UpdateChannel string `json:"update_channel,omitempty"`
// Daemon holds the optional background service settings (ADR-035). nil means
// all defaults; the service is off until installed regardless.
Daemon *DaemonConfig `json:"daemon,omitempty"`
// Receive is where files sent to this device land, and whether they land
// there automatically. Read by `s2u receive`, the desktop tray and the
// daemon alike; supersedes Daemon.DestDir (§AG).
Receive *ReceiveConfig `json:"receive,omitempty"`
}
func LoadConfig ¶
func LoadConfigAt ¶
func (Config) DaemonSettings ¶ added in v0.15.0
func (c Config) DaemonSettings() ResolvedDaemon
DaemonSettings returns the resolved daemon settings with defaults applied, so callers never have to nil-check. Off-by-default is a property of whether the service is installed, not of these values: once running, LAN and notifications default on and approvals default strict.
func (*Config) DeleteDeviceAlias ¶
DeleteDeviceAlias removes an alias, returning whether one was removed.
func (*Config) DeleteTrustedPeer ¶
DeleteTrustedPeer removes a trusted ref, returning whether one was removed.
func (Config) ReceiveSettings ¶ added in v0.33.0
func (c Config) ReceiveSettings() ResolvedReceive
ReceiveSettings resolves the receive settings with defaults applied.
Precedence for the directory: an explicit argument (handled by the caller) > receive.dir > the legacy daemon.dest_dir > the Downloads folder. ~/Downloads stays the default deliberately (owner, 2026-09-09): it is what already ships, so nobody's files move and there is nothing to migrate.
func (Config) ResolveDeviceAlias ¶
ResolveDeviceAlias returns the saved address for an alias name.
func (Config) ResolvedReshareDefault ¶
ResolvedReshareDefault returns the standing reshare default, preferring the new Defaults.Reshare and falling back to the legacy top-level Reshare (O-C1 migration).
func (*Config) SetDeviceAlias ¶
SetDeviceAlias adds or updates an alias (case-insensitive name match).
func (*Config) SetTrustedPeer ¶
SetTrustedPeer marks an alias name or IP as trusted (deduplicated).
func (Config) TrustedIPs ¶
TrustedIPs resolves every trusted ref to a bare IP: literal IPs pass through, alias names resolve to their saved address's host. Non-resolvable refs are skipped. These IPs auto-accept inbound offline transfers without a password.
type CreateAPITokenResponse ¶
type CreateAPITokenResponse struct {
Token string `json:"token"`
APIToken APITokenInfo `json:"api_token"`
}
CreateAPITokenResponse carries the raw token (shown exactly once) plus metadata.
type Credential ¶
type Credential struct {
SchemaVersion int `json:"schema_version,omitempty"`
APIBase string `json:"api_base"`
Token string `json:"token"`
Email string `json:"email"`
// AccountID binds the cached trusted-device list to this login (§AJ #10).
// Set at login; learned from the first verified list for older logins.
AccountID string `json:"account_id,omitempty"`
DeviceSessionID string `json:"device_session_id,omitempty"`
DevicePublicKey string `json:"device_public_key,omitempty"`
DevicePrivateKey string `json:"device_private_key,omitempty"`
// The device's Ed25519 SIGNING key (ADR-041 §5), separate from the X25519
// encryption key above: one key doing both jobs invites cross-protocol attacks.
DeviceSigningPublicKey string `json:"device_signing_public_key,omitempty"`
DeviceSigningPrivateKey string `json:"device_signing_private_key,omitempty"`
}
func LoadCredential ¶
func LoadCredential() (Credential, error)
func LoadCredentialAt ¶
func LoadCredentialAt(path string) (Credential, error)
type DaemonConfig ¶ added in v0.15.0
type DaemonConfig struct {
// DestDir is where received files land. "" = the platform Downloads dir.
//
// DEPRECATED (§AG): superseded by Config.Receive.Dir, which every receiver
// reads — this one was honoured only by the daemon. Still read as a fallback
// so an existing daemon install keeps saving where it always has; setting a
// receive dir clears it. See Config.ReceiveSettings.
DestDir string `json:"dest_dir,omitempty"`
// LANDiscoverable enables the background LAN receiver. nil = default (on).
LANDiscoverable *bool `json:"lan_discoverable,omitempty"`
// Notify enables native desktop notifications. nil = default (on).
Notify *bool `json:"notify,omitempty"`
// ApprovalPolicy is one of ApprovalPolicyStrict (default) or
// ApprovalPolicyNotifyWait.
ApprovalPolicy string `json:"approval_policy,omitempty"`
}
DaemonConfig is the per-user configuration for the optional background service (`share2us daemon`, ADR-035). It lives as the "daemon" section of Config so the CLI and the GUI read one source of truth. Every field is a pointer or defaults to a compiled-in value when unset, so an absent section means "all defaults".
type DeviceAlias ¶
DeviceAlias maps a friendly name to an offline-share address (ip[:port] or an s2u:// pairing string). Used by `s2u config set device alias` and `--dest`.
type DeviceCodeRequest ¶
type DeviceCodeResponse ¶
type DeviceKeyPair ¶
func NewDeviceKeyPair ¶
func NewDeviceKeyPair() (DeviceKeyPair, error)
type DeviceLimitDetails ¶
type DeviceLimitDetails struct {
Limit int `json:"limit"`
Sessions []DeviceSession `json:"sessions"`
}
func DeviceLimitDetailsFromError ¶
func DeviceLimitDetailsFromError(err error) (DeviceLimitDetails, bool)
type DeviceMetadata ¶
type DeviceMetadata struct {
DeviceName string
MachineID string
OS string
Arch string
Hostname string
}
func DetectDeviceMetadata ¶
func DetectDeviceMetadata(deviceName string) (DeviceMetadata, error)
type DeviceRef ¶ added in v0.37.0
type DeviceRef struct {
// SessionID identifies the device server-side; it is echoed back in the match
// so the caller can pair the answer with whatever else it holds.
SessionID string
// LanFingerprint is the device's stable LAN identity fingerprint, from the
// device list. Empty means "not matchable" and is not an error.
LanFingerprint string
}
DeviceRef is the minimum a caller must know about one of its own devices to ask whether it is reachable locally.
type DeviceSession ¶
type DeviceSession struct {
ID string `json:"id"`
DeviceName string `json:"device_name"`
MachineID string `json:"machine_id"`
ClientType string `json:"client_type"`
PublicKey string `json:"public_key"`
// LanFingerprint is sha256 of this device's LAN identity public key, as
// lanshare.IdentityFingerprint emits it. It is what lets a sender recognise
// that a device in the account's list is ALSO answering on this network right
// now, and hand the file over directly instead of paying to route it through
// the cloud. Empty means the device cannot be matched locally: a browser
// session, or a client that does not publish one.
LanFingerprint string `json:"lan_fingerprint"`
CreatedAt string `json:"created_at"`
LastUsedAt string `json:"last_used_at"`
ExpiresAt string `json:"expires_at"`
Current bool `json:"current"`
}
type DeviceTokenResponse ¶
type Goal ¶ added in v0.39.0
type Goal struct {
ID string `json:"id"`
Project string `json:"project"`
Objective string `json:"objective"`
Acceptance string `json:"acceptance"`
Branch string `json:"branch"`
State string `json:"state"`
HopCap int32 `json:"hop_cap"`
// HopsUsed is -1 in a listing: counting per goal would be one query each, so
// only the single-goal read carries it.
HopsUsed int64 `json:"hops_used"`
ExpiresAt string `json:"expires_at"`
RiskCeiling int16 `json:"risk_ceiling"`
CreatedByAgent string `json:"created_by_agent"`
CreatedAt string `json:"created_at"`
Live bool `json:"live"`
CloseReason string `json:"close_reason,omitempty"`
CloseEvidence string `json:"close_evidence,omitempty"`
ClosedAt string `json:"closed_at,omitempty"`
}
Goal is a unit of autonomous work: what is being attempted, how it is known to be finished, and what it may spend. Hops belong to one; an ask does not.
type HopClaims ¶ added in v0.40.0
type HopClaims struct {
SenderDeviceID string
TargetDeviceID string
TargetSessionID string
Tool string
SealedPrompt string
SealedFileKey string
GoalID string
IssuedAt time.Time
Nonce string
// v2: empty for a hop that names no project / no agent.
ProjectID string
SenderAgentID string
TargetAgentID string
}
HopClaims is everything a hop's signature covers. Anything that changes what the receiver does or where the hop goes is here, so that none of it can be rewritten in transit:
- who sent it, and to which device, session and tool (so a hop cannot be redirected to a different agent);
- the sealed prompt, and the attachment's sealed content key (so neither can be swapped — see below for why the key rather than the object);
- the goal it is counted against (so it cannot be moved onto another budget);
- the project it is sent in, the sending agent and the target agent (v2), so a server cannot relabel which project a hop belongs to or which of a device's agents sent it;
- when it was issued and a nonce (so it cannot be replayed, Q121).
The attachment is bound by its SEALED CONTENT KEY, not by its storage object key, and that is deliberate. The receiver is never given the object key — it downloads by request id, so bucket paths do not leak to clients — which means a signature over the object key could not be checked by the one party whose check matters. It does not need to be: the file is encrypted with an AEAD under that content key, the key is sealed to the receiver and covered here, so a server that swaps in a different object gets a decryption failure, not a substitution.
func (HopClaims) SigningBytes ¶ added in v0.40.0
SigningBytes is the exact byte string a hop signature covers.
Every field is length-prefixed, in a fixed order, after a domain tag. That makes the encoding unambiguous: with a delimiter instead, ("ab","c") and ("a","bc") could serialize identically and one signature would cover both. The time is whole Unix seconds, so the bytes do not depend on how either side formats or rounds a timestamp.
type InboxResponse ¶
type InboxResponse struct {
}
type InboxShare ¶
type InboxShare struct {
}
type InstallEvent ¶
type InstallEvent struct {
InstallID string `json:"install_id"`
EventType string `json:"event_type,omitempty"`
Version string `json:"version,omitempty"`
OS string `json:"os,omitempty"`
Arch string `json:"arch,omitempty"`
}
InstallEvent is an anonymous install/update telemetry ping (todo §J.4).
type LanTrustChallenge ¶ added in v0.13.0
type LanTrustChallenge struct {
ChallengeID string `json:"challenge_id"`
Factor string `json:"factor"` // "email" | "totp"
SentTo string `json:"sent_to,omitempty"` // masked email (email factor)
ExpiresIn int `json:"expires_in"`
VerifyCode string `json:"verify_code"` // the device's 6-digit code, for the human to compare
}
LanTrustChallenge is the server's answer to a trust request: which factor it chose and where the code went. Nothing is trusted until LanTrustVerify.
type LanTrustList ¶ added in v0.13.0
type LanTrustList struct {
Devices []LanTrustedDevice `json:"devices"`
Signed lanid.SignedTrustList `json:"signed"`
PublicKey string `json:"public_key"`
}
LanTrustList is the account's trusted devices plus the signed copy to cache.
type LanTrustedDevice ¶ added in v0.13.0
type LanTrustedDevice struct {
Fingerprint string `json:"fingerprint"`
Name string `json:"name"`
Mode string `json:"mode"`
ApprovedVia string `json:"approved_via"`
}
LanTrustedDevice is one trusted device as the server reports it.
type ListDevicesResponse ¶
type ListDevicesResponse struct {
Sessions []DeviceSession `json:"sessions"`
}
type ListIndexEntry ¶
type ListIndexEntry struct {
Serial int `json:"serial"`
PublicID string `json:"public_id"`
FileName string `json:"file_name"`
}
func LoadListIndex ¶
func LoadListIndex() ([]ListIndexEntry, error)
func LoadListIndexAt ¶
func LoadListIndexAt(path string) ([]ListIndexEntry, error)
type ListSharesResponse ¶
type ListSharesResponse struct {
}
type LiveFlushResponse ¶
type LivePutRequest ¶
type LivePutResponse ¶
type LocalMatch ¶ added in v0.37.0
type LocalMatch struct {
SessionID string
Peer lanshare.ScannedPeer
}
LocalMatch pairs one of the account's devices with the peer answering for it on this network right now.
func MatchLocalDevices ¶ added in v0.37.0
func MatchLocalDevices(ctx context.Context, devices []DeviceRef, opts MatchOptions) ([]LocalMatch, error)
MatchLocalDevices reports which of devices are reachable directly right now.
A device appears in the result ONLY when a peer on this network presented a verified device card whose stable identity fingerprint equals that device's lan_fingerprint. That is a cryptographic match on a key the peer proved it holds, not a match on a name: names are self-chosen and collide, which is exactly why the fingerprint exists.
AN EMPTY RESULT IS THE NORMAL ANSWER, not a failure. A device is only discoverable while it is actually listening for a transfer — the desktop app with "discoverable on local network" on, or the daemon running. A laptop that is merely signed in does not answer a probe, and the correct behaviour then is to fall back to the cloud, not to report an error at the user.
A scan error is likewise reported as "no local match" rather than propagated: a send must never fail because discovery did. The error is returned alongside the (empty) matches so a caller that wants to log it can, and callers that just want a routing answer can ignore it.
type MatchOptions ¶ added in v0.37.0
type MatchOptions struct {
// Timeout per host for dial + handshake. Default 400ms, matching the desktop
// app's routine discovery pass.
Timeout time.Duration
// SkipLocalSubnets probes only tailnet peers. Useful for a cheap pass when a
// subnet sweep would be too slow or too noisy for the moment.
SkipLocalSubnets bool
// contains filtered or unexported fields
}
MatchOptions bounds the discovery a routing decision is allowed to cost.
type MeResponse ¶
type MeResponse struct {
AccountID string `json:"account_id"`
UserID string `json:"user_id"`
Email string `json:"email"`
PlanID string `json:"plan_id"`
PlanName string `json:"plan_name"`
Source string `json:"source"`
Scopes []string `json:"scopes,omitempty"`
// MCPEnabled is the hosted-MCP kill-switch (plan entitlement AND the global
// flag). A pointer so an older API that omits the field is treated as enabled
// (nil), leaving the per-scope checks to gate access.
MCPEnabled *bool `json:"mcp_enabled,omitempty"`
}
type NewGoal ¶ added in v0.39.0
type NewGoal struct {
Project string `json:"project"`
Objective string `json:"objective"`
Acceptance string `json:"acceptance,omitempty"`
Branch string `json:"branch,omitempty"`
HopCap int32 `json:"hop_cap"`
TimeCapSecs int64 `json:"time_cap_seconds"`
RiskCeiling int16 `json:"risk_ceiling,omitempty"`
// CreatedByAgent names the agent session when an agent opens a sub-goal; the
// human is taken from the authenticated session, never from here.
CreatedByAgent string `json:"created_by_agent,omitempty"`
}
NewGoal opens a goal. Both ceilings are required by the server, deliberately: a goal with no budget is unbounded work, so there is no default to fall back on.
type OnboardingStatus ¶
type OnboardingStatus struct {
Onboarded bool `json:"onboarded"`
ConsentRequired bool `json:"consent_required"`
ConsentVersion string `json:"consent_version"`
}
OnboardingStatus reports whether the account has completed onboarding and whether the current terms/data-share consent still needs accepting.
type P2PICEServer ¶
type P2PICEServer struct {
URLs []string `json:"urls"`
Username string `json:"username,omitempty"`
Credential string `json:"credential,omitempty"`
}
P2PICEServer is a STUN/TURN server with time-limited credentials, issued by the room-authorization endpoint.
type P2PRoomAuth ¶
type P2PRoomAuth struct {
Room string `json:"room"`
Role string `json:"role"`
Token string `json:"token"`
ExpiresAt string `json:"expires_at"`
RelayURL string `json:"relay_url"`
ICEServers []P2PICEServer `json:"ice_servers"`
}
P2PRoomAuth is the API's authorization for one relay room. The API is where the p2p_streaming_enabled entitlement is actually enforced — the relay only verifies the signature on the token minted here (ADR-019).
type PendingInboxResponse ¶
type PendingInboxResponse struct {
}
type PendingInboxShare ¶
type PendingInboxShare struct {
}
type PendingResealEntry ¶
type PendingResealStore ¶
type PendingResealStore map[string]PendingResealEntry
PendingResealStore maps a share's public id to its retained content key.
func LoadPendingReseal ¶
func LoadPendingReseal() (PendingResealStore, error)
LoadPendingReseal reads the retained-key store, returning an empty (non-nil) store when the file does not exist yet. TTL-expired entries are dropped on read.
type PresignedUpload ¶
type ProjectAgentAddress ¶ added in v0.42.0
type ProjectAgentAddress struct {
AgentID string `json:"agent_id"`
Function string `json:"function"`
SessionID string `json:"session_id"`
Tool string `json:"tool"`
Status string `json:"status"`
DeviceID string `json:"device_id"`
DevicePublicKey string `json:"device_public_key"`
LastSeen string `json:"last_seen"`
// Yours marks this account's own agents.
Yours bool `json:"yours"`
}
ProjectAgentAddress is where a project's member agent can be reached: the session to target and the device key to seal the prompt to.
type ReceiveConfig ¶ added in v0.33.0
type ReceiveConfig struct {
// Dir is where received files are saved. "" = the platform Downloads dir.
Dir string `json:"dir,omitempty"`
// Auto decides whether an arrival is written to Dir by itself.
//
// A POINTER because "not answered yet" is a real, distinct state: the default
// is to ASK on the first arrival (owner, 2026-09-09), which a plain bool
// cannot express — false would silently mean "no" and never prompt. nil means
// unanswered.
Auto *bool `json:"auto,omitempty"`
}
ReceiveConfig is where files sent to this device land, and whether they land there by themselves. It is the ONE place all three receivers read (§AG):
- `s2u receive` used to default to the CURRENT WORKING DIRECTORY, so files ended up wherever the shell happened to be.
- the desktop tray hardcoded the Downloads folder.
- the daemon read `daemon.dest_dir`, which nothing else honoured.
Three behaviours, one of them a bug, and no way to change any of them. Dir now supersedes DaemonConfig.DestDir, which is still read so an existing daemon install keeps working.
type ResealEntry ¶
type ResealEntry struct {
RecipientEmail string `json:"recipient_email"`
TargetSessionID string `json:"target_session_id"`
PublicKey string `json:"public_key"`
}
ResealEntry is one item in the sender's re-seal queue: an in-flight share whose recipient re-keyed. The sender re-seals the retained content key to PublicKey and submits it against TargetSessionID (Option B, docs/design/teammate-phase-c.md §2).
type ResealQueueResponse ¶
type ResealQueueResponse struct {
Requests []ResealEntry `json:"requests"`
}
type ResolvedDaemon ¶ added in v0.15.0
type ResolvedDaemon struct {
DestDir string
LANDiscoverable bool
Notify bool
ApprovalPolicy string
}
ResolvedDaemon is DaemonConfig with defaults filled in.
type ResolvedReceive ¶ added in v0.33.0
type ResolvedReceive struct {
Dir string
// Auto is the effective setting; AutoAnswered says whether a human ever chose
// it. A caller that can prompt should ask when AutoAnswered is false rather
// than act on Auto's zero value.
Auto bool
AutoAnswered bool
}
ResolvedReceive is ReceiveConfig with the fallbacks applied.
type RevokeAllResponse ¶
type RevokeAllResponse struct {
Revoked uint64 `json:"revoked"`
}
type SecretFinding ¶
type SecretFinding struct {
RuleID string
Description string
Line int
Redacted string
// Entropy is the gitleaks Shannon entropy of the match (0 when the rule is
// not entropy-based); exposed for future tuning.
Entropy float32
// HighConfidence is true for named, high-precision credential rules (private
// keys, cloud/provider tokens) — the class that agent/MCP uploads HARD-block.
HighConfidence bool
}
type SecretScanOptions ¶
type SecretScanOptions struct {
MaxBytes int64
}
type SecretScanResult ¶
type SecretScanResult struct {
Findings []SecretFinding
Skipped bool
SkipReason string
ScannedBytes int64
Truncated bool
}
func ScanBytesForSecrets ¶
func ScanBytesForSecrets(content []byte, opts SecretScanOptions) (SecretScanResult, error)
ScanBytesForSecrets runs the same gitleaks scan over an in-memory buffer (e.g. the text of a `share_text` upload, which has no file on disk). Same skip rules (binary/non-UTF8) and byte cap as ScanFileForSecrets.
func ScanFileForSecrets ¶
func ScanFileForSecrets(path string, opts SecretScanOptions) (SecretScanResult, error)
func (SecretScanResult) HasHighConfidenceSecret ¶
func (r SecretScanResult) HasHighConfidenceSecret() bool
HasHighConfidenceSecret reports whether any finding is a high-confidence secret.
type ShareAccessEvent ¶
type ShareAccessEvent struct {
}
type ShareAnalyticsResponse ¶
type ShareAnalyticsResponse struct {
}
type ShareRef ¶
type ShareRef struct {
// server -- not what was requested. A POINTER on purpose: nil means the
// server did not say (it predates the field), which a caller that asked for a
// private share must treat as "I did not get one", because an older server
// ignores visibility and returns a public link with a 201.
RecipientRestricted *bool `json:"recipient_restricted,omitempty"`
}
func (ShareRef) IsPrivate ¶ added in v0.33.0
IsPrivate reports whether the created share is recipient-restricted, and whether the server actually said so. Callers that requested a private share must check `known`: an unknown answer is not a "no", it is an older server that silently made the share PUBLIC.
type SigningKeyPair ¶ added in v0.40.0
type SigningKeyPair struct {
PublicKey string `json:"public_key"`
PrivateKey string `json:"private_key"`
}
SigningKeyPair is a device's Ed25519 signing identity, base64-encoded like the existing device encryption keys. It is separate from the X25519 key pair: reusing one key for both encryption and signing is a classic way to get a cross-protocol attack, and the two have different lifetimes anyway.
func NewSigningKeyPair ¶ added in v0.40.0
func NewSigningKeyPair() (SigningKeyPair, error)
NewSigningKeyPair creates a fresh device signing key.
type SourceRegistry ¶
type SourceRegistry map[string]SourceRegistryEntry
func AddSourceRegistryEntry ¶
func AddSourceRegistryEntry(registry SourceRegistry, absPath string, entry SourceRegistryEntry) SourceRegistry
func LoadSourceRegistry ¶
func LoadSourceRegistry() (SourceRegistry, error)
func LoadSourceRegistryAt ¶
func LoadSourceRegistryAt(path string) (SourceRegistry, error)
type SourceRegistryEntry ¶
type TeammateDevice ¶
type TeammateDeviceList ¶
type TeammateDeviceList struct {
Mode string `json:"mode"`
Code string `json:"code"`
Devices []TeammateDevice `json:"devices"`
}
type TeammatePolicy ¶
type TeammatePolicy struct {
Mode string `json:"mode"`
Senders []TeammateSenderPref `json:"senders"`
}
type TeammateSenderPref ¶
type UpdateCheckCache ¶
type UpdateCheckCache struct {
LastCheckedAt time.Time `json:"last_checked_at"`
LatestVersion string `json:"latest_version,omitempty"`
}
func LoadUpdateCheckCache ¶
func LoadUpdateCheckCache() (UpdateCheckCache, error)
func LoadUpdateCheckCacheAt ¶
func LoadUpdateCheckCacheAt(path string) (UpdateCheckCache, error)
type UpdateCheckResponse ¶
type UpdateCheckResponse struct {
CurrentVersion string `json:"current_version"`
LatestVersion string `json:"latest_version"`
UpdateAvailable bool `json:"update_available"`
Platform string `json:"platform"`
// Channel is the channel the server answered for ("stable" or "beta");
// Prerelease is true when the offered build is a beta (prerelease).
Channel string `json:"channel,omitempty"`
Prerelease bool `json:"prerelease,omitempty"`
Downloads UpdateDownloads `json:"downloads"`
}
type UpdateDownloads ¶
type UploadCompleteResponse ¶
type UploadCreateRequest ¶
type UploadCreateRequest struct {
FileName string `json:"file_name"`
SizeBytes uint64 `json:"size_bytes"`
ContentClass string `json:"content_class,omitempty"`
ContentType string `json:"content_type,omitempty"`
ExpiresIn string `json:"expires_in,omitempty"`
// NoExpiry keeps the share indefinitely (no expiry). When true, ExpiresIn is
// ignored server-side. See --keep / --expires=none.
NoExpiry bool `json:"no_expiry,omitempty"`
SHA256 string `json:"sha256,omitempty"`
SourceRef string `json:"source_ref,omitempty"`
New bool `json:"new"`
Password string `json:"password,omitempty"`
OneTime bool `json:"one_time,omitempty"`
Encrypted bool `json:"encrypted,omitempty"`
EncryptionAlgo string `json:"encryption_algo,omitempty"`
Recipients []string `json:"recipients,omitempty"`
// Visibility is "private" for a share only the owner's account can open, or
// "" for the default (public). A PRIVATE share needs no recipients: the
// gateway admits the recipient list OR an active user of the owning account,
// so an empty list is exactly "only me" (ADR-022). Older servers ignore the
// field and produce a public share, so a client that must not create a public
// link should verify the result rather than assume.
Visibility string `json:"visibility,omitempty"`
MaxViews uint64 `json:"max_views,omitempty"`
AllowedDomains []string `json:"allowed_domains,omitempty"`
DeniedDomains []string `json:"denied_domains,omitempty"`
Live bool `json:"live,omitempty"`
TargetDevice string `json:"target_device,omitempty"`
SealedKey string `json:"sealed_key,omitempty"`
RecipientEmail string `json:"recipient_email,omitempty"`
Targets []UploadTarget `json:"targets,omitempty"`
// Source declares the client origin for audit attribution; only "mcp" is
// honored server-side (an AI-agent upload).
Source string `json:"source,omitempty"`
// (ADR-024, --unrestrict). Pointer so an unset value omits the field and the
// server default (false) applies; ignored for public shares.
AllowReshare *bool `json:"allow_reshare,omitempty"`
// Note is a short message the sharer attaches, shown to viewers on the share
// page.
Note string `json:"note,omitempty"`
}
type UploadCreateResponse ¶
type UploadCreateResponse struct {
Upload PresignedUpload `json:"upload"`
UploadSessionID string `json:"upload_session_id"`
ExpiresAt string `json:"expires_at"`
Link string `json:"link"`
SkippedUpload bool `json:"skipped_upload"`
}
type UploadDefaults ¶
type UploadDefaults struct {
Expires *string `json:"expires,omitempty"`
Encrypt *bool `json:"encrypt,omitempty"`
MaxViews *uint64 `json:"max_views,omitempty"`
NoScan *bool `json:"no_scan,omitempty"`
AllowedDomains []string `json:"allowed_domains,omitempty"`
DeniedDomains []string `json:"denied_domains,omitempty"`
}
UploadDefaults holds tri-state standing defaults for upload options. A nil pointer / nil slice means "unset" (fall through to the compiled/server default).
func (*UploadDefaults) IsEmpty ¶
func (d *UploadDefaults) IsEmpty() bool
IsEmpty reports whether every standing default is unset, so callers can drop the Defaults object entirely (keeping `"defaults": {}` out of config.json).
type UploadTarget ¶
type UsageResponse ¶
type UsageResponse struct {
StorageUsedBytes uint64 `json:"storage_used_bytes"`
StorageQuotaBytes uint64 `json:"storage_quota_bytes"`
MonthlyUploadBytes uint64 `json:"monthly_upload_bytes"`
MonthlyUploadLimitBytes uint64 `json:"monthly_upload_limit_bytes"`
MaxFileSizeBytes uint64 `json:"max_file_size_bytes"`
DefaultExpiryHours uint64 `json:"default_expiry_hours"`
MaximumExpiryHours uint64 `json:"maximum_expiry_hours"`
AllowedContentClasses []string `json:"allowed_content_classes"`
PasswordProtection bool `json:"password_protection_enabled"`
OneTimeDownload bool `json:"one_time_download_enabled"`
ClientSideEncryption bool `json:"client_side_encryption_enabled"`
}
Source Files
¶
- agent.go
- agent_projects.go
- apitoken.go
- browser.go
- cache.go
- client.go
- config.go
- contentclass.go
- core.go
- credentials.go
- crypto.go
- crypto_sign.go
- daemon_config.go
- device.go
- device_linux.go
- duration.go
- lanroute.go
- localshare_config.go
- pending_reseal.go
- qr.go
- receive_config.go
- secretscan.go
- tips.go
- trust_binding.go
- uniquepath.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package daemonctl is the local control channel for the optional background service (ADR-035).
|
Package daemonctl is the local control channel for the optional background service (ADR-035). |
|
internal
|
|
|
proc
Package proc holds the small platform differences in how a helper command is launched.
|
Package proc holds the small platform differences in how a helper command is launched. |
|
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.
|
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. |
|
Package lanshare implements Share2Us's offline, account-free, direct peer-to-peer file transfer over a LAN / Tailscale / WireGuard / any reachable IP.
|
Package lanshare implements Share2Us's offline, account-free, direct peer-to-peer file transfer over a LAN / Tailscale / WireGuard / any reachable IP. |
|
Package p2p implements the Share2Us peer-to-peer streaming transport (Phase 3): a single ordered/reliable WebRTC data channel between two peers, with SDP/ICE signaling brokered by a lightweight relay WebSocket.
|
Package p2p implements the Share2Us peer-to-peer streaming transport (Phase 3): a single ordered/reliable WebRTC data channel between two peers, with SDP/ICE signaling brokered by a lightweight relay WebSocket. |