permissionspolicy

package
v0.0.0-...-614c6bf Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package permissionspolicy provides simple tools to create and modify a Permissions Policy.

Index

Constants

View Source
const (
	HeaderName = "Permissions-Policy"

	Accelerometer              = "accelerometer"
	AmbientLightSensor         = "ambient-light-sensor"
	AttributionReporting       = "attribution-reporting"
	Autoplay                   = "autoplay"
	Bluetooth                  = "bluetooth"
	BrowsingTopics             = "browsing-topics"
	Camera                     = "camera"
	ComputePressure            = "compute-pressure"
	CrossOriginIsolated        = "cross-origin-isolated"
	DisplayCapture             = "display-capture"
	DocumentDomain             = "document-domain"
	EncryptedMedia             = "encrypted-media"
	Fullscreen                 = "fullscreen"
	Geolocation                = "geolocation"
	Gyroscope                  = "gyroscope"
	Hid                        = "hid"
	IdentityCredentialsGet     = "identity-credentials-get"
	IdleDetection              = "idle-detection"
	InterestCohort             = "interest-cohort"
	LocalFonts                 = "local-fonts"
	Magnetometer               = "magnetometer"
	Microphone                 = "microphone"
	Midi                       = "midi"
	OtpCredentials             = "otp-credentials"
	Payment                    = "payment"
	PictureInPicture           = "picture-in-picture"
	PublickeyCredentialsCreate = "publickey-credentials-create"
	PublickeyCredentialsGet    = "publickey-credentials-get"
	ScreenWakeLock             = "screen-wake-lock"
	Serial                     = "serial"
	StorageAccess              = "storage-access"
	Usb                        = "usb"
	WebShare                   = "web-share"
	Wildcards                  = "wildcards"
	WindowManagement           = "window-management"
	XrSpatialTracking          = "xr-spatial-tracking"
)

Policy values.

Variables

DefaultPolicy is a default Policy that denies everything.

Functions

This section is empty.

Types

type Policy

type Policy map[string][]string

Policy is a map of permission directives. It's the same data structure as http.Header, with a different serialization.

func (Policy) Add

func (p Policy) Add(name string, values ...string)

Add adds values to an existing directive, or creates it if it does not exist.

func (Policy) Set

func (p Policy) Set(name string, values ...string)

Set creates or replaces a directive.

func (Policy) String

func (p Policy) String() string

String returns the policy suitable for an http.Header value.

func (Policy) Write

func (p Policy) Write(h http.Header)

Write sets the CSP header to an http.Header.

Jump to

Keyboard shortcuts

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