UNPKG

thinbus-srp

Version:

Secure Remote Password SRP SRP6a implementation.

34 lines 4 kB
┌──────────────┐ ┌──────────────┐ │ Browser │ │ Web Server │ └──────────────┘ └──────────────┘ │ │ .─. ┌───┐ GET /login.html ┌───┐ ( ) email,passwd │ │◀────────────────────────────────│ │ `┬' ─────────────▶│ │ └───┘ .───────────. ────┼──── │ │ AJAX /challenge {email} │ ( Database ) │ │ ├ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ▶───┐ (`───────────') ┌┴┐ │ │ ┌─┤ │◀──────────────(`───────────') │ │ │ │ step1(email,salt,verifier)│ │ │{salt,verifier}(`───────────') │ │ │ │ │ │ │ `───────────' ──┘ └── │ │ └▶│ │ │ │ {salt,B} │ │ store b .───────────. ┌─┤ │◀─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┤ ├──────────────▶( Cache ) step1(email,passwd)│ │ │ └─┬─┘ (`───────────') step2(salt,B)│ │ │ POST /auth {email,A,M1} ┌───┐ load b (`───────────') └▶│ ├─────────────────────────────────│ │◀──────────────(`───────────') └───┘ ┌─┤ │ `───────────' │ step2(A,M1)│ │ │ ┌───────────────────┐ │ │ │ │You have to retain │ ┌─┴─┐ {M2} └▶│ │ │the private "b" │ step3(M2)│ │◀────────────────────────────────┤ │ │which matches the │ └─┬─┘ REDIRECT /home.html OR └─┬─┘ │public challenge │ ┌──────────────────────┐ /login.html │"B". This can be in│ │step3 confirms a │ │ │ │the main DB or a │ │shared private key. A │ │cache. │ │mobile running │ │ │ └───────────────────┘ │embedded JavaScript │ ▼ ▼ │also confirms the │ │server knows the │ │verifier that the user│ │registered with. │ └──────────────────────┘