sign

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package sign implements the signature creation and verification used in bendybutt powered metafeeds.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(input []byte, key ed25519.PrivateKey, hmacSec *[32]byte) []byte

Create creates the signature over the passed input bytes using the passed secret key. The resulting signature is prefixed with the two bytes 0x0400, which are bendybutt bencode extension to denote it being a signature. If hmacSec is not nil, the prefixed input is hashed using nacl's auth.Sum() before the signature is created.

func Verify

func Verify(data, signature []byte, pubKey ed25519.PublicKey, hmacSec *[32]byte) bool

Verify checks if the passed signature was indeed created over the passed data, using the same domain seperation as the Create() function in this package. It also checks if the signature has the right BFE data prefix (0x0400). If hmacSec is not nil, the prefixed input is hashed using nacl's auth.Sum() before the signature is verified.

Types

This section is empty.

Jump to

Keyboard shortcuts

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