mirror of
https://github.com/foomo/posh-providers.git
synced 2025-10-16 12:35:41 +00:00
20 lines
476 B
Go
20 lines
476 B
Go
package onepassword
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/foomo/posh/pkg/log"
|
|
"github.com/foomo/posh/pkg/prompt/check"
|
|
)
|
|
|
|
func AuthChecker(p *OnePassword) check.Checker {
|
|
return func(ctx context.Context, l log.Logger) []check.Info {
|
|
name := "1Password"
|
|
if ok, _ := p.IsAuthenticated(ctx); ok {
|
|
return []check.Info{check.NewSuccessInfo(name, "Authenticated")}
|
|
} else {
|
|
return []check.Info{check.NewFailureInfo(name, "Run `op auth` to sign into 1password")}
|
|
}
|
|
}
|
|
}
|