Acquire.Identity._usercredentials module

class UserCredentials[source]

Bases: object

This class is used to store user credentials in the object store, and to verify that user credentials are correct.

The user credentials are used to ultimately store a primary password for the user, which unlocks the user’s primary private key

static create(user_uid, password, primary_password, device_uid=None)[source]

Create the credentials for the user with specified user_uid, optionally logging in via the specified device_uid, using the specified password, to protect the passed “primary_password”

This returns the OTP that has been created to be associated with these credentials

static hash(username, password, service_uid=None)[source]

Return a secure hash of the passed username and password

static login(credentials, user_uids, remember_device=False)[source]

Verify the passed credentials are correct. This will find the account that matches these credentials. If one does, then this will validate the credentials are correct, and then return a tuple of the (user_uid, primary_password) for that user

static validate_password(user_uid, device_uid, secrets, password, otpcode, remember_device)[source]

Validate that the passed password and one-time-code are valid. If they are, then return a tuple of the UserAccount of the unlocked user, the OTP that is used to generate secrets, and the device_uid of the login device

If ‘remember_device’ is True and ‘device_uid’ is None, then this creates a new OTP for the login device, which is returned, and a new device_uid for that device. The password needed to match this device is a MD5 of the normal user password.