Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flc1125/go-twca
TWCA is a Go library for Taiwan Certificate Authority (TWCA) services.
https://github.com/flc1125/go-twca
go go-twca library sdk twca
Last synced: 17 days ago
JSON representation
TWCA is a Go library for Taiwan Certificate Authority (TWCA) services.
- Host: GitHub
- URL: https://github.com/flc1125/go-twca
- Owner: flc1125
- License: mit
- Created: 2024-03-07T01:22:24.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-11-25T13:54:47.000Z (27 days ago)
- Last Synced: 2024-11-25T14:29:23.923Z (27 days ago)
- Topics: go, go-twca, library, sdk, twca
- Language: Go
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go TWCA
[![Go Version](https://badgen.net/github/release/flc1125/go-twca/stable)](https://github.com/flc1125/go-twca/releases)
[![GoDoc](https://pkg.go.dev/badge/github.com/flc1125/go-twca)](https://pkg.go.dev/github.com/flc1125/go-twca)
[![codecov](https://codecov.io/gh/flc1125/go-twca/graph/badge.svg?token=i8RgDRbbDD)](https://codecov.io/gh/flc1125/go-twca)
[![Go Report Card](https://goreportcard.com/badge/github.com/flc1125/go-twca)](https://goreportcard.com/report/github.com/flc1125/go-twca)
[![lint](https://github.com/flc1125/go-twca/actions/workflows/lint.yml/badge.svg)](https://github.com/flc1125/go-twca/actions/workflows/lint.yml)
[![test](https://github.com/flc1125/go-twca/actions/workflows/test.yml/badge.svg)](https://github.com/flc1125/go-twca/actions/workflows/test.yml)
[![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)TWCA is a Go library for Taiwan Certificate Authority ([TWCA](https://www.twca.com.tw/)) services.
## Installation
```bash
go get github.com/flc1125/go-twca
```## Usage
### MID
```go
package mainimport (
"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](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)