File: README.md

package info (click to toggle)
python-proton-core 0.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 540 kB
  • sloc: python: 3,574; makefile: 15
file content (37 lines) | stat: -rw-r--r-- 1,010 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Secure Remote Password submodule
This submodule provides the interface to the custom implementation of ProtonMail's SRP API.
It automatically tries to load the constant time ctypes + OpenSSL implementation, 
and on failure it uses the native long int implementation.
It is based on [pysrp](https://github.com/cocagne/pysrp).

## Examples
### Authenticate against the API
```python
from proton.srp import User
usr = User(password, modulus)
client_challenge = usr.get_challenge()

# Get server challenge and user salt...

client_proof = usr.process_challenge(salt, server_challenge, version)

# Send client proof...

usr.verify_session(server_proof)
if usr.authenticated():
    print("Logged in!")
```

### Generate new random verifier
```python
from proton.srp import User
usr = User(password, modulus)
generated_salt, generated_v = usr.compute_v()
```

### Generate verifier given salt
```python
from proton.srp import User
usr = User(password, modulus)
generated_salt, generated_v = usr.compute_v(salt)
```