keys

package
v0.90.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package keys provides API key loading and management.

This package implements the api.KeyProvider interface for loading Turnkey API keys from the standard Turnkey CLI key storage location.

Key File Format

Keys are stored in ~/.config/turnkey/keys/ with two files per key:

<key-name>.public  - Hex-encoded compressed public key
<key-name>.private - Format: "hexkey:p256" where hexkey is the private scalar

Loading Keys

Load an API key using the FileKeyProvider:

provider := &keys.FileKeyProvider{KeyName: "my-key"}
apiKey, err := provider.GetAPIKey(context.Background())
if err != nil {
	log.Fatal(err)
}

Or directly load a key by name:

apiKey, err := keys.LoadAPIKeyFromFile("my-key")
if err != nil {
	log.Fatal(err)
}

Key Formats

The private key format in .private file is "hexkey:curve" where:

  • hexkey: Hex-encoded private key scalar (must be 64 hex characters for P-256)
  • curve: Curve name (currently only "p256" is supported)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadAPIKeyFromFile

func LoadAPIKeyFromFile(keyName string) (*api.TurnkeyAPIKey, error)

LoadAPIKeyFromFile loads the API key from the Turnkey CLI configuration

Types

type FileKeyProvider

type FileKeyProvider struct {
	KeyName string
}

FileKeyProvider implements api.KeyProvider by reading from files

func (*FileKeyProvider) GetAPIKey

func (f *FileKeyProvider) GetAPIKey(ctx context.Context) (*api.TurnkeyAPIKey, error)

GetAPIKey loads the API key from files

Jump to

Keyboard shortcuts

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