The **secureElement** module provides APIs for operating and managing the SecureElement (SE). The SE service mentioned in this document is an **SEService** instance. For details, see [newSEService](#secureelementnewseservice).
The instances of the following classes are involved in this document.
| Session | A **Session** instance represents a session for connecting to an available SE on the device.|
| Reader | A **Reader** instance represents an SE reader supported by the device. |
| Channel | A **Channel** instance represents an ISO/IEC 7816-4 channel opened to the SE. |
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Creates an **SEService** instance for connecting to all available SEs in the system. The connection is time-consuming. Therefore, this API supports only the asynchronous mode.
The returned **SEService** object is available only when **true** is returned by the specified callback or [isConnected](#seserviceisconnected).
Obtains the available SE readers. The returned array cannot contain duplicate objects. Even if no card is inserted, all available readers should be listed.
Obtains the reader name. If the card reader is a SIM reader, its name must be in **SIM[Slot]** format. If the card reader is an embedded SE reader, its name must be in **eSE[slot]** format.
Connects to the SE of this reader. This API initializes the SE for communication before returning the session object. Multiple sessions may be opened on a reader at the same time.
| aid | number[] | AIDs of the applets selected on this channel or null if no applet is selected. |
**Return value**
| **Type**| **Description** |
| -------- | --------------------- |
| Channel | Returns the **Channel** instance opened. If the SE cannot provide a new basic channel or cannot obtain the access control rule due to lack of available basic channels, null will be returned. |
**Error codes**
For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.md).
| aid | number[] | AIDs of the applets selected on this channel or null if no applet is selected. |
| callback | AsyncCallback<Channel> | Callback invoked to return the **Channel** instance opened. If the SE cannot provide a new basic channel or cannot obtain the access control rule due to lack of available basic channels, null will be returned. |
**Error codes**
For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.md).
| aid | number[] | AIDs of the applets selected on this channel or null if no applet is selected. |
| p2 | number | P2 parameter of the **SELECT APDU** command executed on the channel. |
**Return value**
| **Type**| **Description** |
| -------- | --------------------- |
| Channel | Returns the **Channel** instance opened. If the SE cannot provide a new basic channel or cannot obtain the access control rule due to lack of available basic channels, null will be returned. |
**Error codes**
For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.md).
| aid | number[] | AIDs of the applets selected on this channel or null if no applet is selected. |
| p2 | number | P2 parameter of the **SELECT APDU** command executed on the channel. |
| callback | AsyncCallback<Channel> | Callback invoked to return the **Channel** instance opened. If the SE cannot provide a new basic channel or cannot obtain the access control rule due to lack of available basic channels, null will be returned. |
**Error codes**
For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.md).
| Channel | Returns the **Channel** instance opened. If the SE cannot provide a new **Channel** instance or cannot obtain access control rules due to lack of available logical **Channel** instances, null will be returned.|
**Error codes**
For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.md).
| aid | number[] | AIDs of the applets selected on the **Channel** instance. |
| callback | AsyncCallback<Channel> | Callback invoked to return the **Channel** instance opened. If the SE cannot provide a new **Channel** instance or cannot obtain access control rules due to lack of available logical **Channel** instances, null will be returned.|
**Error codes**
For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.md).
Opens a logical channel with the applet represented by the given AID (the AID is not null and the length is not 0).
If the AID length is 0, this API sends a **select** command with the AID length of 0 (as per [GPCS]) to select the Issuer Security Domain of the SE.
If the AID is null, this API sends the **MANAGE CHANNEL Open** only. In this case, the default applet associated with the logical channel is selected.
**P2** is usually **0x00**. The device shall allow any value of **P2** and the following values: **0x00**, **0x04**, **0x08**, **0x0C** as defined in [ISO 7816-4](https://www.iso.org/standard/77180.html).
Opens a logical channel with the applet represented by the given AID (the AID is not null and the length is not 0).
If the AID length is 0, this API sends a **select** command with the AID length of 0 (as per [GPCS]) to select the Issuer Security Domain of the SE.
If the AID is null, this API sends the **MANAGE CHANNEL Open** only. In this case, the default applet associated with the logical channel is selected.
**P2** is usually **0x00**. The device shall allow any value of **P2** and the following values: **0x00**, **0x04**, **0x08**, **0x0C** as defined in [ISO 7816-4](https://www.iso.org/standard/77180.html).
| aid | number[] | AIDs of the applets selected on the **Channel** instance. |
| p2 | number | P2 parameter of the **SELECT APDU** command executed on the channel. |
| callback | AsyncCallback<Channel> | Callback invoked to return the **Channel** instance opened. If the SE cannot provide a new **Channel** instance or cannot obtain access control rules due to lack of available logical **Channel** instances, null will be returned.|
**Error codes**
For details about error codes, see [SE Error Codes](../errorcodes/errorcode-se.md).