INNER CODE UNIT · Go
InitCurveWithIdentities
schollz/pake · pake.go:238
func InitCurveWithIdentities(pw []byte, role int, curve string, idA, idB []byte) (p *Pake, err error) {
if role != 0 && role != 1 {
return nil, fmt.Errorf("role must be 0 (A) or 1 (B)")
}
if len(idA) == 0 || len(idB) == 0 {
return nil, fmt.Errorf("both participant identities are required")
}
return initCurveWithOptions(pw, role, curve, idA, idB, true)
}
func initCurveWithOptions(pw []byte, role int, curve string, idA, idB []byte, withIDs bool) (p *Pake, err error) {
p = new(Pake)
p.curve, p.P, p.Uᵤ, p.Uᵥ, p.Vᵤ, p.Vᵥ, err = initCurve(curve)
if err != nil {
return
}
p.Pw = pw
if withIDs {