From cf34eb1586f3192c3498fe67f365996858b8e2fb Mon Sep 17 00:00:00 2001 From: siddharth Date: Sat, 14 May 2022 15:05:01 -0400 Subject: lib: SRPClient: add news functions To set and get unexoposed fields. --- lib/srp.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lib/srp.go b/lib/srp.go index ee0b1df..ec3fed6 100644 --- a/lib/srp.go +++ b/lib/srp.go @@ -266,6 +266,35 @@ func (u *SRPUser) Salt() []byte { return u.salt } +func (client *SRPClient) LoggedIn() bool { + if client.Session == nil { + return false + } + return client.Session.loggedIn +} + +func (client *SRPClient) LogIn() { + if client.Session == nil { + return + } + client.Session.loggedIn = true +} + +func (client *SRPClient) LogOut() { + if client.Session == nil { + return + } + client.Session.loggedIn = false +} + +func (client *SRPClient) Ident() string { + if !client.LoggedIn() { + return "" + } else { + return client.Session.ident + } +} + func NewSRPClientSession(n, g, k, ident string) (*SRPClientSession, error) { var ok bool -- cgit v1.2.3