Documentation
¶
Index ¶
- Variables
- type ActivationCode
- type Client
- func (c *Client) AuthenticateClient(address *url.URL, request *sgp22.AuthenticateServerRequest) (*sgp22.ES9AuthenticateClientResponse, error)
- func (c *Client) Close() error
- func (c *Client) DeleteProfile(identifier any) error
- func (c *Client) DisableProfile(identifier any, refresh bool) error
- func (c *Client) Discovery(address *url.URL, IMEI []byte) ([]*sgp22.EventEntry, error)
- func (c *Client) DownloadProfile(ctx context.Context, ac *ActivationCode, handler DownloadHandler) (*sgp22.LoadBoundProfilePackageResponse, error)
- func (c *Client) EID() ([]byte, error)
- func (c *Client) EUICCChallenge() ([]byte, error)
- func (c *Client) EUICCConfiguredAddresses() (*EUICCConfiguredAddresses, error)
- func (c *Client) EUICCInfo1() (*bertlv.TLV, error)
- func (c *Client) EUICCInfo2() (*bertlv.TLV, error)
- func (c *Client) EnableProfile(identifier any, refresh bool) error
- func (c *Client) HandleNotification(pendingNotification *sgp22.PendingNotification) error
- func (c *Client) InitiateAuthentication(address *url.URL) (*sgp22.ES9InitiateAuthenticationResponse, error)
- func (c *Client) ListNotification(filters ...sgp22.NotificationEvent) ([]*sgp22.NotificationMetadata, error)
- func (c *Client) ListProfile(searchCriteria any, tags []bertlv.Tag) ([]*sgp22.ProfileInfo, error)
- func (c *Client) MemoryReset() error
- func (c *Client) PrepareDownload(address *url.URL, request *sgp22.PrepareDownloadRequest) (*sgp22.ES9BoundProfilePackageResponse, error)
- func (c *Client) RemoveNotificationFromList(sequenceNumber sgp22.SequenceNumber) error
- func (c *Client) RetrieveNotificationList(searchCriteria any) ([]*sgp22.PendingNotification, error)
- func (c *Client) SetDefaultDPAddress(address string) error
- func (c *Client) SetNickname(iccid sgp22.ICCID, nickname string) error
- type DownloadHandler
- type DownloadProgress
- type EUICCConfiguredAddresses
- type Option
Constants ¶
This section is empty.
Variables ¶
var GSMAISDRApplicationAID = []byte{0xA0, 0x00, 0x00, 0x05, 0x59, 0x10, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0x89, 0x00, 0x00, 0x01, 0x00}
GSMAISDRApplicationAID is the AID of the GSMA SGP.02 ISD-R application. See https://www.gsma.com/solutions-and-impact/technologies/esim/wp-content/uploads/2020/07/SGP.02-v4.2.pdf#page=26 (Section 2.2.3 Identification of Security Domains: AID and TAR)
Functions ¶
This section is empty.
Types ¶
type ActivationCode ¶
type Client ¶
type Client struct { HTTP *http.Client APDU sgp22.Transmitter // contains filtered or unexported fields }
Client is the main structure for the LPA client.
func (*Client) AuthenticateClient ¶
func (c *Client) AuthenticateClient(address *url.URL, request *sgp22.AuthenticateServerRequest) (*sgp22.ES9AuthenticateClientResponse, error)
AuthenticateClient authenticates the client to the eUICC.
See https://aka.pw/sgp22/v2.5#page=195 (Section 5.7.13, ES10b.AuthenticateClient)
func (*Client) Close ¶ added in v0.0.10
Close closes the LPA client and the underlying APDU transmitter. You should call this method when you are done using the client to release resources.
func (*Client) DeleteProfile ¶
DeleteProfile deletes a profile. The profile is identified by the ICCID or ISD-P AID.
ProfileInfo Identifier: - sgp22.ICCID: The ICCID of the profile. - sgp22.ISDPAID: The ISD-P AID of the profile.
See https://aka.pw/sgp22/v2.5#page=206 (Section 5.7.18, ES10c.DeleteProfile)
func (*Client) DisableProfile ¶
DisableProfile disables a profile. The profile is identified by the ICCID or ISD-P AID.
ProfileInfo Identifier: - sgp22.ICCID: The ICCID of the profile. - sgp22.ISDPAID: The ISD-P AID of the profile.
See https://aka.pw/sgp22/v2.5#page=204 (Section 5.7.17, ES10c.DisableProfile)
func (*Client) Discovery ¶
Discovery discovers the downloadable profiles from SM-DS.
See https://aka.pw/sgp22/v2.5#page=212 (Section 5.8.2, ES11.AuthenticateClient)
func (*Client) DownloadProfile ¶
func (c *Client) DownloadProfile(ctx context.Context, ac *ActivationCode, handler DownloadHandler) (*sgp22.LoadBoundProfilePackageResponse, error)
func (*Client) EID ¶
EID returns the EID of the eUICC. The EID is a unique identifier of the eUICC.
See https://aka.pw/sgp22/v2.5#page=209 (Section 5.7.20, ES10c.GetEID)
func (*Client) EUICCChallenge ¶
func (*Client) EUICCConfiguredAddresses ¶
func (c *Client) EUICCConfiguredAddresses() (*EUICCConfiguredAddresses, error)
EUICCConfiguredAddresses returns the default SM-DP+ address and the root SM-DS address.
See https://aka.pw/sgp22/v2.5#page=183 (Section 5.7.3, ES10a.GetEuiccConfiguredAddresses)
func (*Client) EUICCInfo1 ¶
EUICCInfo1 retrieves the eUICC information (version 1).
See https://aka.pw/sgp22/v2.5#page=187 (Section 5.7.8, ES10b.GetEUICCInfo)
func (*Client) EUICCInfo2 ¶
EUICCInfo2 retrieves the eUICC information (version 2).
See https://aka.pw/sgp22/v2.5#page=187 (Section 5.7.8, ES10b.GetEUICCInfo)
func (*Client) EnableProfile ¶
EnableProfile enables a profile. The profile is identified by the ICCID or ISD-P AID.
ProfileInfo Identifier: - sgp22.ICCID: The ICCID of the profile. - sgp22.ISDPAID: The ISD-P AID of the profile.
See https://aka.pw/sgp22/v2.5#page=201 (Section 5.7.16, ES10c.EnableProfile)
func (*Client) HandleNotification ¶
HandleNotification handles the pending notification.
See https://aka.pw/sgp22/v2.5#page=177 (Section 5.6.4, ES9p.HandleNotification)
func (*Client) InitiateAuthentication ¶
func (c *Client) InitiateAuthentication(address *url.URL) (*sgp22.ES9InitiateAuthenticationResponse, error)
InitiateAuthentication initiates the authentication process.
See https://aka.pw/sgp22/v2.5#page=170 (Section 5.6.1, ES9p.InitiateAuthentication)
func (*Client) ListNotification ¶
func (c *Client) ListNotification(filters ...sgp22.NotificationEvent) ([]*sgp22.NotificationMetadata, error)
ListNotification retrieves a list of notifications from the eUICC.
See https://aka.pw/sgp22/v2.5#page=191 (Section 5.7.9, ES10b.ListNotification)
func (*Client) ListProfile ¶
ListProfile returns a list of profiles that match the search criteria. If the search criteria is empty, all profiles are returned. The tags specify which additional data objects should be returned for each profile.
Search Criteria: - sgp22.ICCID: The ICCID of the profile. - sgp22.ISDPAID: The ISD-P AID of the profile. - sgp22.ProfileClass: The profile class of the profile.
See https://aka.pw/sgp22/v2.5#page=199 (Section 5.7.15, ES10c.GetProfilesInfo)
func (*Client) MemoryReset ¶
MemoryReset resets the eUICC memory. This operation deletes all operational profiles, field-loaded test profiles, and resets the default SM-DP+ address.
See https://aka.pw/sgp22/v2.5#page=207 (Section 5.7.19, ES10c.eUICCMemoryReset)
func (*Client) PrepareDownload ¶
func (c *Client) PrepareDownload(address *url.URL, request *sgp22.PrepareDownloadRequest) (*sgp22.ES9BoundProfilePackageResponse, error)
PrepareDownload prepares the eUICC for a profile download.
See https://aka.pw/sgp22/v2.5#page=184 (Section 5.7.13, ES10b.PrepareDownload)
func (*Client) RemoveNotificationFromList ¶
func (c *Client) RemoveNotificationFromList(sequenceNumber sgp22.SequenceNumber) error
func (*Client) RetrieveNotificationList ¶
func (c *Client) RetrieveNotificationList(searchCriteria any) ([]*sgp22.PendingNotification, error)
RetrieveNotificationList retrieves a list of notifications from the eUICC.
Search Criteria: - sgp22.SequenceNumber: The sequence number of the notification. - sgp22.NotificationEvent: The event type of the notification.
func (*Client) SetDefaultDPAddress ¶
SetDefaultDPAddress sets the default SM-DP+ address.
See https://aka.pw/sgp22/v2.5#page=183 (Section 5.7.4, ES10a.SetDefaultDpAddress)
func (*Client) SetNickname ¶
SetNickname sets the nickname of the profile.
See https://aka.pw/sgp22/v2.5#page=209 (Section 5.7.21, ES10c.SetNickname)
type DownloadHandler ¶
type DownloadHandler interface { Progress(process DownloadProgress) Confirm(metadata *sgp22.ProfileInfo) chan bool ConfirmationCode() chan string }
type DownloadProgress ¶
type DownloadProgress uint8
const ( DownloadProgressAuthenticateClient DownloadProgress = iota DownloadProgressAuthenticateServer DownloadProgressLoadBPP )
type Option ¶ added in v0.0.10
type Option struct { // Channel is the channel for APDU communication. It is required for APDU communication. Channel apdu.SmartCardChannel // AID is the application identifier for the GSMA ISD-R application. It defaults to GSMA ISD-R Application AID. AID []byte // MSS is the maximum APDU size. It defaults to 240. MSS int // AdminProtocolVersion is the version of the admin protocol. It defaults to "v2.2.0". AdminProtocolVersion string // Logger is the logger for the LPA client. It defaults to slog.Default(). Logger *slog.Logger // Timeout is the timeout for the HTTP client. It defaults to 30 seconds. Timeout time.Duration }
Option is the configuration for the LPA client. It includes the channel for APDU communication, logger, AID, maximum APDU size (MSS), admin protocol version, and timeout.