Skip to content

damonto/libeuicc-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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")
}

About

Libeuicc Go bindings

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published