credential

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 4 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 credential 让账号和浏览器凭据共用字段级脱敏与副本所有权。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Secret

type Secret struct {
	// contains filtered or unexported fields
}

Secret 的凭据只能通过 Value 或 Copy 显式读取;格式化与日志只输出脱敏标记。 作为结构体字段时须导出并标记 json:"-",让 fmt 调用字段的 Formatter。

func New

func New(value []byte) Secret

New 复制输入凭据,保留 nil 与空切片的区别。

func (Secret) Copy

func (s Secret) Copy() []byte

Copy 返回独立的凭据副本。

func (Secret) Empty

func (s Secret) Empty() bool

Empty 报告凭据内容是否为空;nil 与空切片都返回 true。

func (Secret) Format

func (s Secret) Format(state fmt.State, verb rune)

Format 拦截所有格式化动词并输出脱敏占位符;%q 会带上引号以保持合法输出。

func (Secret) GoString

func (s Secret) GoString() string

GoString 始终返回脱敏占位符,因此 %#v 不会打印凭据内容。

func (Secret) LogValue

func (s Secret) LogValue() slog.Value

LogValue 让 slog 只记录脱敏占位符,不输出凭据内容。

func (Secret) String

func (s Secret) String() string

String 始终返回脱敏占位符,因此 %v 与 %s 不会打印凭据内容。

func (Secret) Value

func (s Secret) Value() string

Value 仅供显式导出或认证请求读取凭据。

Jump to

Keyboard shortcuts

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