securechain

package module
v0.0.0-...-33ea14c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2017 License: BSD-3-Clause Imports: 8 Imported by: 0

README

GoDoc

go-securechain

Set of SecureChain command line tools, this will facilitate working with the API, written in go.

Install

go get github.com/cheikhshift/go-securechain

List of commands

Get documentation on each command by running it with flag h.

sc-login

Generate a new access token for user.

Install
go get github.com/cheikhshift/go-securechain/cmd/sc-login
sc-confirm-phone

Confirm a verification code sent to a user's phone.

Install
go get github.com/cheikhshift/go-securechain/cmd/sc-confirm-phone
sc-create-account

Create a new SecureChain user account.

Install
go get github.com/cheikhshift/go-securechain/cmd/sc-create-account
sc-reset-password

Send new password to user's email.

Install
go get github.com/cheikhshift/go-securechain/cmd/sc-reset-password
sc-logout

Delete specified access token.

Install
go get github.com/cheikhshift/go-securechain/cmd/sc-logout
sc-encrypt

Encrypt a string or file.

Install
go get github.com/cheikhshift/go-securechain/cmd/sc-encrypt
sc-decrypt

Decrypt a string or file.

Install
go get github.com/cheikhshift/go-securechain/cmd/sc-decrypt

Documentation

Index

Constants

View Source
const ContentJson string = "application/json"
View Source
const SessionStorePath string = "."

Path of folder to save session files and load them.

Variables

View Source
var Decrypt = Endpoint("Decrypt")

URL of Decrypt endpoint.

View Source
var DeleteToken = Endpoint("DeleteToken")

URL of DeleteToken endpoint.

View Source
var Encrypt = Endpoint("Encrypt")

URL of Encrypt endpoint.

View Source
var Join string = Endpoint("Join")

URL of Join endpoint.

View Source
var Key []byte = []byte("a very very very very secret key")

Key used to encrypt/decrypt session information. Must be a valid AES key.

View Source
var Login string = Endpoint("Login")

URL of Login endpoint.

View Source
var Mockname = Mockfilename()
View Source
var ResetPassword = Endpoint("ForgotPassword")

URL of reset password endpoint.

View Source
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

func Endpoint(s string) string

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

func Load(name *string) (bson.M, error)

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

func Log(b []byte) bson.M

Log secure chain API response. b - Bytes of API response. return bson.M of response. map. @test @case []byte("{}") @equal bson.M{}

func Mockfilename

func Mockfilename() *string

Generate mock file name

func ReadBody

func ReadBody(r *http.Response) []byte

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

func Save(name *string, v interface{}) error

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

func ToMap(s string) (bson.M, error)

Convert json string to bson.M. @import "gopkg.in/mgo.v2/bson" @test @case "{}" @equal bson.M{}, nil

func ToString

func ToString(v interface{}) string

Convert specified interface to a json string. v - interface to convert to json. return json string of interface. @test @case bson.M{} @equal "{}"

func WrapReq

func WrapReq(v interface{}) bson.M

Wrap the specified interface arround a bson.M map, under key req. @test @case bson.M{} @equal bson.M{"req":bson.M{}}

Types

type AuthRequest

type AuthRequest struct {
	Email, Password, Data string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL