Libeuicc Go bindings
Find a file
2025-01-09 10:35:09 +08:00
.github feat(ci): add dependabot for version updates 2024-09-09 19:23:28 +08:00
.vscode chore: update QMI driver dependencies 2024-09-10 13:03:32 +08:00
driver chore: Update dependencies 2024-10-14 16:51:51 +08:00
lpac@62eb766d14 chore: update dependencies 2025-01-09 10:35:09 +08:00
.gitignore chore: remove unnecessary files and update .gitignore 2024-09-08 18:45:51 +08:00
.gitmodules first commit 2024-09-07 22:37:27 +08:00
apdu.go chore: remove unused qmi_priv variable 2024-11-07 14:40:52 +08:00
base64.c feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
base64.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
chip.go fix: incorrect comment 2024-11-07 14:34:28 +08:00
cJSON.c feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
cJSON.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
cJSON_ex.c feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
cJSON_ex.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
constant.go chore: Rename COK to CSuccess 2024-10-14 15:36:58 +08:00
copy.sh feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
derutil.c feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
derutil.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
discover.go chore: update lpac version 2024-10-14 15:21:41 +08:00
download.go chore: Rename COK to CSuccess 2024-10-14 15:36:58 +08:00
es8p.c feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
es8p.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
es9p.c feat: Update lpac to the latest version 2024-09-09 11:16:10 +08:00
es9p.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
es9p_errors.c feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
es9p_errors.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
es10a.c feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
es10a.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
es10b.c refactor: Refactor APDU interface initialization and handle progress in DownloadProfile 2024-09-09 11:01:19 +08:00
es10b.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
es10c.c feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
es10c.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
es10c_ex.c feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
es10c_ex.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
euicc.c chore: update lpac version 2024-10-14 15:21:41 +08:00
euicc.h chore: update lpac version 2024-10-14 15:21:41 +08:00
euicc.private.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
go.mod refactor: move the apdu drivers to a separate package 2024-09-10 12:34:21 +08:00
go.sum refactor: move the apdu drivers to a separate package 2024-09-10 12:34:21 +08:00
hexutil.c feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
hexutil.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
http.go chore: Rename COK to CSuccess 2024-10-14 15:36:58 +08:00
interface.c feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
interface.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
interface.private.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
libeuicc.go chore: update lpac version 2024-10-14 15:21:41 +08:00
LICENSE chore: Update LICENSE 2024-09-09 00:02:15 +08:00
logger.go refacotr: refactor APDU context and logger functions 2024-09-09 21:58:02 +08:00
notification.go chore: update lpac version 2024-10-14 15:21:41 +08:00
profile.go chore: Rename COK to CSuccess 2024-10-14 15:36:58 +08:00
README.md refactor: Rename NewXx to New 2024-09-10 17:55:57 +08:00
sha256.c feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
sha256.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
tostr.c feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
tostr.h feat: copy libeuicc files to project directory 2024-09-08 18:31:58 +08:00
util.go chore: remove unnecessary files and update package names 2024-09-08 18:04:55 +08:00

Libeuicc Go bindings

Example

package main

import (
	"context"
	"fmt"
	"time"

	"github.com/damonto/libeuicc-go"
	"github.com/damonto/libeuicc-go/driver/pcsc"
)

func main() {
	pcscReader, err := pcsc.New()
	if err != nil {
		fmt.Println(err)
		return
	}
	euicc, err := libeuicc.New(pcscReader, libeuicc.NewDefaultLogger(libeuicc.LogErrorLevel))
	if err != nil {
		fmt.Println(err)
		return
	}
	defer euicc.Close()

	fmt.Println(euicc.GetEid())

	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
	err = euicc.DownloadProfile(ctx, &libeuicc.ActivationCode{
		SMDP:       "rsp.septs.app",
		MatchingId: "123413231",
	}, &libeuicc.DownloadOption{
		ProgressBar: func(progress libeuicc.DownloadProgress) {
			// If you want to download, please remove this line.
			if progress == libeuicc.DownloadProgressGetBoundProfile {
				cancel()
			}
			fmt.Println(progress)
		},
		ConfirmationCodeFunc: func() string {
			fmt.Println("Please input confirmation code:")
			return ""
		},
		ConfirmFunc: func(metadata *libeuicc.ProfileMetadata) bool {
			fmt.Println(metadata)
			return false
		},
	})

	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println("Download profile success")
}