Class: Core
srp.Core
Implements various formulas defined in the SRP specification, used by Client and Server classes.
Constructors
constructor
• new Core(length)
Parameters
| Name | Type |
|---|---|
length |
SRPGroupLength |
Defined in
Properties
_params
• Private _params: SRPParams
Defined in
Methods
A
▸ A(a): BigInteger
Calculates A from random value a, according to the formula
A = g ^ a % N
Parameters
| Name | Type |
|---|---|
a |
BigInteger |
Returns
BigInteger
Defined in
B
▸ B(v, b): Promise<BigInteger>
Calculates B from v and the random value b according to the formula
B = (k * v + g ^ b % N) % N
Parameters
| Name | Type |
|---|---|
v |
BigInteger |
b |
BigInteger |
Returns
Promise<BigInteger>
Defined in
H
▸ H(...inp): Promise<BigInteger>
Creates a hash of all arguments, concatenated
Parameters
| Name | Type |
|---|---|
...inp |
BigInteger[] |
Returns
Promise<BigInteger>
Defined in
K
▸ K(S): Promise<BigInteger>
Calculates the shared key K = H(S)
Parameters
| Name | Type |
|---|---|
S |
BigInteger |
Returns
Promise<BigInteger>
Defined in
M1
▸ M1(A, B, K): Promise<BigInteger>
Calculates the first verification value M1 = H(A | B | K)
Parameters
| Name | Type |
|---|---|
A |
BigInteger |
B |
BigInteger |
K |
BigInteger |
Returns
Promise<BigInteger>
Defined in
M2
▸ M2(A, M1, K): Promise<BigInteger>
Calculates the second verification value M2 = H(A | M1 | K)
Parameters
| Name | Type |
|---|---|
A |
BigInteger |
M1 |
BigInteger |
K |
BigInteger |
Returns
Promise<BigInteger>
Defined in
clientS
▸ clientS(B, x, a, u): Promise<BigInteger>
Calculates S from B, x, a and u according to the formula
S = (B - k * (g ^ x % N)) ^ (a + u * x) % N
Parameters
| Name | Type |
|---|---|
B |
BigInteger |
x |
BigInteger |
a |
BigInteger |
u |
BigInteger |
Returns
Promise<BigInteger>
Defined in
isZeroWhenModN
▸ isZeroWhenModN(n): boolean
This is used to ensure that values are not zero when mod N.
Parameters
| Name | Type |
|---|---|
n |
BigInteger |
Returns
boolean
Defined in
k
▸ k(): Promise<BigInteger>
Calculates the multiplier k = H(N | g) according to the SRP-6a specification
Returns
Promise<BigInteger>
Defined in
serverS
▸ serverS(A, v, u, b): BigInteger
Calculates S from A, v, b and u according to the formula
S = (A * v ^ u % N) ^ b % N
Parameters
| Name | Type |
|---|---|
A |
BigInteger |
v |
BigInteger |
u |
BigInteger |
b |
BigInteger |
Returns
BigInteger
Defined in
u
▸ u(A, B): Promise<BigInteger>
Calculates u from A and B according to the formula
u = H(A | B)
Parameters
| Name | Type |
|---|---|
A |
BigInteger |
B |
BigInteger |
Returns
Promise<BigInteger>
Defined in
v
▸ v(x): BigInteger
Calculates verifier v from secret x according to the formula
v = g ^ x % N
Parameters
| Name | Type |
|---|---|
x |
BigInteger |
Returns
BigInteger