Documentation ¶
Index ¶
- Variables
- func GetModulusKey() string
- func HashPassword(authVersion int, password, userName string, salt, modulus []byte) ([]byte, error)
- func MailboxPassword(password string, salt []byte) (hashed string, err error)
- func RandomBits(bits int) ([]byte, error)
- func RandomBytes(byes int) (raw []byte, err error)
- func VersionNumber() string
- type Auth
- type Proofs
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetModulusKey ¶
func GetModulusKey() string
func HashPassword ¶
HashPassword returns the hash of password argument. Based on version number following arguments are used in addition to password: * 0, 1, 2: userName and modulus * 3, 4: salt and modulus
func MailboxPassword ¶
MailboxPassword get mailbox password hash
Parameters:
- password string: a mailbox password
- salt []byte: a salt is random 128 bits data
Returns:
- hashed string: a hashed password
- err error: throw error
func RandomBits ¶
func RandomBytes ¶
Types ¶
type Auth ¶
type Auth struct {
Modulus, ServerEphemeral, HashedPassword []byte
}
Auth stores byte data for the calculation of SRP proofs.
- Changed SrpAuto to Auth because the name will be used as srp.SrpAuto by other packages and as SrpSrpAuth on mobile
- Also the data from the API called Auth. it could be match the meaning and reduce the confusion
func NewAuth ¶
func NewAuth(version int, username, password, salt, signedModulus, serverEphemeral string) (auth *Auth, err error)
NewAuth Creates new Auth from strings input. Salt and server ephemeral are in base64 format. Modulus is base64 with signature attached. The signature is verified against server key. The version controls password hash algorithm.
Parameters:
- version int: The *x* component of the vector.
- username string: The *y* component of the vector.
- password string: The *z* component of the vector.
- salt string:
Returns:
- auth *Auth: the pre caculated auth information
- err error: throw error
Usage:
Warnings:
- Be carefull! Poos can hurt.
func NewAuthForVerifier ¶
NewAuthForVerifier Creates new Auth from strings input. Salt and server ephemeral are in base64 format. Modulus is base64 with signature attached. The signature is verified against server key. The version controls password hash algorithm.
Parameters:
- version int: The *x* component of the vector.
- username string: The *y* component of the vector.
- password string: The *z* component of the vector.
- salt string:
Returns:
- auth *Auth: the pre caculated auth information
- err error: throw error
Usage:
Warnings:
- none.
func (*Auth) GenerateProofs ¶
GenerateProofs calculates SPR proofs.
type Proofs ¶
type Proofs struct {
ClientProof, ClientEphemeral, ExpectedServerProof []byte
}
Proofs Srp Proofs object. Changed SrpProofs to Proofs because the name will be used as srp.SrpProofs by other packages and as SrpSrpProofs on mobile ClientProof []byte client proof ClientEphemeral []byte calculated from ExpectedServerProof []byte