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: over 1 year 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 (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-12-15T01:51:19.000Z (over 1 year ago)
- Last Synced: 2025-03-26T18:56:18.523Z (over 1 year ago)
- Topics: go, go-twca, library, sdk, twca
- Language: Go
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go TWCA
[](https://github.com/flc1125/go-twca/releases)
[](https://pkg.go.dev/github.com/flc1125/go-twca)
[](https://codecov.io/gh/flc1125/go-twca)
[](https://goreportcard.com/report/github.com/flc1125/go-twca)
[](https://github.com/flc1125/go-twca/actions/workflows/lint.yml)
[](https://github.com/flc1125/go-twca/actions/workflows/test.yml)
[](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 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
[](https://opensource.org/licenses/MIT)