Debian Codegraph @

proton/session/srp/README.md

raw
1 # Secure Remote Password submodule
2 This submodule provides the interface to the custom implementation of ProtonMail's SRP API.
3 It automatically tries to load the constant time ctypes + OpenSSL implementation,
4 and on failure it uses the native long int implementation.
5 It is based on [pysrp](https://github.com/cocagne/pysrp).
6
7 ## Examples
8 ### Authenticate against the API
9 ```python
10 from proton.srp import User
11 usr = User(password, modulus)
12 client_challenge = usr.get_challenge()
13
14 # Get server challenge and user salt...
15
16 client_proof = usr.process_challenge(salt, server_challenge, version)
17
18 # Send client proof...
19
20 usr.verify_session(server_proof)
21 if usr.authenticated():
22 print("Logged in!")
23 ```
24
25 ### Generate new random verifier
26 ```python
27 from proton.srp import User
28 usr = User(password, modulus)
29 generated_salt, generated_v = usr.compute_v()
30 ```
31
32 ### Generate verifier given salt
33 ```python
34 from proton.srp import User
35 usr = User(password, modulus)
36 generated_salt, generated_v = usr.compute_v(salt)
37 ```