signatures

package
v0.18.3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyInput        = errors.New("empty input")
	ErrSignatureNotFound = errors.New("input JSON doesn't contain signature from specified device")
)

Functions

func VerifySignature

func VerifySignature(message []byte, key id.Ed25519, signature []byte) (ok bool, err error)

VerifySignature verifies an Ed25519 signature.

func VerifySignatureJSON

func VerifySignatureJSON(obj any, userID id.UserID, keyName string, key id.Ed25519) (bool, error)

VerifySignatureJSON verifies the signature in the given JSON object "obj" as described in Appendix 3 of the Matrix Spec.

This function is a wrapper over [Utility.VerifySignatureJSON] that creates and destroys the [Utility] object transparently.

If the "obj" is not already a json.RawMessage, it will re-encoded as JSON for the verification, so "json" tags will be honored.

Types

type Signatures

type Signatures map[id.UserID]map[id.KeyID]string

Signatures represents a set of signatures for some data from multiple users and keys.

func NewSingleSignature

func NewSingleSignature(userID id.UserID, algorithm id.KeyAlgorithm, keyID string, signature string) Signatures

NewSingleSignature creates a new Signatures object with a single signature.

Jump to

Keyboard shortcuts

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