Skip to content

osal.sshkeys #

fn new #

fn new() SSHKeys

new creates a new SSHKeys instance

struct SSHKey #

struct SSHKey {
pub mut:
	name    string // Key name (derived from env var, e.g., "ourworld-it" from OURWORLD_IT_SSH_KEY)
	content string // Private key content
}

SSHKey represents an SSH key loaded from environment

struct SSHKeys #

@[heap]
struct SSHKeys {
pub mut:
	keys []SSHKey
}

SSHKeys manages a collection of SSH keys loaded from environment

fn (SSHKeys) load_from_env #

fn (mut sk SSHKeys) load_from_env() int

load_from_env loads SSH keys from environment variables. Looks for: SECRETS_SSH_KEY, SSH_KEY, and *_SSH_KEY patterns. Returns number of keys loaded.

fn (SSHKeys) get #

fn (sk &SSHKeys) get(name string) ?SSHKey

get returns a key by name, or none if not found

fn (SSHKeys) find_for_repo #

fn (sk &SSHKeys) find_for_repo(account string, provider string) ?SSHKey

find_for_repo finds the best SSH key for a repo based on account/provider. Priority: account-specific > provider-specific > secrets > first available

fn (SSHKeys) list #

fn (sk &SSHKeys) list() []string

list returns all loaded key names

fn (SSHKeys) len #

fn (sk &SSHKeys) len() int

len returns number of loaded keys