Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions keyring/backends/macOS/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ def set_password(self, service, username, password):

@warn_keychain
def get_password(self, service, username):
if username is None:
username = ''

try:
return api.find_generic_password(self.keychain, service, username)
except api.NotFound:
Expand Down
4 changes: 3 additions & 1 deletion keyring/backends/macOS/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,13 @@ class SecAuthFailure(Error):


def find_generic_password(kc_name, service, username, not_found_ok=False):
username_kwarg = {'kSecAttrAccount': username} if username is not None else {}

q = create_query(
kSecClass=k_('kSecClassGenericPassword'),
kSecMatchLimit=k_('kSecMatchLimitOne'),
kSecAttrService=service,
kSecAttrAccount=username,
**username_kwarg,
kSecReturnData=create_cfbool(True),
)

Expand Down