func (kss *KeychainSecretStore) ClearSecret() (err error) { G.Log.Debug("+ ClearSecret(%s)", kss.accountName) defer func() { G.Log.Debug("- ClearSecret -> %s", ErrToOk(err)) }() attributes := kc.GenericPasswordAttributes{ ServiceName: G.Env.GetStoredSecretServiceName(), AccountName: kss.accountName.String(), } err = kc.FindAndRemoveGenericPassword(&attributes) // Don't count the item not being found as an error. if err == kc.ErrItemNotFound { err = nil } return }
func (pi *pinentryInstance) shouldStoreSecret(info pinentrySecretStoreInfo) bool { if len(info) == 0 { return false } // We just want to know when the user did check the "Save in // Keychain" checkbox, so remove whatever pinentry put into // the keychain, and infer the state of the checkbox from the // error (since there will be no error if an entry was found // and deleted). // // This is a bit of a hack -- this may cause a dialog to pop // up saying that the client wants to access the user's // keychain. But this will do for now until we write our own // pinentry. attributes := kc.GenericPasswordAttributes{ ServiceName: pinentryServiceName, AccountName: string(info), } return (kc.FindAndRemoveGenericPassword(&attributes) == nil) }