Documentation
¶
Index ¶
- Constants
- Variables
- func CashCommands() []*cli.Command
- func CredentialsCommands() []*cli.Command
- func DataCommands() []*cli.Command
- func IdentCommands() []*cli.Command
- func IdentifyCommand() *cli.Command
- func KeyCommands() []*cli.Command
- func LifecycleCommands() []*cli.Command
- func MetadataCommands() []*cli.Command
- func PairingCommands() []*cli.Command
- func PinlessCommands() []*cli.Command
- func PrintResult(mode OutputMode, r Result, showSecrets bool) error
- func PrintResultCLI(cmd interface{ ... }, r Result) error
- func RegisterShellCommands() []shellCommand
- func ShellCommand() *cli.Command
- func SigningCommands() []*cli.Command
- type ActionResult
- type AppStatusResult
- type AuthLevel
- type BIP85KeyResult
- type CashInfo
- type CashInfoResult
- type ChallengeResult
- type DataResult
- type ExportedKeyResult
- type GPResult
- type GPStatusResult
- type GenerateMnemonicResult
- type IdentifyResult
- type InitResult
- type KeyGenerateResult
- type KeyLoadResult
- type KeycardInfo
- type KeycardInfoResult
- type LEEKeyResult
- type LoadIdentResult
- type NameResult
- type OutputMode
- type PairingResult
- type Result
- type SecureChannelVersionResult
- type SetNDEFResult
- type SetPairingResult
- type SetSecretsResult
- type SignatureResult
- type StoreDataResult
- type UnpairResult
Constants ¶
const MaxStoreDataLen = 1020
MaxStoreDataLen is the maximum number of bytes that can be stored in a single store-data operation. The applet encodes the offset as a single byte (offset/4), so offsets ≥ 1024 would wrap and overwrite earlier data.
Variables ¶
var Version = "dev"
Version is the CLI version string. Set by main package at startup from the -ldflags value; defaults to "dev" for local builds.
Functions ¶
func CashCommands ¶
CashCommands returns the cash applet command group.
func CredentialsCommands ¶
CredentialsCommands returns the credentials management command group.
func DataCommands ¶
DataCommands returns the data management command group.
func IdentCommands ¶
IdentCommands returns the identity management commands.
func IdentifyCommand ¶
IdentifyCommand returns the identify command (applet < 4.0 only).
func KeyCommands ¶
KeyCommands returns the key management command group.
func LifecycleCommands ¶
LifecycleCommands returns the lifecycle command group (version, info, install, delete, init, factory-reset).
func MetadataCommands ¶
MetadataCommands returns the metadata management command group.
func PairingCommands ¶
PairingCommands returns the pairing command group.
func PinlessCommands ¶
PinlessCommands returns the pinless signing command group.
func PrintResult ¶
func PrintResult(mode OutputMode, r Result, showSecrets bool) error
PrintResult writes r to stdout as JSON (if mode == OutputJSON) or as formatted text (r.Format(showSecrets)).
func PrintResultCLI ¶
PrintResultCLI is a convenience wrapper for standalone CLI commands. It reads the --json and --show-secrets flags from cmd and dispatches to PrintResult.
func RegisterShellCommands ¶
func RegisterShellCommands() []shellCommand
RegisterShellCommands returns the full list of shell commands. This is the single source of truth for what the shell can execute. When new commands are added to the top-level CLI, add them here too.
func ShellCommand ¶
ShellCommand returns the shell (scripting) command.
func SigningCommands ¶
SigningCommands returns the signing command group.
Types ¶
type ActionResult ¶
type ActionResult struct {
Message string `json:"message"`
}
ActionResult — simple confirmation messages
func (ActionResult) Format ¶
func (r ActionResult) Format(_ bool) string
type AppStatusResult ¶
type AppStatusResult struct {
PinRetryCount int `json:"pin_retry_count"`
PUKRetryCount int `json:"puk_retry_count"`
KeyInitialized bool `json:"key_initialized"`
KeyPath string `json:"key_path"`
}
AppStatusResult holds keycard application status.
func (AppStatusResult) Format ¶
func (r AppStatusResult) Format(_ bool) string
type AuthLevel ¶
type AuthLevel int
AuthLevel controls how far the authentication pipeline proceeds.
type BIP85KeyResult ¶
BIP85KeyResult — "export-bip85"
func (BIP85KeyResult) Format ¶
func (r BIP85KeyResult) Format(_ bool) string
type CashInfo ¶
type CashInfo struct {
Installed bool `json:"installed"`
PublicKey string `json:"public_key,omitempty"`
Address string `json:"address,omitempty"`
Version string `json:"version,omitempty"`
}
CashInfo holds cash applet info.
type CashInfoResult ¶
type CashInfoResult struct {
Cash CashInfo `json:"cash"`
}
CashInfoResult holds cash applet info (for the "cash-info" CLI/shell command).
func (*CashInfoResult) Format ¶
func (r *CashInfoResult) Format(_ bool) string
type ChallengeResult ¶
type ChallengeResult struct {
Challenge string `json:"challenge"`
}
ChallengeResult holds a random challenge.
func (ChallengeResult) Format ¶
func (r ChallengeResult) Format(_ bool) string
type DataResult ¶
type DataResult struct {
Type string `json:"type"`
Data string `json:"data,omitempty"`
Bytes int `json:"bytes,omitempty"`
}
DataResult holds stored/retrieved data.
func (DataResult) Format ¶
func (r DataResult) Format(_ bool) string
type ExportedKeyResult ¶
type ExportedKeyResult struct {
PrivateKey string `json:"private_key,omitempty"`
PublicKey string `json:"public_key"`
ChainCode string `json:"chain_code,omitempty"`
Address string `json:"address,omitempty"`
Path string `json:"path,omitempty"`
}
ExportedKeyResult holds exported key data.
func (ExportedKeyResult) Format ¶
func (r ExportedKeyResult) Format(_ bool) string
type GPResult ¶
type GPResult struct {
SW uint16 `json:"-"`
Data []byte `json:"-"`
SWStr string `json:"sw"`
DataHex string `json:"data"`
}
GPResult holds the result of a GP APDU send.
type GPStatusResult ¶
type GPStatusResult struct {
Lifecycle string `json:"lifecycle"`
}
GPStatusResult — "gp-get-status"
func (GPStatusResult) Format ¶
func (r GPStatusResult) Format(_ bool) string
type GenerateMnemonicResult ¶
type GenerateMnemonicResult struct {
Phrase string `json:"phrase"`
Words int `json:"words"`
KeyID string `json:"key_id,omitempty"` // set when mnemonic is also loaded onto the card
}
GenerateMnemonicResult holds the result of generating a mnemonic phrase.
func (GenerateMnemonicResult) Format ¶
func (r GenerateMnemonicResult) Format(showSecrets bool) string
type IdentifyResult ¶
type IdentifyResult struct {
Identified bool `json:"identified"`
PublicKey string `json:"public_key"`
}
IdentifyResult holds card identification result.
func (IdentifyResult) Format ¶
func (r IdentifyResult) Format(_ bool) string
type InitResult ¶
type InitResult struct {
Pin string `json:"pin"`
Puk string `json:"puk"`
PairingPassword string `json:"pairing_password,omitempty"`
}
InitResult — "init" (no "Card initialized." prefix)
func (InitResult) Format ¶
func (r InitResult) Format(showSecrets bool) string
type KeyGenerateResult ¶
type KeyGenerateResult struct {
KeyUID string `json:"key_uid"`
}
KeyGenerateResult — "generate-key"
func (KeyGenerateResult) Format ¶
func (r KeyGenerateResult) Format(_ bool) string
type KeyLoadResult ¶
type KeyLoadResult struct {
KeyID string `json:"key_id"`
}
KeyLoadResult — "load-seed"
func (KeyLoadResult) Format ¶
func (r KeyLoadResult) Format(_ bool) string
type KeycardInfo ¶
type KeycardInfo struct {
Installed bool `json:"installed"`
Initialized bool `json:"initialized"`
AppVersion string `json:"app_version,omitempty"`
AppVersionHex string `json:"app_version_hex,omitempty"`
HasMasterKey bool `json:"has_master_key"`
KeyUID string `json:"key_uid,omitempty"`
SecureChannelVersion string `json:"secure_channel_version,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
PINRetries int `json:"pin_retries"`
LEEMode bool `json:"lee_mode"`
HasFactoryResetCap bool `json:"has_factory_reset_capability"`
// V1-V3 fields
InstanceUID string `json:"instance_uid,omitempty"`
AvailableSlots *int `json:"available_slots,omitempty"`
// V4+ fields
Certificate string `json:"certificate,omitempty"`
IdentityPubKey string `json:"identity_pub_key,omitempty"`
CertVerification string `json:"certificate_verification_error,omitempty"`
}
KeycardInfo holds keycard applet info.
type KeycardInfoResult ¶
type KeycardInfoResult struct {
Keycard KeycardInfo `json:"keycard"`
}
KeycardInfoResult holds keycard applet info (for the "info" CLI/shell command).
func (*KeycardInfoResult) Format ¶
func (r *KeycardInfoResult) Format(_ bool) string
type LEEKeyResult ¶
LEEKeyResult — "export-lee-key"
func (LEEKeyResult) Format ¶
func (r LEEKeyResult) Format(_ bool) string
type LoadIdentResult ¶
type LoadIdentResult struct {
Bytes int `json:"bytes"`
}
LoadIdentResult holds the result of loading an identity certificate.
func (LoadIdentResult) Format ¶
func (r LoadIdentResult) Format(_ bool) string
type NameResult ¶
type NameResult struct {
Name string `json:"name"`
}
NameResult holds card display name.
func (NameResult) Format ¶
func (r NameResult) Format(_ bool) string
type OutputMode ¶
type OutputMode int
OutputMode controls output format.
const ( OutputText OutputMode = iota OutputJSON )
type PairingResult ¶
type PairingResult struct {
PairingKey string `json:"pairing_key"`
PairingIndex int `json:"pairing_index"`
}
PairingResult holds pairing information.
func (PairingResult) Format ¶
func (r PairingResult) Format(showSecrets bool) string
type SecureChannelVersionResult ¶
type SecureChannelVersionResult struct {
Version string `json:"secure_channel_version"`
}
SecureChannelVersionResult holds the secure channel version.
func (SecureChannelVersionResult) Format ¶
func (r SecureChannelVersionResult) Format(_ bool) string
type SetNDEFResult ¶
type SetNDEFResult struct {
Bytes int `json:"bytes"`
}
SetNDEFResult — "set-ndef"
func (SetNDEFResult) Format ¶
func (r SetNDEFResult) Format(_ bool) string
type SetPairingResult ¶
type SetPairingResult struct {
PairingKey string `json:"pairing_key"`
PairingIndex int `json:"pairing_index"`
}
SetPairingResult — "keycard-set-pairing" (shell-only)
func (SetPairingResult) Format ¶
func (r SetPairingResult) Format(showSecrets bool) string
type SetSecretsResult ¶
type SetSecretsResult struct {
Pin string `json:"pin"`
Puk string `json:"puk"`
PairingPassword string `json:"pairing_password"`
}
SetSecretsResult — "keycard-set-secrets" (shell-only)
func (SetSecretsResult) Format ¶
func (r SetSecretsResult) Format(showSecrets bool) string
type SignatureResult ¶
type SignatureResult struct {
R string `json:"signature_r"`
S string `json:"signature_s"`
V int `json:"signature_v"`
Path string `json:"path,omitempty"`
File string `json:"file,omitempty"`
}
SignatureResult holds signature data.
func (SignatureResult) Format ¶
func (r SignatureResult) Format(_ bool) string
type StoreDataResult ¶
StoreDataResult — "store-data"
func (StoreDataResult) Format ¶
func (r StoreDataResult) Format(_ bool) string
type UnpairResult ¶
type UnpairResult struct {
Index int `json:"index"`
}
UnpairResult — "unpair" (includes index)
func (UnpairResult) Format ¶
func (r UnpairResult) Format(_ bool) string