diff --git a/src/git.xdrm.io/schastsp/client/client.go b/src/git.xdrm.io/schastsp/client/client.go index cb2061e..bdb8347 100644 --- a/src/git.xdrm.io/schastsp/client/client.go +++ b/src/git.xdrm.io/schastsp/client/client.go @@ -140,14 +140,21 @@ func (c *T) Receive(r io.Reader) error { -/* (5) TMP +/* (5) Returns a synchronisation key (first server connection) +* +* @return key<[]byte> Synchronisation key +* @return err * ---------------------------------------------------------*/ -func (c *T) TMP() []byte { - hash, err := c.key.CurrentHash() - if err != nil { panic(err) } +func (c *T) SynchronisationKey() ([]byte, error) { + /* (1) Get current hash */ + hash, err := c.key.CurrentHash() + if err != nil { return nil, err } + + /* (2) Decrement key so 'hash' is valid */ c.key.Decrement() - return hash; + /* (3) Return key */ + return hash, nil; }