mfa-service

command module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2019 License: MIT Imports: 14 Imported by: 0

README

mfa-service

Build Status codecov

Prerequisites

Requires a go installation. Requires a redis installation.

Running the service

This service works as Go-Micro microservice. You may want to setup your own registry with MICRO_REGISTRY/MICRO_REGISTRY_ADDRESS or use other go-micro flags. Set the environment variable with the address of the redis server, for example REDIS_ADDR=127.0.0.1:6379.

Download it

go get github.com/ProtocolONE/mfa-service

If you need it uou can rebuild proto file with protoc

protoc --proto_path=. --micro_out=. --go_out=. mfa.proto

By default service will be executed with declared by MICRO_REGISTRY registry and GRPC as a transport.

Using Docker

The docker file in this project used to launch mfa-service in Protocol One environment. You may change it in any way you need it.

Using the service

Once the service is running you can use go-micro to make requests

package main

import (
    "context"
    "fmt"
    "github.com/micro/go-micro"
    "github.com/ProtocolONE/mfa-service/pkg"
    "github.com/ProtocolONE/mfa-service/pkg/proto"
)

func main() {
    // create a new service
    service := micro.NewService()

    // parse command line flags
    service.Init()

    // Create new greeter client
    client := proto.NewMfaService(mfa.ServiceName, service.Client())

    // Call it
    rsp, err := client.Create(
    	context.TODO(), 
    	&proto.MfaCreateDataRequest{
    		ProviderID: "12312312312313",
    		AppName:    "dummy", 
    		UserID:     "123132123123",
    		Email:      "test@test.com",
    		QrSize:     300,
    	})
    if err != nil {
        fmt.Println(err)
    }

    // Print response
    fmt.Println(rsp)
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
proto
Package proto is a generated protocol buffer package.
Package proto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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