keypairs

package
v2.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package keypairs handles the public-private keypairs defined for your apps that are used to sign your license data to create license keys. Keypairs are used to sign your data for authenticity purposes. The private key should never leave this app while the public key can be exported for placement in your app's code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(w http.ResponseWriter, r *http.Request)

Add saves a new keypair. The keypair data provided is used to generate a new keypair which is then saved to the database.

func DecryptPrivateKey

func DecryptPrivateKey(encryptionKey string, encryptedPrivateKey []byte) (unecryptedPrivKey []byte, err error)

DecryptPrivateKey decrypts the private key stored in the database using the encryption key provided in the config file. This returns a []byte since the input unencrypted data is also a []byte; we just keep the type the same for ease of use elsewhere.

The encryption key must be 16, 24, or 32 characters long. The encryptionKey is a string since that is how it is stored in the config file and we can handle the conversion inside this func as needed.

This func is only used when signing a newly created license file. Once a license key file has been created, the signature is stored in the db and we just retrieve it when a license key file needs to be downloaded.

https://pkg.go.dev/crypto/cipher#example-NewGCM-Decrypt

func Default

func Default(w http.ResponseWriter, r *http.Request)

Default marks a keypair as the default for the app. This marks all other keypairs for this app as non-default.

func Delete

func Delete(w http.ResponseWriter, r *http.Request)

Delete marks a keypair as inactive. The keypair will no longer be available for use to sign a license. Old licenses will still use their assigned keypair even when keypair is deleted.

func Get

func Get(w http.ResponseWriter, r *http.Request)

Get returns the list of keypairs. You can optionally filter by active only.

Types

This section is empty.

Jump to

Keyboard shortcuts

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