Documentation ¶
Index ¶
- Constants
- Variables
- func GoStrings(cStrings **C.char) []string
- type APDU
- type ActivationCode
- type ConfiguredAddresses
- type DefaultLogger
- type DownloadOption
- type DownloadProgress
- type EuiccInfo2
- type ExtCardResource
- type Libeuicc
- func (e *Libeuicc) Close()
- func (e *Libeuicc) DeleteNotification(seqNumber int) error
- func (e *Libeuicc) DeleteProfile(iccid string) error
- func (e *Libeuicc) DisableProfile(iccid string, refresh bool) error
- func (e *Libeuicc) Discover(smds string, imei string) ([]*RspServerAddress, error)
- func (e *Libeuicc) DownloadProfile(ctx context.Context, activationCode *ActivationCode, ...) error
- func (e *Libeuicc) EnableProfile(iccid string, refresh bool) error
- func (e *Libeuicc) GetConfiguredAddresses() (*ConfiguredAddresses, error)
- func (e *Libeuicc) GetEid() (string, error)
- func (e *Libeuicc) GetEuiccInfo2() (*EuiccInfo2, error)
- func (e *Libeuicc) GetNotifications() ([]*Notification, error)
- func (e *Libeuicc) GetProfiles() ([]*Profile, error)
- func (e *Libeuicc) ProcessNotification(seqNumber int, remove bool) error
- func (e *Libeuicc) Reset() error
- func (e *Libeuicc) SetDefaultSMDPAddress(address string) error
- func (e *Libeuicc) SetNickname(iccid, nickname string) error
- type Logger
- type Notification
- type NotificationProfileManagementOperation
- type ProfilceClass
- type Profile
- type ProfileIconType
- type ProfileMetadata
- type ProfileState
- type RspServerAddress
Constants ¶
const ( ProfileStateEnabled ProfileState = "enabled" ProfileStateDisabled ProfileState = "disabled" ProfileIconTypeNone ProfileIconType = "none" ProfileIconTypeJPG ProfileIconType = "jpeg" ProfileIconTypePNG ProfileIconType = "png" ProfileClassOperational ProfilceClass = "operational" ProfileClassTest ProfilceClass = "test" ProfileClassProvisioning ProfilceClass = "provisioning" DownloadProgressGetChallenge DownloadProgress = 1 DownloadProgressInitiateAuthentication DownloadProgress = 2 DownloadProgressAuthenticateServer DownloadProgress = 3 DownloadProgressAuthenticateClient DownloadProgress = 4 DownloadProgressConfirmationCodeRequired DownloadProgress = 5 DownloadProgressConfirmDownload DownloadProgress = 6 DownloadProgressPrepareDownload DownloadProgress = 7 DownloadProgressGetBoundProfile DownloadProgress = 9 DownloadProgressLoadBoundProfile DownloadProgress = 10 NotificationProfileManagementOperationDisable NotificationProfileManagementOperation = "disable" NotificationProfileManagementOperationEnable NotificationProfileManagementOperation = "enable" NotificationProfileManagementOperationInstall NotificationProfileManagementOperation = "install" NotificationProfileManagementOperationDelete NotificationProfileManagementOperation = "delete" CError C.int = -1 CSuccess C.int = 0 )
const ( LogDebugLevel slog.Level = slog.LevelDebug LogInfoLevel slog.Level = slog.LevelInfo LogWarnLevel slog.Level = slog.LevelWarn LogErrorLevel slog.Level = slog.LevelError )
const APDUMTU = 240
Variables ¶
var ( ErrDownloadCanceled = errors.New("download canceled") ErrConfirmationCodeRequired = errors.New("confirmation code required") )
var ( ErrEuiccInitFailed = errors.New("euicc_init failed") ErrNotEnoughMemory = errors.New("not enough memory") )
Functions ¶
Types ¶
type APDU ¶
type APDU interface { // Connect connects to the APDU interface. This is called before any other APDU operation. Connect() error // Disconnect disconnects from the APDU interface. This is called after the command execution is completed. Disconnect() error // Transmit sends the command to the APDU interface and returns the response. Transmit(command []byte) ([]byte, error) // OpenLogicalChannel opens a logical channel with the given AID and returns the channel number. OpenLogicalChannel(aid []byte) (int, error) // CloseLogicalChannel closes the logical channel with the given channel number. CloseLogicalChannel(channel int) error }
type ActivationCode ¶
type ConfiguredAddresses ¶
type DefaultLogger ¶
type DefaultLogger struct {
// contains filtered or unexported fields
}
func (*DefaultLogger) Debug ¶
func (l *DefaultLogger) Debug(format string, args ...any)
func (*DefaultLogger) Info ¶
func (l *DefaultLogger) Info(format string, args ...any)
func (*DefaultLogger) Warn ¶
func (l *DefaultLogger) Warn(format string, args ...any)
type DownloadOption ¶
type DownloadOption struct { // ProgressBar is the callback function to handle the download progress. ProgressBar func(progress DownloadProgress) // ConfirmFunc is the callback function to confirm the download. // If it is not set, the download will be confirmed automatically. // If the function returns false, the download will be canceled. ConfirmFunc func(metadata *ProfileMetadata) bool // ConfirmationCodeFunc is the callback function to get the confirmation code. // If you do not set it and a confirmation code is required, the download will be canceled. ConfirmationCodeFunc func() string }
type DownloadProgress ¶
type DownloadProgress int
type EuiccInfo2 ¶
type EuiccInfo2 struct { SasAccreditationNumber string ProfileVersion string FirmwareVersion string ExtCardResource ExtCardResource CiPKIdForSigning []string }
type ExtCardResource ¶
type Libeuicc ¶
type Libeuicc struct {
// contains filtered or unexported fields
}
func (*Libeuicc) Close ¶
func (e *Libeuicc) Close()
Close closes the Libeuicc instance. It must be called when the instance is no longer needed.
func (*Libeuicc) DeleteNotification ¶
DeleteNotification deletes the notification with the given sequence number.
func (*Libeuicc) DeleteProfile ¶
DeleteProfile deletes the profile with the given ICCID. Once a profile is deleted, it cannot be recovered, and you must send the delete notification via `ProcessNotification` to the SM-DP+ server. otherwise, you may can't install it on another one of your devices.
func (*Libeuicc) DisableProfile ¶
DisableProfile disables the profile with the given ICCID. It's recommanded to send a disable notification via `ProcessNotification` to the SM-DP+ server. Some eUICC chips may require a refresh flag. See the GSMA SGP.22 v2.2.2 for more information.
func (*Libeuicc) Discover ¶
func (e *Libeuicc) Discover(smds string, imei string) ([]*RspServerAddress, error)
Discover discovers the RSP server address. If SM-DS is empty, it will try to discover the RSP server address from the default SM-DS servers.
func (*Libeuicc) DownloadProfile ¶
func (e *Libeuicc) DownloadProfile(ctx context.Context, activationCode *ActivationCode, downloadOption *DownloadOption) error
DownloadProfile downloads the eSIM profile from the SM-DP+ server.
func (*Libeuicc) EnableProfile ¶
EnableProfile enables the profile with the given ICCID. It's recommended to send an enable notification via `ProcessNotification` to the SM-DP+ server. Some eUICC chips may require a refresh flag. See the GSMA SGP.22 v2.2.2 for more information.
func (*Libeuicc) GetConfiguredAddresses ¶
func (e *Libeuicc) GetConfiguredAddresses() (*ConfiguredAddresses, error)
GetConfiguredAddresses returns the configured addresses of the eUICC. It includes the default SM-DP+ address and root SM-DS address.
func (*Libeuicc) GetEuiccInfo2 ¶
func (e *Libeuicc) GetEuiccInfo2() (*EuiccInfo2, error)
GetEuiccInfo2 returns the eUICC information. It includes the SAS accreditation number, profile version, firmware version, card resource, and CI PKI ID list for signing.
func (*Libeuicc) GetNotifications ¶
func (e *Libeuicc) GetNotifications() ([]*Notification, error)
GetNotifications returns the list of notifications.
func (*Libeuicc) GetProfiles ¶
GetProfiles returns the installed profiles.
func (*Libeuicc) ProcessNotification ¶
ProcessNotification processes the notification with the given sequence number. If remove is true, the notification will be removed from the eUICC.
func (*Libeuicc) Reset ¶
Reset resets the eUICC memory. Attention: This operation will erase all the data on the eUICC.
func (*Libeuicc) SetDefaultSMDPAddress ¶
SetDefaultSMDPAddress sets the default SM-DP+ address of the eUICC.
func (*Libeuicc) SetNickname ¶
SetNickname sets the nickname of the profile with the given ICCID. The nickname cannot be longer than 64 UTF-8 bytes.
type Logger ¶
type Logger interface { Debug(format string, args ...any) Info(format string, args ...any) Warn(format string, args ...any) Error(format string, err error, args ...any) }
func NewDefaultLogger ¶
type Notification ¶
type Notification struct { SeqNumber int ProfileManagementOperation NotificationProfileManagementOperation NotificationAddress string Iccid string }
type NotificationProfileManagementOperation ¶
type NotificationProfileManagementOperation string
type ProfilceClass ¶
type ProfilceClass string
type Profile ¶
type Profile struct { Iccid string IsdpAid string State ProfileState Nickname string ProviderName string ProfileName string IconType ProfileIconType Icon string Class ProfilceClass }
type ProfileIconType ¶
type ProfileIconType string
type ProfileMetadata ¶
type ProfileState ¶
type ProfileState string
type RspServerAddress ¶
type RspServerAddress struct { // RspServerAddress is the provisioned RSP server address. You can use this address to download the eSIM profile. RspServerAddress string }