sshkey

package
v0.14.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cobra.Command{
	Use:   "ssh-key",
	Short: "Manage SSH keys",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Key requires a subcommand:")
		for _, command := range cmd.Commands() {
			fmt.Println(command.Name())
		}
	},
}

Command represents this folder's command

Functions

func GetSSHKeyFingerprints

func GetSSHKeyFingerprints(context context.Context, cmd *cobra.Command) (fingerprints []string, err error)

GetSSHKeyFingerprints gets the fingerprints of the SSHKeys

Types

type SSHKey

type SSHKey struct {
	Type        string       `json:"type"        mapstructure:"type"`
	ID          common.UUID  `json:"uuid"        mapstructure:"uuid"`
	Label       string       `json:"label"       mapstructure:"label"`
	Comment     string       `json:"comment"     mapstructure:"comment"`
	Key         string       `json:"key"         mapstructure:"key"`
	Fingerprint string       `json:"fingerprint" mapstructure:"fingerprint"`
	CreatedOn   time.Time    `json:"created_on"  mapstructure:"created_on"`
	ExpiresOn   time.Time    `json:"expires_on"  mapstructure:"expires_on"`
	LastUsed    time.Time    `json:"last_used"   mapstructure:"last_used"`
	Owner       user.User    `json:"owner"       mapstructure:"owner"`
	Links       common.Links `json:"links"       mapstructure:"links"`
}

func GetSSHKeys

func GetSSHKeys(context context.Context, cmd *cobra.Command) (keys []SSHKey, err error)

GetSSHKeys gets the SSHKeys

func (SSHKey) GetHeader

func (key SSHKey) GetHeader(short bool) []string

GetHeader gets the header for a table

implements common.Tableable

func (SSHKey) GetRow

func (key SSHKey) GetRow(headers []string) []string

GetRow gets the row for a table

implements common.Tableable

func (SSHKey) MarshalJSON

func (key SSHKey) MarshalJSON() ([]byte, error)

MarshalJSON marshals the SSHKey

implements json.Marshaler

func (SSHKey) String

func (key SSHKey) String() string

String gets a string representation of the SSHKey

implements fmt.Stringer

func (SSHKey) Validate

func (key SSHKey) Validate() error

Validate validates the SSHKey

type SSHKeys

type SSHKeys []SSHKey

func (SSHKeys) GetHeader

func (keys SSHKeys) GetHeader() []string

GetHeader gets the header for a table

implements common.Tableables

func (SSHKeys) GetRowAt

func (keys SSHKeys) GetRowAt(index int, headers []string) []string

GetRowAt gets the row for a table

implements common.Tableables

func (SSHKeys) Size

func (keys SSHKeys) Size() int

Size gets the number of elements

implements common.Tableables

Jump to

Keyboard shortcuts

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