crypto

package
v0.48.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticateContainerRequest

func AuthenticateContainerRequest(owner user.ID, invocScript, verifScript, payload []byte, fsChain N3ScriptRunner) error

AuthenticateContainerRequest checks N3 witness of the container owner sent along with specified request payload against the current FS chain state.

If verifScript is a compressed ECDSA public key, AuthenticateContainerRequest switches to deterministic ECDSA with SHA-256 hashing (RFC 6979) algorithm.

func AuthenticateObject

func AuthenticateObject(obj object.Object, fsChain HistoricN3ScriptRunner) error

AuthenticateObject checks whether obj is signed correctly by its owner.

func AuthenticateToken

func AuthenticateToken[T interface {
	SignedData() []byte
	Signature() (neofscrypto.Signature, bool)
	Issuer() user.ID
	Iat() uint64
}](token T, fsChain HistoricN3ScriptRunner) error

AuthenticateToken checks whether t is signed correctly by its issuer.

If signature scheme is unsupported, ErrUnsupportedScheme returns. It also returns when neofscrypto.N3 scheme is used but fsChain is not provided.

func GetRequestAuthor

func GetRequestAuthor(vh *protosession.RequestVerificationHeader) (user.ID, []byte, error)

GetRequestAuthor returns ID of the request author along with public key from the request verification header.

func VerifyRequestSignatures

func VerifyRequestSignatures[B neofscrypto.ProtoMessage](req neofscrypto.SignedRequest[B]) error

VerifyRequestSignatures checks whether all request signatures are set and valid. Returns apistatus.SignatureVerification otherwise.

func VerifyRequestSignaturesN3

func VerifyRequestSignaturesN3[B neofscrypto.ProtoMessage](req neofscrypto.SignedRequest[B], fsChain N3ScriptRunner) error

VerifyRequestSignaturesN3 is same as VerifyRequestSignatures but supports neofscrypto.N3 scheme.

Types

type ErrUnsupportedScheme

type ErrUnsupportedScheme neofscrypto.Scheme

ErrUnsupportedScheme is returned when neofscrypto.N3 signature cannot be verified without FS chain state.

func (ErrUnsupportedScheme) Error

func (x ErrUnsupportedScheme) Error() string

type HistoricN3ScriptRunner

type HistoricN3ScriptRunner interface {
	N3ScriptRunner
	// GetEpochBlock returns FS chain height when given NeoFS epoch was ticked.
	GetEpochBlock(epoch uint64) (uint32, error)
}

HistoricN3ScriptRunner runs N3 scripts historically.

type N3ScriptRunner

type N3ScriptRunner interface {
	InvokeContainedScript(tx *transaction.Transaction, header *block.Header, _ *trigger.Type, _ *bool) (*result.Invoke, error)
}

N3ScriptRunner allows to makes historic N3 script runs on the N3 chain.

Jump to

Keyboard shortcuts

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