diff options
Diffstat (limited to 'lib/srp.go')
-rw-r--r-- | lib/srp.go | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -30,7 +30,7 @@ import "math/big" // SRP Server. type SRPServer struct { - users []SRPUser + users []*SRPUser } // Registered user on the SRP server. @@ -90,6 +90,16 @@ type SRPClientSession struct { sk []byte } +func (server *SRPServer) RegisterUser(user *SRPUser) error { + for _, u := range server.users { + if u.ident == user.ident { + return CPError{"user already registered"} + } + } + server.users = append(server.users, user) + return nil +} + func NewSRPUser(n, g, k, ident, pass string) (*SRPUser, error) { var err error var ok bool |