Documentation ¶
Index ¶
- Constants
- Variables
- func Endpoint(s string) string
- func Load(name *string) (bson.M, error)
- func Log(b []byte) bson.M
- func Mockfilename() *string
- func ReadBody(r *http.Response) []byte
- func Save(name *string, v interface{}) error
- func ToMap(s string) (bson.M, error)
- func ToString(v interface{}) string
- func WrapReq(v interface{}) bson.M
- type AuthRequest
Constants ¶
const ContentJson string = "application/json"
const SessionStorePath string = "."
Path of folder to save session files and load them.
Variables ¶
var Decrypt = Endpoint("Decrypt")
URL of Decrypt endpoint.
var DeleteToken = Endpoint("DeleteToken")
URL of DeleteToken endpoint.
var Encrypt = Endpoint("Encrypt")
URL of Encrypt endpoint.
var Join string = Endpoint("Join")
URL of Join endpoint.
var Key []byte = []byte("a very very very very secret key")
Key used to encrypt/decrypt session information. Must be a valid AES key.
var Login string = Endpoint("Login")
URL of Login endpoint.
var Mockname = Mockfilename()
var ResetPassword = Endpoint("ForgotPassword")
URL of reset password endpoint.
var VerifyLogin string = Endpoint("LoginVPhone")
URL of LoginVPhone endpoint: Login verify phone Use this endpoint to confirm an SMS code and retrieve an access token.
Functions ¶
func Endpoint ¶
Generate a string of URL path to specified SecureChain API endpoint. @test @case "Login" @equal "https://sc.gophersauce.com/momentum/funcs?name=Login"
func Load ¶
Load a previously saved interface with function Save(...). If testing please make sure you used func Save(... @test @case Mockname @equal bson.M{},nil
func Log ¶
Log secure chain API response. b - Bytes of API response. return bson.M of response. map. @test @case []byte("{}") @equal bson.M{}
func ReadBody ¶
Return bytes of *http.Response body. r - response to read body form. @test @import "net/http" @import "strings" @import "io/ioutil" @case &http.Response{Body : ioutil.NopCloser(strings.NewReader("test") )} @equal []byte("test")
func Save ¶
Save and encrypt the specified interface with the specified name. The function will add prefix SessionStorePath to the name specifed. @test @case Mockname, bson.M{} @equal nil
func ToMap ¶
Convert json string to bson.M. @import "gopkg.in/mgo.v2/bson" @test @case "{}" @equal bson.M{}, nil
Types ¶
type AuthRequest ¶
type AuthRequest struct {
Email, Password, Data string
}