keystore

package
v0.4.0-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Keystore

type Keystore interface {
	WriteKeyPair(context.Context, keypair.Key) (uint, error)
	LoadPrivateKey(context.Context, string) (*ecdsa.PrivateKey, error)
}

Keystore defines how keypairs should be stored and accessed from a storage backend.

func NewPostgresKeytore

func NewPostgresKeytore(o Opts) Keystore

type Opts

type Opts struct {
	PostgresPool *pgxpool.Pool
	Queries      *queries.Queries
}

type PostgresKeystore

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

func (*PostgresKeystore) LoadPrivateKey

func (ks *PostgresKeystore) LoadPrivateKey(ctx context.Context, publicKey string) (*ecdsa.PrivateKey, error)

LoadPrivateKey loads a private key as a crypto primitive for direct use. An id is used to search for the private key.

func (*PostgresKeystore) WriteKeyPair

func (ks *PostgresKeystore) WriteKeyPair(ctx context.Context, keypair keypair.Key) (uint, error)

WriteKeyPair inserts a keypair into the db and returns the linked id.

Jump to

Keyboard shortcuts

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