### lpa.Client.DownloadProfile Source: https://context7.com/damonto/euicc-go/llms.txt Downloads and installs a profile from an SM-DP+ server using an activation code. This function orchestrates the complete RSP flow, including client and server authentication, and BPP installation. It supports context cancellation, progress callbacks, user confirmation prompts, and confirmation code entry. ```APIDOC ## `lpa.Client.DownloadProfile` — Download and Install a Profile Downloads a profile from an SM-DP+ server using an activation code, performing the full RSP flow: client authentication, server authentication, and BPP installation. Supports context cancellation, progress callbacks, user confirmation, and confirmation code prompts. Implements ES10b + ES9p flow per SGP.22 §4.1. ### Parameters #### Context - **ctx** (context.Context) - Context for cancellation and deadlines. #### Activation Code - **ac** (*lpa.ActivationCode) - The activation code containing SM-DP+ server details and matching ID. #### Options - **opts** (*lpa.DownloadOptions) - Optional settings for the download process: - **OnProgress** (func(lpa.DownloadStage)) - Callback function for download progress updates. - **OnConfirm** (func(*sgp22.ProfileInfo) bool) - Callback function for user confirmation prompts. - **OnEnterConfirmationCode** (func() string) - Callback function to enter a confirmation code if required. ### Returns - **(*lpa.Result)** - Result object containing information about the installed profile, including its ISD-P AID. - **error** - An error if the download or installation fails. ``` -------------------------------- ### List Installed eSIM Profiles Source: https://context7.com/damonto/euicc-go/llms.txt Fetches a list of installed eSIM profiles on the eUICC. Supports filtering by profile class and requesting additional BER-TLV tags. ```go import ( sgp22 "github.com/damonto/euicc-go/v2" ) // List all profiles (nil = no filter) profiles, err := client.ListProfile(nil, nil) if err != nil { panic(err) } for _, p := range profiles { fmt.Printf("ICCID: %s | Name: %s | Provider: %s | State: %s | Class: %s\n", p.ICCID, p.ProfileName, p.ServiceProviderName, p.ProfileState, p.ProfileClass) } // Output: // ICCID: 8944474600000109689 | Name: MyOperator | Provider: Acme Corp | State: enabled | Class: operational // Filter by profile class operationalProfiles, err := client.ListProfile(sgp22.ProfileClassOperational, nil) if err != nil { panic(err) } fmt.Printf("Found %d operational profile(s)\n", len(operationalProfiles)) ``` -------------------------------- ### Download and Install eUICC Profile Source: https://context7.com/damonto/euicc-go/llms.txt Downloads a profile from an SM-DP+ server using an activation code, performing the full RSP flow. Supports context cancellation, progress callbacks, user confirmation, and confirmation code prompts. ```go import ( "context" "fmt" "net/url" "github.com/damonto/euicc-go/lpa" sgp22 "github.com/damonto/euicc-go/v2" ) ctx, cancel := context.WithCancel(context.Background()) defuncancel() ac := &lpa.ActivationCode{ SMDP: &url.URL{Scheme: "https", Host: "smdp.example.com"}, MatchingID: "QR-G-5C-1LS-1W1Z9P7", IMEI: "356938035643809", } result, err := client.DownloadProfile(ctx, ac, &lpa.DownloadOptions{ OnProgress: func(stage lpa.DownloadStage) { fmt.Println("Stage:", stage) // "Authenticating Client", "Authenticating Server", "Installing" }, OnConfirm: func(metadata *sgp22.ProfileInfo) bool { fmt.Printf("Confirm install of '%s' from '%s'?\n", metadata.ProfileName, metadata.ServiceProviderName) return true // return false to cancel }, OnEnterConfirmationCode: func() string { return "1234" // return empty string to abort if code required }, }) if err != nil { panic(fmt.Sprintf("download failed: %v", err)) } if result != nil { fmt.Printf("Installed ISD-P AID: %X\n", result.ISDPAID()) } ``` -------------------------------- ### lpa.Client.ListProfile — List Installed Profiles Source: https://context7.com/damonto/euicc-go/llms.txt Returns a list of installed eSIM profiles on the eUICC. It supports optional search criteria and a list of additional BER-TLV tags to fetch, implementing ES10c.GetProfilesInfo per SGP.22 §5.7.15. ```APIDOC ## lpa.Client.ListProfile — List Installed Profiles Returns installed eSIM profiles on the eUICC. Accepts optional search criteria (`sgp22.ICCID`, `sgp22.ISDPAID`, or `sgp22.ProfileClass`) and a list of additional BER-TLV tags to fetch. Implements ES10c.GetProfilesInfo per SGP.22 §5.7.15. ### Method Signature ```go func (c *Client) ListProfile(filter interface{}, tags []int) ([]Profile, error) ``` ### Parameters #### Filter - **filter** (interface{}) - Optional - Criteria to filter profiles. Can be `sgp22.ICCID`, `sgp22.ISDPAID`, or `sgp22.ProfileClass`. - **tags** ([]int) - Optional - A list of additional BER-TLV tags to fetch for each profile. ### Response #### Success Response - **profiles** ([]Profile) - A slice of `Profile` structs, each containing details of an installed eSIM profile. - **ICCID** (string) - The ICCID of the profile. - **ProfileName** (string) - The name of the profile. - **ServiceProviderName** (string) - The name of the service provider. - **ProfileState** (string) - The current state of the profile (e.g., "enabled", "disabled"). - **ProfileClass** (string) - The class of the profile (e.g., "operational"). ### Request Example ```go import ( sgp22 "github.com/damonto/euicc-go/v2" ) // List all profiles (nil = no filter) profiles, err := client.ListProfile(nil, nil) if err != nil { panic(err) } for _, p := range profiles { fmt.Printf("ICCID: %s | Name: %s | Provider: %s | State: %s | Class: %s\n", p.ICCID, p.ProfileName, p.ServiceProviderName, p.ProfileState, p.ProfileClass) } // Filter by profile class operationalProfiles, err := client.ListProfile(sgp22.ProfileClassOperational, nil) if err != nil { panic(err) } fmt.Printf("Found %d operational profile(s)\n", len(operationalProfiles)) ``` ### Response Example ``` ICCID: 8944474600000109689 | Name: MyOperator | Provider: Acme Corp | State: enabled | Class: operational Found 1 operational profile(s) ``` ``` -------------------------------- ### Get eUICC Identifier (EID) Source: https://context7.com/damonto/euicc-go/llms.txt Retrieves the globally unique EID from the eUICC. This operation implements ES10c.GetEID as per SGP.22 §5.7.20. ```go eid, err := client.EID() if err != nil { panic(fmt.Sprintf("failed to get EID: %v", err)) } fmt.Printf("EID: %X\n", eid) // Output: EID: 89049032123456789012345678901234 ``` -------------------------------- ### lpa.Client.EID — Get eUICC Identifier Source: https://context7.com/damonto/euicc-go/llms.txt Retrieves the EID (eUICC Identifier), a globally unique 32-digit identifier permanently embedded in the eUICC. This method implements ES10c.GetEID as per SGP.22 §5.7.20. ```APIDOC ## lpa.Client.EID — Get eUICC Identifier Retrieves the EID (eUICC Identifier), a globally unique 32-digit identifier permanently embedded in the eUICC. Implements ES10c.GetEID per SGP.22 §5.7.20. ### Method Signature ```go func (c *Client) EID() ([]byte, error) ``` ### Response #### Success Response - **eid** ([]byte) - The 32-digit eUICC Identifier. ### Request Example ```go Eid, err := client.EID() if err != nil { panic(fmt.Sprintf("failed to get EID: %v", err)) } fmt.Printf("EID: %X\n", Eid) ``` ### Response Example ``` EID: 89049032123456789012345678901234 ``` ``` -------------------------------- ### Initialize QMI Driver for Qualcomm Modems Source: https://context7.com/damonto/euicc-go/llms.txt Initializes the QMI driver for Qualcomm modems. Supports initialization via qmi-proxy using a device path and slot, or via QRTR kernel transport without a device path. ```go import ( "github.com/damonto/euicc-go/driver/qmi" ) // Via qmi-proxy (device path + slot) ch, err := qmi.New("/dev/cdc-wdm0", 1) if err != nil { panic(err) } // Pass ch to lpa.New(...) // Via QRTR (kernel socket, no device path needed) chQrtr, err := qmi.NewQRTR(1) if err != nil { panic(err) } // Pass chQrtr to lpa.New(...) ``` -------------------------------- ### QMI Driver Source: https://context7.com/damonto/euicc-go/llms.txt Initializes the QMI driver for Qualcomm modems using the QMI UIM service. Supports communication via `qmi-proxy` or the QRTR kernel transport. ```APIDOC ## `driver/qmi` — QMI Driver Provides `apdu.SmartCardChannel` for Qualcomm modems using the QMI UIM service via `qmi-proxy`. Also supports the QRTR (Qualcomm IPC Router) kernel transport. ```go import ( "github.com/damonto/euicc-go/driver/qmi" ) // Via qmi-proxy (device path + slot) ch, err := qmi.New("/dev/cdc-wdm0", 1) if err != nil { panic(err) } // Pass ch to lpa.New(...) // Via QRTR (kernel socket, no device path needed) chQrtr, err := qmi.NewQRTR(1) if err != nil { panic(err) } // Pass chQrtr to lpa.New(...) ``` ``` -------------------------------- ### Initialize AT Command Modem Driver Source: https://context7.com/damonto/euicc-go/llms.txt Provides an `apdu.SmartCardChannel` for modems using AT+CSIM commands over a serial port (3GPP TS 27.007). This driver is suitable for USB modems or embedded LTE modules accessible as serial devices. ```go import "github.com/damonto/euicc-go/driver/at" ch, err := at.New("/dev/ttyUSB7") if err != nil { panic(fmt.Sprintf("failed to open serial port: %v", err)) } // Pass ch to lpa.New(...) ``` -------------------------------- ### Create LPA Client with CCID Driver Source: https://context7.com/damonto/euicc-go/llms.txt Initializes a new LPA client using the CCID driver for smart card reader communication. Ensure a smart card reader is connected and accessible. ```go package main import ( "fmt" "log/slog" "time" "github.com/damonto/euicc-go/driver/ccid" "github.com/damonto/euicc-go/lpa" ) func main() { ch, err := ccid.New() if err != nil { panic(err) } readers, err := ch.ListReaders() if err != nil || len(readers) == 0 { panic("no smart card readers found") } ch.SetReader(readers[0]) client, err := lpa.New(&lpa.Options{ Channel: ch, MSS: 254, // max APDU size, default 254 AdminProtocolVersion: "2.5.0", // SGP.22 version, default "2.5.0" Timeout: 30 * time.Second, // HTTP timeout, default 30s Logger: slog.Default(), }) if err != nil { panic(fmt.Sprintf("failed to create LPA client: %v", err)) } defer client.Close() fmt.Println("LPA client ready") // Output: LPA client ready } ``` -------------------------------- ### Initialize MBIM Driver for WWAN Modems Source: https://context7.com/damonto/euicc-go/llms.txt Initializes the MBIM driver for WWAN modems on Linux. Use for multi-slot devices, specifying the device path and slot number (1-based). ```go import "github.com/damonto/euicc-go/driver/mbim" // slot is 1-based; for a single-SIM device use slot=1 ch, err := mbim.New("/dev/cdc-wdm0", 1) if err != nil { panic(fmt.Sprintf("MBIM init failed: %v", err)) } // Pass ch to lpa.New(...) ``` -------------------------------- ### MBIM Driver Source: https://context7.com/damonto/euicc-go/llms.txt Initializes the MBIM driver for WWAN modems on Linux, supporting multi-slot devices. It provides an `apdu.SmartCardChannel` for communication via `mbim-proxy`. ```APIDOC ## `driver/mbim` — MBIM Driver Provides `apdu.SmartCardChannel` for modems using the MBIM protocol via `mbim-proxy`. Supports multi-slot devices with automatic slot activation. Use for WWAN modems on Linux (e.g., `/dev/cdc-wdm0`). ```go import "github.com/damonto/euicc-go/driver/mbim" // slot is 1-based; for a single-SIM device use slot=1 ch, err := mbim.New("/dev/cdc-wdm0", 1) if err != nil { panic(fmt.Sprintf("MBIM init failed: %v", err)) } // Pass ch to lpa.New(...) ``` ``` -------------------------------- ### Retrieve eUICC Capability Info with lpa.Client Source: https://context7.com/damonto/euicc-go/llms.txt Retrieves eUICC capability and status data in raw BER-TLV format using EUICCInfo1 and EUICCInfo2. EUICCInfo1 contains SVN and supported algorithms, while EUICCInfo2 includes additional details like public key IDs and policy rules. ```go import "github.com/damonto/euicc-go/bertlv" info1, err := client.EUICCInfo1() if err != nil { panic(err) } // info1 is a *bertlv.TLV; navigate the tree for specific fields fmt.Printf("EUICCInfo1 tag: %X\n", []byte(info1.Tag)) info2, err := client.EUICCInfo2() if err != nil { panic(err) } fmt.Printf("EUICCInfo2 children count: %d\n", len(info2.Children)) ``` -------------------------------- ### Parse and Serialize LPA Activation Code Source: https://context7.com/damonto/euicc-go/llms.txt Parses and serializes LPA activation codes in the `LPA:1$$` format. Use `UnmarshalText` to parse from QR code text and `MarshalText` to serialize back to text. ```go import "github.com/damonto/euicc-go/lpa" // Parse from QR code text var ac lpa.ActivationCode if err := ac.UnmarshalText([]byte("LPA:1$smdp.example.com$QR-G-5C-1LS-1W1Z9P7")); err != nil { panic(err) } fmt.Printf("SM-DP+: %s | MatchingID: %s\n", ac.SMDP.Host, ac.MatchingID) // Serialize back to text text, err := ac.MarshalText() if err != nil { panic(err) } fmt.Println(string(text)) ``` -------------------------------- ### Initialize CCID Smart Card Reader Driver Source: https://context7.com/damonto/euicc-go/llms.txt Provides an `apdu.SmartCardChannel` implementation for PC/SC-compatible smart card readers using `goscard`. Use this driver when the eUICC is accessible via a physical card reader. ```go import "github.com/damonto/euicc-go/driver/ccid" ch, err := ccid.New() if err != nil { panic(err) // PC/SC context unavailable } readers, err := ch.ListReaders() if err != nil || len(readers) == 0 { panic("no readers found") } fmt.Printf("Available readers: %v\n", readers) ch.SetReader(readers[0]) // Pass ch to lpa.New(...) ``` -------------------------------- ### lpa.Client.Discovery Source: https://context7.com/damonto/euicc-go/llms.txt Discovers downloadable profiles from an SM-DS server by performing the ES11 mutual authentication flow. Returns a list of available event entries (profile download opportunities). Implements ES11.AuthenticateClient per SGP.22 §5.8.2. ```APIDOC ## `lpa.Client.Discovery` — SM-DS Profile Discovery ### Description Discovers downloadable profiles from an SM-DS server by performing the ES11 mutual authentication flow. Returns a list of available event entries (profile download opportunities). Implements ES11.AuthenticateClient per SGP.22 §5.8.2. ### Method ```go client.Discovery(address *url.URL, imei *sgp22.IMEI) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```go import ( "fmt" "net/url" sgp22 "github.com/damonto/euicc-go/v2" ) imei, _ := sgp22.NewIMEI("356938035643809") address := &url.URL{Scheme: "https", Host: "lpa.ds.gsma.com"} entries, err := client.Discovery(address, imei) if err != nil { fmt.Printf("Discovery failed: %v\n", err) } else { for _, entry := range entries { fmt.Printf("EventID: %s | SM-DP+ Address: %s\n", entry.EventID, entry.Address) } } ``` ### Response #### Success Response (200) - **entries** ([]sgp22.EventEntry) - A list of available event entries (profile download opportunities). #### Response Example ```json [ { "EventID": "abc123", "Address": "smdp.provider.com" } ] ``` ``` -------------------------------- ### lpa.New — Create LPA Client Source: https://context7.com/damonto/euicc-go/llms.txt Creates and initializes a new LPA client with a given hardware transport channel. It connects to the eUICC's ISD-R application and configures the HTTP client for SM-DP+/SM-DS communication. ```APIDOC ## lpa.New — Create LPA Client Creates and initializes a new LPA client with a given hardware transport channel. Connects to the eUICC's ISD-R application over the specified channel and configures the HTTP client for SM-DP+/SM-DS communication. ### Method Signature ```go func New(options *Options) (*Client, error) ``` ### Parameters #### Options - **Channel** (*driver.TransportChannel*) - Required - The hardware transport channel to use for communication with the eUICC. - **MSS** (*int*) - Optional - Maximum APDU size. Defaults to 254. - **AdminProtocolVersion** (*string*) - Optional - The SGP.22 version. Defaults to "2.5.0". - **Timeout** (*time.Duration*) - Optional - The HTTP client timeout. Defaults to 30 seconds. - **Logger** (**slog.Logger*) - Optional - A logger instance for logging. ### Request Example ```go package main import ( "fmt" "log/slog" "time" "github.com/damonto/euicc-go/driver/ccid" "github.com/damonto/euicc-go/lpa" ) func main() { ch, err := ccid.New() if err != nil { panic(err) } readers, err := ch.ListReaders() if err != nil || len(readers) == 0 { panic("no smart card readers found") } ch.SetReader(readers[0]) client, err := lpa.New(&lpa.Options{ Channel: ch, MSS: 254, // max APDU size, default 254 AdminProtocolVersion: "2.5.0", // SGP.22 version, default "2.5.0" Timeout: 30 * time.Second, // HTTP timeout, default 30s Logger: slog.Default(), }) if err != nil { panic(fmt.Sprintf("failed to create LPA client: %v", err)) } defer client.Close() fmt.Println("LPA client ready") } ``` ``` -------------------------------- ### Configure eUICC Addresses with lpa.Client Source: https://context7.com/damonto/euicc-go/llms.txt Reads configured SM-DP+ and SM-DS addresses from the eUICC and optionally sets a new default SM-DP+ address. Implements ES10a.GetEuiccConfiguredAddresses and ES10a.SetDefaultDpAddress. ```go // Read configured addresses addrs, err := client.EUICCConfiguredAddresses() if err != nil { panic(err) } fmt.Printf("Default SM-DP+: %s\n", addrs.DefaultSMDPAddress) fmt.Printf("Root SM-DS: %s\n", addrs.RootSMDSAddress) // Output: // Default SM-DP+: smdp.example.com // Root SM-DS: lpa.ds.gsma.com // Update the default SM-DP+ address if err := client.SetDefaultDPAddress("newsmdp.provider.com"); err != nil { fmt.Printf("Failed to set address: %v\n", err) } else { fmt.Println("Default SM-DP+ address updated") } ``` -------------------------------- ### driver/at Source: https://context7.com/damonto/euicc-go/llms.txt Provides an `apdu.SmartCardChannel` for modems using AT Commands via a serial port, adhering to 3GPP TS 27.007. This is suitable for USB modems or embedded LTE modules accessible as serial devices. ```APIDOC ## `driver/at` — AT Command Modem Driver ### Description Provides `apdu.SmartCardChannel` for modems via serial port using `AT+CSIM` commands (3GPP TS 27.007). Use for USB modems or embedded LTE modules accessible as serial devices. ### Methods - `New(portName string)` ### Parameters #### New Parameters - **portName** (string) - The serial port name (e.g., `/dev/ttyUSB7`). ### Request Example ```go import "github.com/damonto/euicc-go/driver/at" ch, err := at.New("/dev/ttyUSB7") if err != nil { panic(fmt.Sprintf("failed to open serial port: %v", err)) } // Pass ch to lpa.New(...) ``` ### Response #### Success Response (New) - **ch** (apdu.SmartCardChannel) - An initialized smart card channel for AT command modems. ``` -------------------------------- ### Discover Downloadable Profiles with lpa.Client.Discovery Source: https://context7.com/damonto/euicc-go/llms.txt Discovers downloadable eUICC profiles from an SM-DS server using the ES11 mutual authentication flow. Requires an addressable SM-DS server and an IMEI. ```go import ( "fmt" "net/url" sgp22 "github.com/damonto/euicc-go/v2" ) imei, _ := sgp22.NewIMEI("356938035643809") address := &url.URL{Scheme: "https", Host: "lpa.ds.gsma.com"} entries, err := client.Discovery(address, imei) if err != nil { fmt.Printf("Discovery failed: %v\n", err) } else { for _, entry := range entries { fmt.Printf("EventID: %s | SM-DP+ Address: %s\n", entry.EventID, entry.Address) } } // Output: // EventID: abc123 | SM-DP+ Address: smdp.provider.com ``` -------------------------------- ### lpa.Client.EUICCInfo1 / EUICCInfo2 Source: https://context7.com/damonto/euicc-go/llms.txt Retrieves eUICC capability and status data in raw BER-TLV form. EUICCInfo1 contains SVN and supported algorithms; EUICCInfo2 adds CI public key IDs, profile policy rules, and more. Implements ES10b.GetEUICCInfo per SGP.22 §5.7.8. ```APIDOC ## `lpa.Client.EUICCInfo1` / `EUICCInfo2` — eUICC Capability Info ### Description Retrieves eUICC capability and status data in raw BER-TLV form. EUICCInfo1 contains SVN and supported algorithms; EUICCInfo2 adds CI public key IDs, profile policy rules, and more. Implements ES10b.GetEUICCInfo per SGP.22 §5.7.8. ### Methods - `EUICCInfo1()` - `EUICCInfo2()` ### Parameters None ### Request Example ```go import "github.com/damonto/euicc-go/bertlv" info1, err := client.EUICCInfo1() if err != nil { panic(err) } // info1 is a *bertlv.TLV; navigate the tree for specific fields fmt.Printf("EUICCInfo1 tag: %X\n", []byte(info1.Tag)) info2, err := client.EUICCInfo2() if err != nil { panic(err) } fmt.Printf("EUICCInfo2 children count: %d\n", len(info2.Children)) ``` ### Response #### Success Response (EUICCInfo1) - **info1** (*bertlv.TLV) - The BER-TLV data for eUICC capability information (SVN, algorithms). #### Success Response (EUICCInfo2) - **info2** (*bertlv.TLV) - The BER-TLV data for extended eUICC capability information (CI public keys, policy rules, etc.). ``` -------------------------------- ### driver/ccid Source: https://context7.com/damonto/euicc-go/llms.txt Provides an `apdu.SmartCardChannel` implementation for CCID smart card readers via PC/SC, using the `goscard` library. This is used when the eUICC is accessible through a physical card reader. ```APIDOC ## `driver/ccid` — CCID Smart Card Reader Driver ### Description Provides `apdu.SmartCardChannel` implementation for PC/SC-compatible smart card readers via `goscard`. Use when the eUICC is accessible through a physical card reader. ### Methods - `New()` - `ListReaders()` - `SetReader(readerName string)` ### Parameters #### New Parameters None #### ListReaders Parameters None #### SetReader Parameters - **readerName** (string) - The name of the smart card reader to use. ### Request Example ```go import "github.com/damonto/euicc-go/driver/ccid" ch, err := ccid.New() if err != nil { panic(err) // PC/SC context unavailable } readers, err := ch.ListReaders() if err != nil || len(readers) == 0 { panic("no readers found") } fmt.Printf("Available readers: %v\n", readers) ch.SetReader(readers[0]) // Pass ch to lpa.New(...) ``` ### Response #### Success Response (New) - **ch** (apdu.SmartCardChannel) - An initialized smart card channel for CCID readers. #### Success Response (ListReaders) - **readers** ([]string) - A list of available smart card reader names. #### Success Response (SetReader) - **(no return value)** - Indicates the reader has been successfully set. ``` -------------------------------- ### lpa.ActivationCode Source: https://context7.com/damonto/euicc-go/llms.txt Handles the parsing and serialization of LPA activation codes. Activation codes are expected in the `LPA:1$$` format as defined in SGP.22 §4.1. ```APIDOC ## `lpa.ActivationCode` — Parse / Serialize Activation Code Parses and serializes LPA activation codes in the `LPA:1$$` format defined by SGP.22 §4.1. ### Methods #### UnmarshalText - **UnmarshalText([]byte)**: Parses an activation code from its text representation. - **Input**: `[]byte` - The text representation of the activation code. - **Returns**: `error` - An error if parsing fails. #### MarshalText - **MarshalText() ([]byte, error)**: Serializes the activation code into its text representation. - **Returns**: `[]byte` - The text representation of the activation code. - **Returns**: `error` - An error if serialization fails. ``` -------------------------------- ### Manage eUICC Profile Notifications with lpa.Client Source: https://context7.com/damonto/euicc-go/llms.txt Manages pending eUICC profile management notifications, including listing, retrieving, handling, and removing them. Supports various notification event types. ```go import sgp22 "github.com/damonto/euicc-go/v2" // List metadata for all notifications metas, err := client.ListNotification( sgp22.NotificationEventInstall, sgp22.NotificationEventEnable, sgp22.NotificationEventDisable, sgp22.NotificationEventDelete, ) if err != nil { panic(err) } for _, m := range metas { fmt.Printf("Seq: %d | ICCID: %s | Operation: %d | Address: %s\n", m.SequenceNumber, m.ICCID, m.ProfileManagementOperation, m.Address) } // Retrieve full pending notifications by sequence number pending, err := client.RetrieveNotificationList(sgp22.SequenceNumber(1)) if err != nil { panic(err) } // Send (handle) the first pending notification to its SM-DP+ if len(pending) > 0 { if err := client.HandleNotification(pending[0]); err != nil { fmt.Printf("Failed to send notification: %v\n", err) } else { fmt.Println("Notification sent successfully") } } // Remove a notification from the eUICC list after successful delivery if err := client.RemoveNotificationFromList(sgp22.SequenceNumber(1)); err != nil { fmt.Printf("Remove failed: %v\n", err) } ``` -------------------------------- ### lpa.Client.MemoryReset Source: https://context7.com/damonto/euicc-go/llms.txt Performs a factory reset of the eUICC. This action deletes all operational and test profiles and resets the default SM-DP+ address, adhering to the ES10c.eUICCMemoryReset specification. ```APIDOC ## `lpa.Client.MemoryReset` — Factory Reset eUICC Deletes all operational and field-loaded test profiles and resets the default SM-DP+ address. Implements ES10c.eUICCMemoryReset per SGP.22 §5.7.19. ### Returns - **error** - An error if the memory reset operation fails. ``` -------------------------------- ### lpa.Client.EUICCConfiguredAddresses / SetDefaultDPAddress Source: https://context7.com/damonto/euicc-go/llms.txt Manages eUICC address configuration by reading configured SM-DP+ and SM-DS addresses, and optionally setting a new default SM-DP+ address. Implements ES10a.GetEuiccConfiguredAddresses (§5.7.3) and ES10a.SetDefaultDpAddress (§5.7.4). ```APIDOC ## `lpa.Client.EUICCConfiguredAddresses` / `SetDefaultDPAddress` — eUICC Address Configuration ### Description Reads the configured SM-DP+ and SM-DS addresses from the eUICC, and optionally sets a new default SM-DP+ address. Implements ES10a.GetEuiccConfiguredAddresses (§5.7.3) and ES10a.SetDefaultDpAddress (§5.7.4). ### Methods - `EUICCConfiguredAddresses()` - `SetDefaultDPAddress(address string)` ### Parameters #### EUICCConfiguredAddresses Parameters None #### SetDefaultDPAddress Parameters - **address** (string) - The new default SM-DP+ address to set. ### Request Example ```go // Read configured addresses addrs, err := client.EUICCConfiguredAddresses() if err != nil { panic(err) } fmt.Printf("Default SM-DP+: %s\n", addrs.DefaultSMDPAddress) fmt.Printf("Root SM-DS: %s\n", addrs.RootSMDSAddress) // Update the default SM-DP+ address if err := client.SetDefaultDPAddress("newsmdp.provider.com"); err != nil { fmt.Printf("Failed to set address: %v\n", err) } else { fmt.Println("Default SM-DP+ address updated") } ``` ### Response #### Success Response (EUICCConfiguredAddresses) - **addrs** (struct) - Contains the configured addresses. - **DefaultSMDPAddress** (string) - The default SM-DP+ address. - **RootSMDSAddress** (string) - The root SM-DS address. #### Success Response (SetDefaultDPAddress) - **(no return value)** - Indicates successful update of the default SM-DP+ address. ``` -------------------------------- ### lpa.Client.ListNotification / RetrieveNotificationList / HandleNotification Source: https://context7.com/damonto/euicc-go/llms.txt Manages pending eUICC profile management notifications by listing, retrieving, and sending them to their respective SM-DP+ servers. Implements ES10b.ListNotification (§5.7.9), ES10b.RetrieveNotificationList, and ES9p.HandleNotification (§5.6.4). ```APIDOC ## `lpa.Client.ListNotification` / `RetrieveNotificationList` / `HandleNotification` — Notification Management ### Description Lists, retrieves, and sends pending eUICC profile management notifications to their respective SM-DP+ servers. Implements ES10b.ListNotification (§5.7.9), ES10b.RetrieveNotificationList, and ES9p.HandleNotification (§5.6.4). ### Methods - `ListNotification(notificationTypes ...sgp22.NotificationType)` - `RetrieveNotificationList(sequenceNumber sgp22.SequenceNumber)` - `HandleNotification(notification sgp22.Notification)` - `RemoveNotificationFromList(sequenceNumber sgp22.SequenceNumber)` ### Parameters #### ListNotification Parameters - **notificationTypes** ([]sgp22.NotificationType) - A variadic list of notification types to retrieve metadata for (e.g., `sgp22.NotificationEventInstall`). #### RetrieveNotificationList Parameters - **sequenceNumber** (sgp22.SequenceNumber) - The sequence number of the notification to retrieve. #### HandleNotification Parameters - **notification** (sgp22.Notification) - The pending notification object to send to the SM-DP+ server. #### RemoveNotificationFromList Parameters - **sequenceNumber** (sgp22.SequenceNumber) - The sequence number of the notification to remove from the list. ### Request Example ```go import sgp22 "github.com/damonto/euicc-go/v2" // List metadata for all notifications metas, err := client.ListNotification( sgp22.NotificationEventInstall, sgp22.NotificationEventEnable, sgp22.NotificationEventDisable, sgp22.NotificationEventDelete, ) if err != nil { panic(err) } for _, m := range metas { fmt.Printf("Seq: %d | ICCID: %s | Operation: %d | Address: %s\n", m.SequenceNumber, m.ICCID, m.ProfileManagementOperation, m.Address) } // Retrieve full pending notifications by sequence number pending, err := client.RetrieveNotificationList(sgp22.SequenceNumber(1)) if err != nil { panic(err) } // Send (handle) the first pending notification to its SM-DP+ if len(pending) > 0 { if err := client.HandleNotification(pending[0]); err != nil { fmt.Printf("Failed to send notification: %v\n", err) } else { fmt.Println("Notification sent successfully") } } // Remove a notification from the eUICC list after successful delivery if err := client.RemoveNotificationFromList(sgp22.SequenceNumber(1)); err != nil { fmt.Printf("Remove failed: %v\n", err) } ``` ### Response #### Success Response (ListNotification) - **metas** ([]sgp22.NotificationMeta) - Metadata for pending notifications. #### Success Response (RetrieveNotificationList) - **pending** ([]sgp22.Notification) - A list of pending notification objects. #### Success Response (HandleNotification) - **(no return value)** - Indicates successful handling of the notification. #### Success Response (RemoveNotificationFromList) - **(no return value)** - Indicates successful removal of the notification. ``` -------------------------------- ### Invoke Generic APDU Command for eUICC Source: https://context7.com/damonto/euicc-go/llms.txt Sends a type-safe generic APDU command to the eUICC and receives a typed response. Used internally by the lpa package and available for custom SGP.22 command sequences. ```go import ( "github.com/damonto/euicc-go/bertlv" sgp22 "github.com/damonto/euicc-go/v2" ) // Send ES10b.GetEUICCInfo (version 2) directly response, err := sgp22.InvokeAPDU(client.APDU, &sgp22.GetEuiccInfoRequest{Version: 2}) if err != nil { panic(err) } var tlv bertlv.TLV // response.Response is the raw *bertlv.TLV fmt.Printf("EUICCInfo2 TLV tag: %X\n", []byte(response.Response.Tag)) _ = tlv ``` -------------------------------- ### Generic APDU Invocation Source: https://context7.com/damonto/euicc-go/llms.txt Provides a type-safe function `InvokeAPDU` for sending generic APDU commands to the eUICC and receiving typed responses. Useful for custom SGP.22 command sequences. ```APIDOC ## `sgp22.InvokeAPDU` — Generic APDU Invocation Type-safe generic function for sending an APDU command to the eUICC and receiving a typed response. Used internally by the `lpa` package and available for custom SGP.22 command sequences. ```go import ( "github.com/damonto/euicc-go/bertlv" sgp22 "github.com/damonto/euicc-go/v2" ) // Send ES10b.GetEUICCInfo (version 2) directly response, err := sgp22.InvokeAPDU(client.APDU, &sgp22.GetEuiccInfoRequest{Version: 2}) if err != nil { panic(err) } var tlv bertlv.TLV // response.Response is the raw *bertlv.TLV fmt.Printf("EUICCInfo2 TLV tag: %X\n", []byte(response.Response.Tag)) _ = tlv ``` ``` -------------------------------- ### lpa.Client.EnableProfile / DisableProfile / DeleteProfile Source: https://context7.com/damonto/euicc-go/llms.txt Manages the state of eUICC profiles. These methods allow enabling, disabling, or deleting profiles identified by their ICCID or ISD-P AID. The `refresh` parameter for Enable/Disable triggers a SIM reset. ```APIDOC ## `lpa.Client.EnableProfile` / `DisableProfile` / `DeleteProfile` — Profile State Management Enables, disables, or deletes a profile identified by ICCID or ISD-P AID. The `refresh` parameter triggers a SIM reset after enable/disable. Implements ES10c.EnableProfile (§5.7.16), ES10c.DisableProfile (§5.7.17), and ES10c.DeleteProfile (§5.7.18). ### Methods #### EnableProfile - **EnableProfile(iccid sgp22.ICCID, refresh bool)**: Enables a profile. - **Parameters**: - **iccid** (sgp22.ICCID) - The ICCID of the profile to enable. - **refresh** (bool) - If true, triggers a UICC reset after enabling. - **Returns**: `error` - An error if enabling fails. #### DisableProfile - **DisableProfile(iccid sgp22.ICCID, refresh bool)**: Disables a profile. - **Parameters**: - **iccid** (sgp22.ICCID) - The ICCID of the profile to disable. - **refresh** (bool) - If true, triggers a UICC reset after disabling. - **Returns**: `error` - An error if disabling fails. #### DeleteProfile - **DeleteProfile(aid sgp22.ISDPAID)**: Deletes a profile. - **Parameters**: - **aid** (sgp22.ISDPAID) - The ISD-P AID of the profile to delete. - **Returns**: `error` - An error if deleting fails. ``` -------------------------------- ### Identifier Encoding (ICCID/IMEI) Source: https://context7.com/damonto/euicc-go/llms.txt Encodes ICCID and IMEI strings into the GSM BCD binary format required by the SGP.22 protocol. Both encoded types implement `String()` for decoding back to human-readable form. ```APIDOC ## `sgp22.NewICCID` / `sgp22.NewIMEI` — Identifier Encoding Encodes ICCID and IMEI strings into GSM BCD binary format required by the SGP.22 protocol. Both types implement `String()` for decoding back to human-readable form. ```go import sgp22 "github.com/damonto/euicc-go/v2" iccid, err := sgp22.NewICCID("8944474600000109689") if err != nil { panic(err) // invalid characters } fmt.Printf("Encoded ICCID: %X\n", []byte(iccid)) fmt.Printf("Decoded ICCID: %s\n", iccid.String()) // Output: // Encoded ICCID: 98447464000001096F // Decoded ICCID: 8944474600000109689 imei, err := sgp22.NewIMEI("356938035643809") if err != nil { panic(err) } fmt.Printf("IMEI: %s\n", imei.String()) // Output: IMEI: 356938035643809 ``` ``` -------------------------------- ### Factory Reset eUICC Source: https://context7.com/damonto/euicc-go/llms.txt Deletes all operational and field-loaded test profiles and resets the default SM-DP+ address. Implements ES10c.eUICCMemoryReset per SGP.22 §5.7.19. ```go if err := client.MemoryReset(); err != nil { fmt.Printf("Memory reset failed: %v\n", err) } else { fmt.Println("eUICC memory reset complete") } ``` -------------------------------- ### Encode ICCID and IMEI for SGP.22 Protocol Source: https://context7.com/damonto/euicc-go/llms.txt Encodes ICCID and IMEI strings into GSM BCD binary format for the SGP.22 protocol. Both encoded types implement String() for decoding back to human-readable form. ```go import sgp22 "github.com/damonto/euicc-go/v2" iccid, err := sgp22.NewICCID("8944474600000109689") if err != nil { panic(err) // invalid characters } fmt.Printf("Encoded ICCID: %X\n", []byte(iccid)) fmt.Printf("Decoded ICCID: %s\n", iccid.String()) // Output: // Encoded ICCID: 98447464000001096F // Decoded ICCID: 8944474600000109689 imei, err := sgp22.NewIMEI("356938035643809") if err != nil { panic(err) } fmt.Printf("IMEI: %s\n", imei.String()) // Output: IMEI: 356938035643809 ``` -------------------------------- ### Manage eUICC Profile State Source: https://context7.com/damonto/euicc-go/llms.txt Enables, disables, or deletes a profile identified by ICCID or ISD-P AID. The `refresh` parameter triggers a SIM reset after enable/disable. ```go import sgp22 "github.com/damonto/euicc-go/v2" // Construct ICCID (GSM-BCD encoded) iccid, err := sgp22.NewICCID("8944474600000109689") if err != nil { panic(err) } // Enable profile and trigger UICC reset if err := client.EnableProfile(iccid, true); err != nil { fmt.Printf("Enable failed: %v\n", err) } else { fmt.Println("Profile enabled") } // Disable profile (no reset) if err := client.DisableProfile(iccid, false); err != nil { fmt.Printf("Disable failed: %v\n", err) } // Delete profile by ISD-P AID aid := sgp22.ISDPAID([]byte{0xA0, 0x00, 0x00, 0x05, 0x59, 0x10, 0x10, 0xFF}) if err := client.DeleteProfile(aid); err != nil { fmt.Printf("Delete failed: %v\n", err) } else { fmt.Println("Profile deleted") } ``` -------------------------------- ### lpa.Client.SetNickname Source: https://context7.com/damonto/euicc-go/llms.txt Assigns a human-readable nickname to a specific eUICC profile. This operation is identified by the profile's ICCID and follows the ES10c.SetNickname specification. ```APIDOC ## `lpa.Client.SetNickname` — Set Profile Nickname Assigns a human-readable nickname to a profile identified by ICCID. Implements ES10c.SetNickname per SGP.22 §5.7.21. ### Parameters - **iccid** (sgp22.ICCID) - The ICCID of the profile to which the nickname will be assigned. - **nickname** (string) - The human-readable nickname for the profile. ### Returns - **error** - An error if setting the nickname fails. ``` -------------------------------- ### Set eUICC Profile Nickname Source: https://context7.com/damonto/euicc-go/llms.txt Assigns a human-readable nickname to a profile identified by ICCID. Implements ES10c.SetNickname per SGP.22 §5.7.21. ```go iccid, _ := sgp22.NewICCID("8944474600000109689") if err := client.SetNickname(iccid, "Work SIM"); err != nil { fmt.Printf("SetNickname failed: %v\n", err) } else { fmt.Println("Nickname updated") } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.