{"modulePath":"github.com/brevdev/brev-cli","version":"v0.6.337","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package sshcert\n\nPackage sshcert manages short-lived, per-environment SSH certificates and their backing ephemeral keypairs on disk for use by the OpenSSH client.\n\n## Constants\n\n```go\nconst (\n\tLabelKeySSHProvider = \"sshprovider\"\n\tSSHProviderCertAuth = \"certauth\"\n)\n```\nLabel constants mirroring dev-plane's internal/labels package\n\n```go\nconst DefaultRenewalMargin = 60 * time.Second\n```\nDefaultRenewalMargin is how long before expiry we renew, to avoid a race where the cert expires between mint and the subsequent ssh use.\n\n## Functions\n\n```go\nfunc CertAuthorityPrincipal(nodeID, linuxUser string) string\n```\nCertAuthorityPrincipal returns the SSH certificate principal for a node and Linux user\n\n```go\nfunc CertPath(brevDir, envID string) string\n```\nCertPath follows OpenSSH's \\\u003cIdentityFile\u003e-cert.pub convention, so a single IdentityFile directive loads both the key and the cert.\n\n```go\nfunc CertValidAt(cert *ssh.Certificate, now time.Time, margin time.Duration) bool\n```\n\n```go\nfunc Dir(brevDir string) string\n```\n\n```go\nfunc EnvironmentCertEligible(labels map[string]string) bool\n```\n\n```go\nfunc GenerateKeyPair() (privKeyPEM []byte, pubKeyOpenSSH string, err error)\n```\n\n```go\nfunc HasCertAuthorityLine(homeDir, nodeID string) bool\n```\nHasCertAuthorityLine reports whether authorized\\_keys contains a Brev cert-authority line for the given node (any Linux user).\n\n```go\nfunc HasValidCertAuth(fs afero.Fs, keyPath, certPath string, now time.Time, margin time.Duration) (bool, error)\n```\n\n```go\nfunc KeyPath(brevDir, envID string) string\n```\n\n```go\nfunc ParseCertificate(certOpenSSH string) (*ssh.Certificate, error)\n```\n\n```go\nfunc PublicKeyMatches(a, b ssh.PublicKey) bool\n```\n\n```go\nfunc RemoveCertAuthorityLine(homeDir, nodeID, linuxUser string) (bool, error)\n```\nRemoveCertAuthorityLine removes the cert-authority line for the given node and Linux user from ~/.ssh/authorized\\_keys. Returns true if a line was removed. Missing file is treated as nothing-to-remove.\n\n```go\nfunc WriteFiles(fs afero.Fs, keyPath, certPath string, privKeyPEM []byte, certOpenSSH string) error\n```\n\n","path":"github.com/brevdev/brev-cli/pkg/sshcert","name":"sshcert","synopsis":"Package sshcert manages short-lived, per-environment SSH certificates and their backing ephemeral keypairs on disk for use by the OpenSSH client.","isRedistributable":true}
