Add Uniq() rpc method for crypto-secure rando ids

This commit is contained in:
Tobie Morgan Hitchcock 2018-02-12 21:50:19 +00:00
parent 779251bc54
commit 15e9f77434

View file

@ -19,10 +19,15 @@ import (
"github.com/abcum/surreal/cnf" "github.com/abcum/surreal/cnf"
"github.com/abcum/surreal/db" "github.com/abcum/surreal/db"
"github.com/abcum/surreal/sql" "github.com/abcum/surreal/sql"
"github.com/abcum/surreal/util/rand"
) )
type rpc struct{} type rpc struct{}
func (r *rpc) Uniq(c *fibre.Context) (interface{}, error) {
return rand.String(128), nil
}
func (r *rpc) Info(c *fibre.Context) (interface{}, error) { func (r *rpc) Info(c *fibre.Context) (interface{}, error) {
return c.Get("auth").(*cnf.Auth).Data, nil return c.Get("auth").(*cnf.Auth).Data, nil
} }