jsonsigner

package
v0.0.0-...-e150fb8 Latest Latest
Warning

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

Go to latest
Published: May 7, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONSigner

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

JSONSigner implements the Signer interface using JSON file for persistence

func New

func New(storePath string) (*JSONSigner, error)

New creates a new JSONSigner that persists keys to the given path

func (*JSONSigner) Counter

func (s *JSONSigner) Counter() uint32

Counter returns a monotonically increasing counter

func (*JSONSigner) RegisterKey

func (s *JSONSigner) RegisterKey(applicationParam []byte) ([]byte, *big.Int, *big.Int, error)

RegisterKey generates a new key and returns its handle, X and Y coordinates

func (*JSONSigner) SignASN1

func (s *JSONSigner) SignASN1(keyHandle, applicationParam, digest []byte) ([]byte, error)

SignASN1 signs the digest using the provided key handle

func (*JSONSigner) SignASN1WithRPID

func (s *JSONSigner) SignASN1WithRPID(keyHandle, applicationParam, digest []byte, rpid string) ([]byte, error)

SignASN1WithRPID is a compatibility function that simply forwards to SignASN1 Since we're using fingerprint-only auth, we don't need strict RPID validation

type JSONStore

type JSONStore struct {
	Keys          map[string]KeyData `json:"keys"`            // Map of key handles to key data
	Counter       uint32             `json:"counter"`         // Monotonically increasing counter
	MasterKeyHash string             `json:"master_key_hash"` // Hash of master key for verification
	CreatedAt     time.Time          `json:"created_at"`      // When this store was created
	LastUpdated   time.Time          `json:"last_updated"`    // When this store was last updated
}

JSONStore is the persistent storage for all registered keys

type KeyData

type KeyData struct {
	KeyHandle    string    `json:"key_handle"`    // Base64 encoded key handle
	PrivateKeyD  string    `json:"private_key_d"` // Base64 encoded private key D component
	PublicKeyX   string    `json:"public_key_x"`  // Base64 encoded public key X component
	PublicKeyY   string    `json:"public_key_y"`  // Base64 encoded public key Y component
	AppParameter string    `json:"app_parameter"` // Base64 encoded application parameter
	CreatedAt    time.Time `json:"created_at"`    // When the key was created
	LastUsed     time.Time `json:"last_used"`     // When the key was last used
	UseCount     int       `json:"use_count"`     // Number of times the key has been used
}

KeyData stores information about a registered key

Jump to

Keyboard shortcuts

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