links

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package links builds and parses Hemmelig secret links.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidLink = errors.New("not a Hemmelig link or secret ID")

ErrInvalidLink means that the value is not a Hemmelig link or ID.

Functions

func IsID

func IsID(value string) bool

IsID reports whether value has the form of a secret ID.

func NormalizeBaseURL

func NormalizeBaseURL(raw string) (string, error)

NormalizeBaseURL removes a trailing slash and checks the scheme.

func SecretLink(baseURL, id, key string) string

SecretLink returns the short link /s/<id>#<key>. Without a key, the link has no fragment, which is the form for password-protected secrets.

Types

type Secret

type Secret struct {
	// BaseURL is the scheme and host of the link, or empty for a bare ID.
	BaseURL string
	ID      string
	// Key is empty for password-protected secrets and for bare IDs.
	Key string
}

Secret is a parsed secret link.

func ParseSecret

func ParseSecret(value string) (Secret, error)

ParseSecret accepts these forms:

https://host/s/<id>#<key>
https://host/@<org>/s/<id>#<key> (an organization link)
https://host/secret/<id>#decryptionKey=<key>
https://host/s/<id> or https://host/secret/<id> (no key)
<id>

Jump to

Keyboard shortcuts

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