sshrepo

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(rlog log.Ext1FieldLogger, tx *sqlx.Tx, myid mtid.MTID, keyHash string) error

Delete deletes an ssh key for the given user (given by the mytoken) from the database

func GetAllSSHInfo

func GetAllSSHInfo(rlog log.Ext1FieldLogger, tx *sqlx.Tx, myid mtid.MTID) (info []api.SSHKeyInfo, err error)

GetAllSSHInfo returns the SSHInfo for all ssh keys for a given user

func Insert

func Insert(rlog log.Ext1FieldLogger, tx *sqlx.Tx, data SSHInfoIn) error

Insert inserts an ssh public key for the given user (given by the mytoken) into the database

func UsedKey

func UsedKey(rlog log.Ext1FieldLogger, tx *sqlx.Tx, keyFP, userHash string) error

UsedKey marks that the passed ssh key was just used

Types

type SSHInfo

type SSHInfo struct {
	KeyID          string        `db:"key_id"`
	Name           db.NullString `db:"name"`
	KeyFingerprint string        `db:"ssh_key_fp"`
	UserHash       string        `db:"ssh_user_hash"`
	Created        time.Time     `db:"created"`
	LastUsed       sql.NullTime  `db:"last_used"`
	Enabled        db.BitBool    `db:"enabled"`
	EncryptedMT    string        `db:"MT_crypt"`
}

SSHInfo is a type holding the information stored in the database related to an ssh key

func GetSSHInfo

func GetSSHInfo(rlog log.Ext1FieldLogger, tx *sqlx.Tx, keyFP, userHash string) (info SSHInfo, err error)

GetSSHInfo returns the SSHInfo stored in the database for the passed key and user hashes.

func (SSHInfo) Decrypt

func (i SSHInfo) Decrypt(password string) (*mytoken.Mytoken, error)

Decrypt decrypts the encrypted mytoken linked to this ssh key with the passed password

type SSHInfoIn

type SSHInfoIn struct {
	MTID           mtid.MTID     `db:"MT_id"`
	Name           db.NullString `db:"name"`
	KeyFingerprint string        `db:"ssh_key_fp"`
	UserHash       string        `db:"ssh_user_hash"`
	EncryptedMT    string        `db:"MT_crypt"`
}

SSHInfoIn is a type for storing an ssh public key in the database

Jump to

Keyboard shortcuts

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