8000 GitHub - flc1125/go-twca: TWCA is a Go library for Taiwan Certificate Authority (TWCA) services.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

flc1125/go-twca

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go TWCA

Go Version GoDoc codecov Go Report Card lint test MIT license

TWCA is a Go library for Taiwan Certificate Authority (TWCA) services.

Installation

go get github.com/flc1125/go-twca

Usage

MID

package main

import (
	"context"
	"time"

	"github.com/flc1125/go-twca/mid"
)

var ctx = context.Background()

func init() {
	time.Local = time.UTC
}

func main() {
	client := mid.New(&mid.Config{
		Addr:       "https://midonlinetest.twca.com.tw",
		BusinessNo: ".....",
		HashKeyNo:  ".....",
		HashKey:    ".....",
	})

	// MIDClause
	resp, err := client.Clause(ctx)
	if err != nil {
		panic(err)
	}
	_ = resp

	// ServerSideTransaction
	resp2, err := client.ServerSideTransaction(ctx, mid.ServerSideTransactionRequest{
		VerifyNo: mid.DefaultGenerator.Generate(),
		MemberNo: ".....",
		Action:   mid.ValidateMSISDNAdvanceAction,
		MIDInputParams: &mid.MIDInputParams{
			Msisdn:     ".....",
			Birthday:   nil,
			ClauseVer:  ".....",
			ClauseTime: ".....",
		},
	})
	if err != nil {
		panic(err)
	}
	_ = resp2

	// ServerSideVerifyResult
	resp3, err := client.ServerSideVerifyResult(ctx, mid.ServerSideVerifyResultRequest{
		VerifyNo: resp2.VerifyNo,
		MemberNo: resp2.OutputParams.MemberNo,
		Token:    resp2.OutputParams.Token,
	})
	if err != nil {
		panic(err)
	}
	_ = resp3

}

License

MIT license

About

TWCA is a Go library for Taiwan Certificate Authority (TWCA) services.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  
0