authkey

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const AuthKeyHeader = "X-AuthKey"
View Source
const AuthKeyQueryParam = "authkey"

AuthKeyQueryParam carries the key for requests that cannot set a header.

Under Electron every request gets X-AuthKey injected by a session.webRequest handler. Neither Tauri nor Wails can do that, so subresource loads a webview issues on its own — <img>, <video>, markdown images, streaming preview — have no way to present a header. Those URLs carry the key as a query parameter instead.

View Source
const WaveAuthKeyEnv = "SLTERM_AUTH_KEY"

Variables

This section is empty.

Functions

func GetAuthKey

func GetAuthKey() string

func SetAuthKeyFromEnv

func SetAuthKeyFromEnv() error

func ValidateIncomingRequest

func ValidateIncomingRequest(r *http.Request) error

ValidateIncomingRequest accepts the key from either the header or the query parameter. The comparison is constant-time: the key is a shared secret and a byte-wise early return leaks its prefix to anything that can time requests to the loopback listener.

Types

This section is empty.

Jump to

Keyboard shortcuts

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