pcrypto

package
v0.0.0-...-23a443e Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PublicKeyFileName = "protos.pub"
)

Variables

This section is empty.

Functions

func ConvertPublicEd25519ToCurve25519

func ConvertPublicEd25519ToCurve25519(base64String string) (wgtypes.Key, error)

func ExecuteCommand

func ExecuteCommand(cmd string, client *ssh.Client) (string, error)

ExecuteCommand opens a session using the provided client and executes the provided command

func NewConnection

func NewConnection(host string, user string, auth ssh.AuthMethod, maxRetries int) (*ssh.Client, error)

Types

type Key

type Key struct {
	Priv ed25519.PrivateKey
	Pub  ed25519.PublicKey
}

Key is an SSH key

func CreatePublicKeyFromBase64

func CreatePublicKeyFromBase64(base64String string) (Key, error)

func CreatePublicKeyFromPEM

func CreatePublicKeyFromPEM(pemString string) (Key, error)

func GetLocalKey

func GetLocalKey(workdir string) (*Key, error)

func (Key) AuthorizedKey

func (k Key) AuthorizedKey() string

AuthorizedKey return the public key in a format that can be written directly to the ~/.ssh/authorized_keys file

func (Key) EncodePrivateKeytoPEM

func (k Key) EncodePrivateKeytoPEM() string

func (Key) GetID

func (k Key) GetID() string

func (Key) IPv6Address

func (k Key) IPv6Address() netip.Addr

This code has been straight up copied from yggdrasil's key to address implementation. Temporary until I can figure out if I keep it or not FIXME: I need to figure out if I keep this or not

func (Key) Private

func (k Key) Private() []byte

func (Key) PrivateWG

func (k Key) PrivateWG() wgtypes.Key

func (Key) Public

func (k Key) Public() []byte

func (Key) PublicKey

func (k Key) PublicKey() string

func (Key) PublicString

func (k Key) PublicString() string

func (Key) PublicWG

func (k Key) PublicWG() wgtypes.Key

func (Key) SSHAuth

func (k Key) SSHAuth() ssh.AuthMethod

SSHAuth returns an ssh.AuthMethod that can be used to configure an ssh client

func (Key) Seed

func (k Key) Seed() []byte

func (Key) Sign

func (k Key) Sign(commit string) (string, error)

func (Key) Verify

func (k Key) Verify(commit string, signature string, publicKey string) error

type Manager

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

Manager keeps track of all the keys

func CreateManager

func CreateManager(db *db.DB) *Manager

CreateManager returns a Manager, which implements the core.ProviderManager interface

func (*Manager) GenerateKey

func (sm *Manager) GenerateKey() (*Key, error)

GenerateKey generates a SSH key pair

func (*Manager) GetLocalKey

func (sm *Manager) GetLocalKey() (*Key, error)

GetLocalKey returns the local key

func (*Manager) NewAuthFromKeyFile

func (sm *Manager) NewAuthFromKeyFile(keyPath string) (ssh.AuthMethod, error)

NewAuthFromKeyFile takes a file path and returns an ssh authentication

func (*Manager) NewKeyFromSeed

func (sm *Manager) NewKeyFromSeed(seedStr string) (*Key, error)

NewKeyFromSeed takes an ed25519 key seed and return a Key

type Tunnel

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

Tunnel represents and SSH tunnel to a remote host

func NewTunnel

func NewTunnel(sshHost string, sshUser string, sshAuth ssh.AuthMethod, tunnelTarget string) *Tunnel

NewTunnel creates and returns an SSHTunnel

func (*Tunnel) Close

func (t *Tunnel) Close() error

Close terminates the SSH tunnel

func (*Tunnel) Start

func (t *Tunnel) Start() (int, error)

Start initiates the ssh tunnel

Jump to

Keyboard shortcuts

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