@particle/esim-tooling 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +187 -0
  2. package/dist/activation-code.d.ts +11 -0
  3. package/dist/activation-code.d.ts.map +1 -0
  4. package/dist/activation-code.js +56 -0
  5. package/dist/activation-code.js.map +1 -0
  6. package/dist/apdu.d.ts +73 -0
  7. package/dist/apdu.d.ts.map +1 -0
  8. package/dist/apdu.js +357 -0
  9. package/dist/apdu.js.map +1 -0
  10. package/dist/errors.d.ts +32 -0
  11. package/dist/errors.d.ts.map +1 -0
  12. package/dist/errors.js +52 -0
  13. package/dist/errors.js.map +1 -0
  14. package/dist/es10/es10b-notifications.d.ts +30 -0
  15. package/dist/es10/es10b-notifications.d.ts.map +1 -0
  16. package/dist/es10/es10b-notifications.js +294 -0
  17. package/dist/es10/es10b-notifications.js.map +1 -0
  18. package/dist/es10/es10b.d.ts +34 -0
  19. package/dist/es10/es10b.d.ts.map +1 -0
  20. package/dist/es10/es10b.js +108 -0
  21. package/dist/es10/es10b.js.map +1 -0
  22. package/dist/es10/es10c.d.ts +12 -0
  23. package/dist/es10/es10c.d.ts.map +1 -0
  24. package/dist/es10/es10c.js +133 -0
  25. package/dist/es10/es10c.js.map +1 -0
  26. package/dist/es10/iccid.d.ts +9 -0
  27. package/dist/es10/iccid.d.ts.map +1 -0
  28. package/dist/es10/iccid.js +31 -0
  29. package/dist/es10/iccid.js.map +1 -0
  30. package/dist/es10/index.d.ts +5 -0
  31. package/dist/es10/index.d.ts.map +1 -0
  32. package/dist/es10/index.js +4 -0
  33. package/dist/es10/index.js.map +1 -0
  34. package/dist/es10/tags.d.ts +55 -0
  35. package/dist/es10/tags.d.ts.map +1 -0
  36. package/dist/es10/tags.js +63 -0
  37. package/dist/es10/tags.js.map +1 -0
  38. package/dist/es9plus.d.ts +52 -0
  39. package/dist/es9plus.d.ts.map +1 -0
  40. package/dist/es9plus.js +227 -0
  41. package/dist/es9plus.js.map +1 -0
  42. package/dist/gsma-rsp2-root-ci1.d.ts +38 -0
  43. package/dist/gsma-rsp2-root-ci1.d.ts.map +1 -0
  44. package/dist/gsma-rsp2-root-ci1.js +52 -0
  45. package/dist/gsma-rsp2-root-ci1.js.map +1 -0
  46. package/dist/index.d.ts +6 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +5 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/lpa.d.ts +15 -0
  51. package/dist/lpa.d.ts.map +1 -0
  52. package/dist/lpa.js +283 -0
  53. package/dist/lpa.js.map +1 -0
  54. package/dist/tlv.d.ts +14 -0
  55. package/dist/tlv.d.ts.map +1 -0
  56. package/dist/tlv.js +132 -0
  57. package/dist/tlv.js.map +1 -0
  58. package/dist/types.d.ts +230 -0
  59. package/dist/types.d.ts.map +1 -0
  60. package/dist/types.js +108 -0
  61. package/dist/types.js.map +1 -0
  62. package/package.json +50 -0
  63. package/src/activation-code.ts +64 -0
  64. package/src/apdu.ts +419 -0
  65. package/src/errors.ts +69 -0
  66. package/src/es10/es10b-notifications.ts +331 -0
  67. package/src/es10/es10b.ts +163 -0
  68. package/src/es10/es10c.ts +168 -0
  69. package/src/es10/iccid.ts +32 -0
  70. package/src/es10/index.ts +42 -0
  71. package/src/es10/tags.ts +69 -0
  72. package/src/es9plus.ts +331 -0
  73. package/src/gsma-rsp2-root-ci1.ts +53 -0
  74. package/src/index.ts +43 -0
  75. package/src/lpa.ts +346 -0
  76. package/src/tlv.ts +137 -0
  77. package/src/types.ts +264 -0
@@ -0,0 +1,230 @@
1
+ export declare enum ProfileState {
2
+ Disabled = 0,
3
+ Enabled = 1
4
+ }
5
+ export declare enum ProfileClass {
6
+ Test = 0,
7
+ Provisioning = 1,
8
+ Operational = 2
9
+ }
10
+ export declare enum NotificationEvent {
11
+ Install = 128,
12
+ Enable = 64,
13
+ Disable = 32,
14
+ Delete = 16
15
+ }
16
+ export declare enum DeleteNotificationStatus {
17
+ Ok = 0,
18
+ NothingToDelete = 1,
19
+ UndefinedError = 127
20
+ }
21
+ export declare enum CancelSessionReason {
22
+ EndUserRejection = 0,
23
+ Postponed = 1,
24
+ Timeout = 2,
25
+ PprNotAllowed = 3,
26
+ MetadataMismatch = 4,
27
+ LoadBppExecutionError = 5,
28
+ SessionAborted = 16,
29
+ EnterpriseProfilesNotSupported = 17,
30
+ EnterpriseRulesNotAllowed = 18,
31
+ EnterpriseProfileNotAllowed = 19,
32
+ EnterpriseOidMismatch = 20,
33
+ EnterpriseRulesError = 21,
34
+ EnterpriseProfilesOnly = 22,
35
+ LprNotSupported = 23,
36
+ LprNetworkDataNotAllowed = 24,
37
+ EmptyProfileOrSpName = 25,
38
+ RpmDisabled = 27,
39
+ InvalidRpmPackage = 28,
40
+ LoadRpmPackageError = 29,
41
+ OperationAbandoned = 30,
42
+ UndefinedReason = 127
43
+ }
44
+ export declare enum EnableProfileResult {
45
+ Ok = 0,
46
+ IccidOrAidNotFound = 1,
47
+ ProfileNotInDisabledState = 2,
48
+ DisallowedByPolicy = 3,
49
+ WrongProfileReenabling = 4,
50
+ CatBusy = 5,
51
+ DisallowedByEnterpriseRule = 6,
52
+ CommandError = 7,
53
+ DisallowedForRpm = 9,
54
+ NoEsimPortAvailable = 10,
55
+ UndefinedError = 127
56
+ }
57
+ export declare enum DisableProfileResult {
58
+ Ok = 0,
59
+ IccidOrAidNotFound = 1,
60
+ ProfileNotInEnabledState = 2,
61
+ DisallowedByPolicy = 3,
62
+ CatBusy = 5,
63
+ DisallowedByEnterpriseRule = 6,
64
+ CommandError = 7,
65
+ DisallowedForRpm = 9,
66
+ UndefinedError = 127
67
+ }
68
+ export declare enum DeleteProfileResult {
69
+ Ok = 0,
70
+ IccidOrAidNotFound = 1,
71
+ ProfileNotInDisabledState = 2,
72
+ DisallowedByPolicy = 3,
73
+ DisallowedInTestMode = 4,
74
+ CommandError = 7,
75
+ UndefinedError = 127
76
+ }
77
+ /**
78
+ * Error codes from ProfileInstallationResult errorResult (reasonCode).
79
+ * Per SGP.22 Section 5.7.7.
80
+ */
81
+ export declare enum BppInstallErrorCode {
82
+ IncorrectInputValues = 1,
83
+ InvalidSignature = 2,
84
+ InvalidTransactionId = 3,
85
+ UnsupportedCrtValues = 4,
86
+ UnsupportedRemoteOperationType = 5,
87
+ UnsupportedProfileClass = 6,
88
+ Scp03tStructureError = 7,
89
+ Scp03tSecurityError = 8,
90
+ IccidAlreadyExistsOnEuicc = 9,
91
+ InsufficientMemoryForProfile = 10,
92
+ InstallInterrupted = 11,
93
+ PeProcessingError = 12,
94
+ DataMismatch = 13,
95
+ TestProfileInvalidNaaKey = 14,
96
+ PprNotAllowed = 15,
97
+ UnknownError = 127
98
+ }
99
+ export interface DeviceAdapter {
100
+ sendApdu(apdu: Uint8Array): Promise<Uint8Array>;
101
+ }
102
+ export interface ServerAdapter {
103
+ sendRsp(smdpAddress: string, endpoint: string, requestData: Uint8Array): Promise<ServerResponse>;
104
+ }
105
+ export interface ServerResponse {
106
+ statusCode: number;
107
+ responseData?: Uint8Array;
108
+ }
109
+ export interface Profile {
110
+ iccid: string;
111
+ isdpAid?: string;
112
+ state: ProfileState;
113
+ nickname?: string;
114
+ serviceProviderName?: string;
115
+ profileName?: string;
116
+ profileClass?: ProfileClass;
117
+ }
118
+ export interface NotificationMetadata {
119
+ seqNumber: number;
120
+ operation: NotificationEvent;
121
+ notificationAddress: string;
122
+ iccid?: string;
123
+ }
124
+ /**
125
+ * Full notification data from RetrieveNotificationsList.
126
+ * Includes installation result for install notifications.
127
+ */
128
+ export interface Notification extends NotificationMetadata {
129
+ /**
130
+ * For install notifications: whether the installation succeeded.
131
+ * For other notifications (enable/disable/delete): always true (operation completed).
132
+ */
133
+ success: boolean;
134
+ /**
135
+ * Error subject code (only if success=false).
136
+ * See SGP.22 Section 5.7.9 for subject codes.
137
+ */
138
+ errorSubjectCode?: number;
139
+ /**
140
+ * Error reason code (only if success=false).
141
+ * See BppInstallErrorCode enum for common values.
142
+ */
143
+ errorReasonCode?: number;
144
+ }
145
+ /**
146
+ * Result of BPP loading from the eUICC.
147
+ * Returned after the last STORE DATA command during profile installation.
148
+ */
149
+ export interface ProfileInstallationResult {
150
+ success: boolean;
151
+ /** ICCID of the installed profile (only if success=true) */
152
+ iccid?: string;
153
+ /** Error subject code (only if success=false) */
154
+ errorSubjectCode?: number;
155
+ /** Error reason code (only if success=false) */
156
+ errorReasonCode?: number;
157
+ }
158
+ /**
159
+ * Result of sending a notification to SM-DP+.
160
+ */
161
+ export interface SendResult {
162
+ /** Whether the notification was successfully sent to SM-DP+ */
163
+ sent: boolean;
164
+ /** Whether the notification was removed from the eUICC (only attempted if sent=true) */
165
+ removed: boolean;
166
+ /** Error message if sending failed */
167
+ error?: string;
168
+ }
169
+ /**
170
+ * Notification with optional send result.
171
+ */
172
+ export interface NotificationWithResult extends Notification {
173
+ /** Result of sending to SM-DP+. null if send option was false. */
174
+ sendResult: SendResult | null;
175
+ }
176
+ /**
177
+ * Options for processNotifications.
178
+ */
179
+ export interface ProcessNotificationsOptions {
180
+ /** If true, only list notifications without sending to SM-DP+. Default: false (process and send) */
181
+ listOnly?: boolean;
182
+ /** If true, remove notifications from eUICC even if sending fails. Default: false */
183
+ forceRemove?: boolean;
184
+ }
185
+ /**
186
+ * Result of processNotifications.
187
+ */
188
+ export interface ProcessNotificationsResult {
189
+ /** All notifications with their details and optional send results */
190
+ notifications: NotificationWithResult[];
191
+ /** Number of notifications successfully sent (only present when send=true) */
192
+ sent?: number;
193
+ /** Number of notifications that failed to send (only present when send=true) */
194
+ failed?: number;
195
+ }
196
+ export interface ActivationCode {
197
+ format: number;
198
+ smdpAddress: string;
199
+ matchingId: string;
200
+ smdpOid?: string;
201
+ confirmationCodeRequired: boolean;
202
+ }
203
+ export type DownloadStep = 'parseActivationCode' | 'getEuiccChallenge' | 'getEuiccInfo' | 'initiateAuth' | 'authenticateServer' | 'authenticateClient' | 'prepareDownload' | 'getBoundProfilePackage' | 'loadProfile' | 'complete';
204
+ export interface DownloadProgress {
205
+ step: DownloadStep;
206
+ detail?: string;
207
+ }
208
+ export interface DownloadResult {
209
+ success: boolean;
210
+ error?: string;
211
+ /** Error subject code from ProfileInstallationResult (only if success=false) */
212
+ errorSubjectCode?: number;
213
+ /** Error reason code from ProfileInstallationResult (only if success=false) */
214
+ errorReasonCode?: number;
215
+ iccid?: string;
216
+ profileMetadata?: {
217
+ serviceProviderName?: string;
218
+ profileName?: string;
219
+ };
220
+ }
221
+ export interface InstallProfileOptions {
222
+ activationCode: string;
223
+ confirmationCode?: string;
224
+ onProgress?: (progress: DownloadProgress) => void;
225
+ }
226
+ export interface EsimLpaOptions {
227
+ device: DeviceAdapter;
228
+ server: ServerAdapter;
229
+ }
230
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACtB,QAAQ,IAAI;IACZ,OAAO,IAAI;CACZ;AAED,oBAAY,YAAY;IACtB,IAAI,IAAI;IACR,YAAY,IAAI;IAChB,WAAW,IAAI;CAChB;AAED,oBAAY,iBAAiB;IAC3B,OAAO,MAAO;IACd,MAAM,KAAO;IACb,OAAO,KAAO;IACd,MAAM,KAAO;CACd;AAED,oBAAY,wBAAwB;IAClC,EAAE,IAAI;IACN,eAAe,IAAI;IACnB,cAAc,MAAM;CACrB;AAED,oBAAY,mBAAmB;IAC7B,gBAAgB,IAAI;IACpB,SAAS,IAAI;IACb,OAAO,IAAI;IACX,aAAa,IAAI;IACjB,gBAAgB,IAAI;IACpB,qBAAqB,IAAI;IACzB,cAAc,KAAK;IACnB,8BAA8B,KAAK;IACnC,yBAAyB,KAAK;IAC9B,2BAA2B,KAAK;IAChC,qBAAqB,KAAK;IAC1B,oBAAoB,KAAK;IACzB,sBAAsB,KAAK;IAC3B,eAAe,KAAK;IACpB,wBAAwB,KAAK;IAC7B,oBAAoB,KAAK;IACzB,W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,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACnD;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;CACvB"}
package/dist/types.js ADDED
@@ -0,0 +1,108 @@
1
+ export var ProfileState;
2
+ (function (ProfileState) {
3
+ ProfileState[ProfileState["Disabled"] = 0] = "Disabled";
4
+ ProfileState[ProfileState["Enabled"] = 1] = "Enabled";
5
+ })(ProfileState || (ProfileState = {}));
6
+ export var ProfileClass;
7
+ (function (ProfileClass) {
8
+ ProfileClass[ProfileClass["Test"] = 0] = "Test";
9
+ ProfileClass[ProfileClass["Provisioning"] = 1] = "Provisioning";
10
+ ProfileClass[ProfileClass["Operational"] = 2] = "Operational";
11
+ })(ProfileClass || (ProfileClass = {}));
12
+ export var NotificationEvent;
13
+ (function (NotificationEvent) {
14
+ NotificationEvent[NotificationEvent["Install"] = 128] = "Install";
15
+ NotificationEvent[NotificationEvent["Enable"] = 64] = "Enable";
16
+ NotificationEvent[NotificationEvent["Disable"] = 32] = "Disable";
17
+ NotificationEvent[NotificationEvent["Delete"] = 16] = "Delete";
18
+ })(NotificationEvent || (NotificationEvent = {}));
19
+ export var DeleteNotificationStatus;
20
+ (function (DeleteNotificationStatus) {
21
+ DeleteNotificationStatus[DeleteNotificationStatus["Ok"] = 0] = "Ok";
22
+ DeleteNotificationStatus[DeleteNotificationStatus["NothingToDelete"] = 1] = "NothingToDelete";
23
+ DeleteNotificationStatus[DeleteNotificationStatus["UndefinedError"] = 127] = "UndefinedError";
24
+ })(DeleteNotificationStatus || (DeleteNotificationStatus = {}));
25
+ export var CancelSessionReason;
26
+ (function (CancelSessionReason) {
27
+ CancelSessionReason[CancelSessionReason["EndUserRejection"] = 0] = "EndUserRejection";
28
+ CancelSessionReason[CancelSessionReason["Postponed"] = 1] = "Postponed";
29
+ CancelSessionReason[CancelSessionReason["Timeout"] = 2] = "Timeout";
30
+ CancelSessionReason[CancelSessionReason["PprNotAllowed"] = 3] = "PprNotAllowed";
31
+ CancelSessionReason[CancelSessionReason["MetadataMismatch"] = 4] = "MetadataMismatch";
32
+ CancelSessionReason[CancelSessionReason["LoadBppExecutionError"] = 5] = "LoadBppExecutionError";
33
+ CancelSessionReason[CancelSessionReason["SessionAborted"] = 16] = "SessionAborted";
34
+ CancelSessionReason[CancelSessionReason["EnterpriseProfilesNotSupported"] = 17] = "EnterpriseProfilesNotSupported";
35
+ CancelSessionReason[CancelSessionReason["EnterpriseRulesNotAllowed"] = 18] = "EnterpriseRulesNotAllowed";
36
+ CancelSessionReason[CancelSessionReason["EnterpriseProfileNotAllowed"] = 19] = "EnterpriseProfileNotAllowed";
37
+ CancelSessionReason[CancelSessionReason["EnterpriseOidMismatch"] = 20] = "EnterpriseOidMismatch";
38
+ CancelSessionReason[CancelSessionReason["EnterpriseRulesError"] = 21] = "EnterpriseRulesError";
39
+ CancelSessionReason[CancelSessionReason["EnterpriseProfilesOnly"] = 22] = "EnterpriseProfilesOnly";
40
+ CancelSessionReason[CancelSessionReason["LprNotSupported"] = 23] = "LprNotSupported";
41
+ CancelSessionReason[CancelSessionReason["LprNetworkDataNotAllowed"] = 24] = "LprNetworkDataNotAllowed";
42
+ CancelSessionReason[CancelSessionReason["EmptyProfileOrSpName"] = 25] = "EmptyProfileOrSpName";
43
+ CancelSessionReason[CancelSessionReason["RpmDisabled"] = 27] = "RpmDisabled";
44
+ CancelSessionReason[CancelSessionReason["InvalidRpmPackage"] = 28] = "InvalidRpmPackage";
45
+ CancelSessionReason[CancelSessionReason["LoadRpmPackageError"] = 29] = "LoadRpmPackageError";
46
+ CancelSessionReason[CancelSessionReason["OperationAbandoned"] = 30] = "OperationAbandoned";
47
+ CancelSessionReason[CancelSessionReason["UndefinedReason"] = 127] = "UndefinedReason";
48
+ })(CancelSessionReason || (CancelSessionReason = {}));
49
+ export var EnableProfileResult;
50
+ (function (EnableProfileResult) {
51
+ EnableProfileResult[EnableProfileResult["Ok"] = 0] = "Ok";
52
+ EnableProfileResult[EnableProfileResult["IccidOrAidNotFound"] = 1] = "IccidOrAidNotFound";
53
+ EnableProfileResult[EnableProfileResult["ProfileNotInDisabledState"] = 2] = "ProfileNotInDisabledState";
54
+ EnableProfileResult[EnableProfileResult["DisallowedByPolicy"] = 3] = "DisallowedByPolicy";
55
+ EnableProfileResult[EnableProfileResult["WrongProfileReenabling"] = 4] = "WrongProfileReenabling";
56
+ EnableProfileResult[EnableProfileResult["CatBusy"] = 5] = "CatBusy";
57
+ EnableProfileResult[EnableProfileResult["DisallowedByEnterpriseRule"] = 6] = "DisallowedByEnterpriseRule";
58
+ EnableProfileResult[EnableProfileResult["CommandError"] = 7] = "CommandError";
59
+ EnableProfileResult[EnableProfileResult["DisallowedForRpm"] = 9] = "DisallowedForRpm";
60
+ EnableProfileResult[EnableProfileResult["NoEsimPortAvailable"] = 10] = "NoEsimPortAvailable";
61
+ EnableProfileResult[EnableProfileResult["UndefinedError"] = 127] = "UndefinedError";
62
+ })(EnableProfileResult || (EnableProfileResult = {}));
63
+ export var DisableProfileResult;
64
+ (function (DisableProfileResult) {
65
+ DisableProfileResult[DisableProfileResult["Ok"] = 0] = "Ok";
66
+ DisableProfileResult[DisableProfileResult["IccidOrAidNotFound"] = 1] = "IccidOrAidNotFound";
67
+ DisableProfileResult[DisableProfileResult["ProfileNotInEnabledState"] = 2] = "ProfileNotInEnabledState";
68
+ DisableProfileResult[DisableProfileResult["DisallowedByPolicy"] = 3] = "DisallowedByPolicy";
69
+ DisableProfileResult[DisableProfileResult["CatBusy"] = 5] = "CatBusy";
70
+ DisableProfileResult[DisableProfileResult["DisallowedByEnterpriseRule"] = 6] = "DisallowedByEnterpriseRule";
71
+ DisableProfileResult[DisableProfileResult["CommandError"] = 7] = "CommandError";
72
+ DisableProfileResult[DisableProfileResult["DisallowedForRpm"] = 9] = "DisallowedForRpm";
73
+ DisableProfileResult[DisableProfileResult["UndefinedError"] = 127] = "UndefinedError";
74
+ })(DisableProfileResult || (DisableProfileResult = {}));
75
+ export var DeleteProfileResult;
76
+ (function (DeleteProfileResult) {
77
+ DeleteProfileResult[DeleteProfileResult["Ok"] = 0] = "Ok";
78
+ DeleteProfileResult[DeleteProfileResult["IccidOrAidNotFound"] = 1] = "IccidOrAidNotFound";
79
+ DeleteProfileResult[DeleteProfileResult["ProfileNotInDisabledState"] = 2] = "ProfileNotInDisabledState";
80
+ DeleteProfileResult[DeleteProfileResult["DisallowedByPolicy"] = 3] = "DisallowedByPolicy";
81
+ DeleteProfileResult[DeleteProfileResult["DisallowedInTestMode"] = 4] = "DisallowedInTestMode";
82
+ DeleteProfileResult[DeleteProfileResult["CommandError"] = 7] = "CommandError";
83
+ DeleteProfileResult[DeleteProfileResult["UndefinedError"] = 127] = "UndefinedError";
84
+ })(DeleteProfileResult || (DeleteProfileResult = {}));
85
+ /**
86
+ * Error codes from ProfileInstallationResult errorResult (reasonCode).
87
+ * Per SGP.22 Section 5.7.7.
88
+ */
89
+ export var BppInstallErrorCode;
90
+ (function (BppInstallErrorCode) {
91
+ BppInstallErrorCode[BppInstallErrorCode["IncorrectInputValues"] = 1] = "IncorrectInputValues";
92
+ BppInstallErrorCode[BppInstallErrorCode["InvalidSignature"] = 2] = "InvalidSignature";
93
+ BppInstallErrorCode[BppInstallErrorCode["InvalidTransactionId"] = 3] = "InvalidTransactionId";
94
+ BppInstallErrorCode[BppInstallErrorCode["UnsupportedCrtValues"] = 4] = "UnsupportedCrtValues";
95
+ BppInstallErrorCode[BppInstallErrorCode["UnsupportedRemoteOperationType"] = 5] = "UnsupportedRemoteOperationType";
96
+ BppInstallErrorCode[BppInstallErrorCode["UnsupportedProfileClass"] = 6] = "UnsupportedProfileClass";
97
+ BppInstallErrorCode[BppInstallErrorCode["Scp03tStructureError"] = 7] = "Scp03tStructureError";
98
+ BppInstallErrorCode[BppInstallErrorCode["Scp03tSecurityError"] = 8] = "Scp03tSecurityError";
99
+ BppInstallErrorCode[BppInstallErrorCode["IccidAlreadyExistsOnEuicc"] = 9] = "IccidAlreadyExistsOnEuicc";
100
+ BppInstallErrorCode[BppInstallErrorCode["InsufficientMemoryForProfile"] = 10] = "InsufficientMemoryForProfile";
101
+ BppInstallErrorCode[BppInstallErrorCode["InstallInterrupted"] = 11] = "InstallInterrupted";
102
+ BppInstallErrorCode[BppInstallErrorCode["PeProcessingError"] = 12] = "PeProcessingError";
103
+ BppInstallErrorCode[BppInstallErrorCode["DataMismatch"] = 13] = "DataMismatch";
104
+ BppInstallErrorCode[BppInstallErrorCode["TestProfileInvalidNaaKey"] = 14] = "TestProfileInvalidNaaKey";
105
+ BppInstallErrorCode[BppInstallErrorCode["PprNotAllowed"] = 15] = "PprNotAllowed";
106
+ BppInstallErrorCode[BppInstallErrorCode["UnknownError"] = 127] = "UnknownError";
107
+ })(BppInstallErrorCode || (BppInstallErrorCode = {}));
108
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,uDAAY,CAAA;IACZ,qDAAW,CAAA;AACb,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB;AAED,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,+CAAQ,CAAA;IACR,+DAAgB,CAAA;IAChB,6DAAe,CAAA;AACjB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,iEAAc,CAAA;IACd,8DAAa,CAAA;IACb,gEAAc,CAAA;IACd,8DAAa,CAAA;AACf,CAAC,EALW,iBAAiB,KAAjB,iBA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AoB,CAAA;IACpB,qFAAoB,CAAA;AACtB,CAAC,EAVW,oBAAoB,KAApB,oBAAoB,QAU/B;AAED,MAAM,CAAN,IAAY,mBAQX;AARD,WAAY,mBAAmB;IAC7B,yDAAM,CAAA;IACN,yFAAsB,CAAA;IACtB,uGAA6B,CAAA;IAC7B,yFAAsB,CAAA;IACtB,6FAAwB,CAAA;IACxB,6EAAgB,CAAA;IAChB,mFAAoB,CAAA;AACtB,CAAC,EARW,mBAAmB,KAAnB,mBAAmB,QAQ9B;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,mBAiBX;AAjBD,WAAY,mBAAmB;IAC7B,6FAAwB,CAAA;IACxB,qFAAoB,CAAA;IACpB,6FAAwB,CAAA;IACxB,6FAAwB,CAAA;IACxB,iHAAkC,CAAA;IAClC,mGAA2B,CAAA;IAC3B,6FAAwB,CAAA;IACxB,2FAAuB,CAAA;IACvB,uGAA6B,CAAA;IAC7B,8GAAiC,CAAA;IACjC,0FAAuB,CAAA;IACvB,wFAAsB,CAAA;IACtB,8EAAiB,CAAA;IACjB,sGAA6B,CAAA;IAC7B,gFAAkB,CAAA;IAClB,+EAAkB,CAAA;AACpB,CAAC,EAjBW,mBAAmB,KAAnB,mBAAmB,QAiB9B"}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@particle/esim-tooling",
3
+ "version": "1.0.0",
4
+ "description": "TypeScript library for eSIM profile provisioning (SGP.22)",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "src"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "typecheck": "tsc --noEmit",
21
+ "test": "vitest run",
22
+ "test:watch": "vitest",
23
+ "prepublishOnly": "npm run typecheck && npm test && npm run build"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/particle-iot/esim-tooling"
28
+ },
29
+ "author": "Julien Vanier <julien@particle.io>",
30
+ "keywords": [
31
+ "esim",
32
+ "lpa",
33
+ "sgp22",
34
+ "euicc",
35
+ "profile",
36
+ "provisioning",
37
+ "cellular",
38
+ "iot"
39
+ ],
40
+ "license": "Apache-2.0",
41
+ "engines": {
42
+ "node": ">=22.x"
43
+ },
44
+ "devDependencies": {
45
+ "@types/node": "^22.0.0",
46
+ "typescript": "^5.7.0",
47
+ "vitest": "^3.0.0"
48
+ },
49
+ "dependencies": {}
50
+ }
@@ -0,0 +1,64 @@
1
+ import { ActivationCodeError } from './errors.js';
2
+ import type { ActivationCode } from './types.js';
3
+
4
+ /**
5
+ * Parse an RSP activation code string per SGP.22 Section 4.1.
6
+ * Format: LPA:1$<smdpAddress>$<matchingId>[$<smdpOid>][$<ccRequired>]
7
+ * Per spec, the parser SHALL ignore a delimiter and any further parameters
8
+ * beyond those it recognizes.
9
+ */
10
+ export function parseActivationCode(code: string): ActivationCode {
11
+ // Strip optional "LPA:" prefix
12
+ let input = code;
13
+ if (input.startsWith('LPA:')) {
14
+ input = input.substring(4);
15
+ }
16
+
17
+ const parts = input.split('$');
18
+ if (parts.length < 3) {
19
+ throw new ActivationCodeError('Activation code must have at least format, address, and matching ID');
20
+ }
21
+
22
+ const format = parseInt(parts[0], 10);
23
+ if (format !== 1) {
24
+ throw new ActivationCodeError(`Unsupported activation code format: ${format}`);
25
+ }
26
+
27
+ const smdpAddress = parts[1];
28
+ if (!smdpAddress) {
29
+ throw new ActivationCodeError('SM-DP+ address is required');
30
+ }
31
+
32
+ const matchingId = parts[2];
33
+
34
+ const smdpOid = parts.length > 3 && parts[3] ? parts[3] : undefined;
35
+ const confirmationCodeRequired = parts.length > 4 && parts[4] === '1';
36
+
37
+ return {
38
+ format,
39
+ smdpAddress,
40
+ matchingId,
41
+ smdpOid,
42
+ confirmationCodeRequired,
43
+ };
44
+ }
45
+
46
+ export function isValidActivationCode(code: string): boolean {
47
+ try {
48
+ parseActivationCode(code);
49
+ return true;
50
+ } catch {
51
+ return false;
52
+ }
53
+ }
54
+
55
+ export function formatActivationCode(params: Omit<ActivationCode, 'format'>): string {
56
+ let code = `1$${params.smdpAddress}$${params.matchingId}`;
57
+ if (params.smdpOid || params.confirmationCodeRequired) {
58
+ code += `$${params.smdpOid ?? ''}`;
59
+ }
60
+ if (params.confirmationCodeRequired) {
61
+ code += '$1';
62
+ }
63
+ return code;
64
+ }