apikey

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const TURNKEY_API_SIGNATURE_SCHEME = "SIGNATURE_SCHEME_TK_API_P256"

Variables

This section is empty.

Functions

func DecodeTKPublicKey

func DecodeTKPublicKey(encodedPublicKey string) (*ecdsa.PublicKey, error)

Takes a TK-encoded public key and creates an ECDSA public key

func EncodePrivateKey

func EncodePrivateKey(privateKey *ecdsa.PrivateKey) string

Encode an ECDSA private key into the Turnkey format For now, "Turnkey format" = raw DER form

func EncodePublicKey

func EncodePublicKey(publicKey *ecdsa.PublicKey) (string, error)

Encode an ECDSA public key into the Turnkey format. For now, "Turnkey format" = standard compressed form for ECDSA keys

func Stamp added in v0.3.0

func Stamp(message string, apiKey *ApiKey) (string, error)

/ Takes a message and returns the proper API stamp / This value should be inserted in a "X-Stamp" header

Types

type ApiKey

type ApiKey struct {
	TkPrivateKey string
	TkPublicKey  string
	// contains filtered or unexported fields
}

Struct to hold both serialized and ecdsa lib friendly version of a public/private key pair

func FromEcdsaPrivateKey

func FromEcdsaPrivateKey(privateKey *ecdsa.PrivateKey) (*ApiKey, error)

Takes an ECDSA private key and create a new TkApiKey. Assumes that privateKey.PublicKey has been derived.

func FromTkPrivateKey

func FromTkPrivateKey(encodedPrivateKey string) (*ApiKey, error)

Takes a TK-encoded private key and creates an ECDSA private key

func NewTkApiKey

func NewTkApiKey() (*ApiKey, error)

Create a new Turnkey API key

type ApiStamp added in v0.3.0

type ApiStamp struct {
	// API public key, hex-encoded
	PublicKey string `json:"publicKey"`
	// P-256 signature bytes, hex-coded
	Signature string `json:"signature"`
	// Signature scheme. Must be set to "SIGNATURE_SCHEME_TK_API_P256"
	Scheme string `json:"scheme"`
}

Jump to

Keyboard shortcuts

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