/usr/lib/python3/dist-packages/keyring/backends/__pycache__
Edit: /usr/lib/python3/dist-packages/keyring/backends/__pycache__/Windows.cpython-310.pyc (5497B)
o
a @ s d dl Z ddlmZ ddlmZ ddlmZ ddlmZm Z e .Z
zd dlmZ d dlm
Z
e
j W n eyG d dlZd dl
Z
e
j Y nw W d n1 sRw Y e eZG d d
d
ZG dd deZG d
d deZdS ) N )
properties)KeyringBackend)SimpleCredential)PasswordDeleteErrorExceptionRaisedContext)
pywintypes) win32credc @ s e Zd ZdddZdd ZdS )PersistenceNc C s t |dtjS )N_persist)getattrr CRED_PERSIST_ENTERPRISE)selfkeyringtype r :/usr/lib/python3/dist-packages/keyring/backends/Windows.py__get__ s zPersistence.__get__c C s8 t |trd|dd }tt|}t|d| dS )z
Set the persistence value on the Keyring. Value may be
one of the win32cred.CRED_PERSIST_* constants or a
string representing one of those constants. For example,
'local machine' or 'session'.
CRED_PERSIST_ _r N)
isinstancestrreplaceupperr r setattr)r r valueattrr r r __set__ s
zPersistence.__set__)N)__name__
__module____qualname__r r r r r r r
s
r
c @ s e Zd Zedd ZdS )DecodingCredentialc C s@ | d }z| dW S ty | d}td | Y S w )zM
Attempt to decode the credential blob as UTF-16 then UTF-8.
CredentialBlobzutf-16zutf-8zkRetrieved an UTF-8 encoded credential. Please be aware that this library only writes credentials in UTF-16.)decodeUnicodeDecodeErrorlogwarning)r creddecoded_cred_utf8r r r r . s
zDecodingCredential.valueN)r r r! propertyr r r r r r" - s r" c @ sl e Zd ZdZe Zejedd Z e
dd Zdd Zdd Z
d
d Zdd
Zdd Zdd Zdd ZdS )WinVaultKeyringaf
WinVaultKeyring stores encrypted passwords using the Windows Credential
Manager.
Requires pywin32
This backend does some gymnastics to simulate multi-user support,
which WinVault doesn't support natively. See
https://github.com/jaraco/keyring/issues/47#issuecomment-75763152
for details on the implementation, but here's the gist:
Passwords are stored under the service name unless there is a collision
(another password with the same service name but different user name),
in which case the previous password is moved into a compound name:
{username}@{service}
c C s t rtddS )zA
If available, the preferred backend on Windows.
zRequires Windows and pywin32 )missing_depsRuntimeError)clsr r r priorityS s zWinVaultKeyring.priorityc C s | d| S )N@r )usernameservicer r r _compound_name] s zWinVaultKeyring._compound_namec C s: | |}|r
|d |kr| | ||}|sd S |jS NUserName)
_get_passwordr4 r r r3 r2 resr r r get_passworda s
zWinVaultKeyring.get_passwordc
C sZ z
t jt j|d}W t|S tjy, } z|jdkr'|jdkr'W Y d }~d S d }~ww )NType
TargetName CredRead)r r? CRED_TYPE_GENERICr errorwinerrorfuncnamer" )r targetr9 er r r r7 k s zWinVaultKeyring._get_passwordc C sH | |}|r|d }| ||}| |||j | ||t| d S r5 )r7 r4
_set_passwordr r )r r3 r2 passwordexisting_pwexisting_usernamerD r r r set_passwordv s
zWinVaultKeyring.set_passwordc C s( t tj|||d| jd}t|d d S )NzStored using python-keyring)r<