crypto

package
v0.0.0-...-4c68550 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKeys

func GenerateKeys() ([]byte, []byte, error)

GenerateKeys will generate the private/public key pair needed for federation.

func GetPrivateKey

func GetPrivateKey(key string) *rsa.PrivateKey

GetPrivateKey will return the internal server private key.

Types

type PublicKey

type PublicKey struct {
	ID           *url.URL `json:"id"`
	Owner        *url.URL `json:"owner"`
	PublicKeyPem string   `json:"publicKeyPem"`
}

PublicKey represents a public key with associated ownership.

func GetPublicKey

func GetPublicKey(actorIRI *url.URL, key string) PublicKey

GetPublicKey will return the public key for the provided actor.

type Signer

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

func NewSigner

func NewSigner(keyStore keyGetter) *Signer

func (*Signer) CreateSignedRequest

func (s *Signer) CreateSignedRequest(payload []byte, url *url.URL, fromActorIRI *url.URL, release string) (*http.Request, error)

CreateSignedRequest will create a signed POST request of a payload to the provided destination.

func (*Signer) SignRequest

func (s *Signer) SignRequest(req *http.Request, body []byte, actorIRI *url.URL) error

SignRequest will sign an ounbound request given the provided body.

func (*Signer) SignResponse

func (s *Signer) SignResponse(w http.ResponseWriter, body []byte, publicKey PublicKey, privateKey *rsa.PrivateKey) error

SignResponse will sign a response using the provided response body and public key.

Jump to

Keyboard shortcuts

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