security

package
v0.5.112 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: AGPL-3.0, AGPL-3.0-or-later Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToSHA256

func ConvertToSHA256(string []byte) []byte

func EncryptAES

func EncryptAES(plainData, password []byte) ([]byte, error)

func GenerateKeyFromSeed

func GenerateKeyFromSeed(seed []byte) (ed25519.PrivateKey, error)

func GetCodebaseHashHex added in v0.3.9

func GetCodebaseHashHex(codebase FileSystem) (string, error)

func ResolveChallenge added in v0.2.476

func ResolveChallenge(codebase FileSystem, location SampleLocation, nonce int64) ([]byte, error)

func Sign added in v0.4.17

func Sign(privKey, body []byte) string

func VerifySignature added in v0.4.18

func VerifySignature(pubKey, body []byte, signatureStr string) error

Types

type FileSystem

type FileSystem interface {
	ReadDir(name string) ([]fs.DirEntry, error)
	ReadFile(name string) ([]byte, error)
	Open(name string) (fs.File, error)
}

type PSK

type PSK []byte

func GeneratePSK

func GeneratePSK(network string, v *semver.Version) (PSK, error)

GeneratePSK TODO rotate PSK?

func (PSK) String

func (s PSK) String() string

type PrivateKey

type PrivateKey crypto.PrivKey

type SampleLocation added in v0.2.476

type SampleLocation struct {
	DirStack  []int // every index is level and value is dir num
	FileStack []int // file index, line index, left line border, right line border
}

func GenerateChallenge added in v0.2.476

func GenerateChallenge(codebase FileSystem, nonce int64) ([]byte, SampleLocation, error)

Jump to

Keyboard shortcuts

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