NewKeychainProvider creates a new KeychainProvider instance. It verifies that the `security` command is available on the system and stores the resolved absolute path for later use.
()
| 20 | // It verifies that the `security` command is available on the system and |
| 21 | // stores the resolved absolute path for later use. |
| 22 | func NewKeychainProvider() (*KeychainProvider, error) { |
| 23 | path, err := lookupBinary("security", KeychainNotAvailableError{}) |
| 24 | if err != nil { |
| 25 | return nil, err |
| 26 | } |
| 27 | return &KeychainProvider{binaryPath: path}, nil |
| 28 | } |
| 29 | |
| 30 | // Get retrieves the value of a secret by its service name from the macOS keychain. |
| 31 | // It uses the `security find-generic-password -w -s <name>` command to fetch the password. |
no test coverage detected