From 15e9f774341e120f854c146a334c9b1d98664a14 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Mon, 12 Feb 2018 21:50:19 +0000 Subject: [PATCH] Add Uniq() rpc method for crypto-secure rando ids --- web/rpc.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/rpc.go b/web/rpc.go index 7569c759..7fa0f0cf 100644 --- a/web/rpc.go +++ b/web/rpc.go @@ -19,10 +19,15 @@ import ( "github.com/abcum/surreal/cnf" "github.com/abcum/surreal/db" "github.com/abcum/surreal/sql" + "github.com/abcum/surreal/util/rand" ) 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) { return c.Get("auth").(*cnf.Auth).Data, nil }