Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
pull_request:
workflow_dispatch:

permissions:
contents: read
packages: read

jobs:
build-and-test:
runs-on: ubuntu-latest
Expand All @@ -21,9 +25,14 @@ jobs:
with:
node-version: 22
cache: "npm"
registry-url: "https://npm.pkg.github.com"
scope: "@aokiapp"
always-auth: true

- name: Install dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build all packages
run: npm run build
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/rn-android-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
- "docs/android-build.md"
workflow_dispatch:

permissions:
contents: read
packages: read

jobs:
android:
runs-on: ubuntu-latest
Expand All @@ -30,6 +34,9 @@ jobs:
with:
node-version: 22
cache: "npm"
registry-url: "https://npm.pkg.github.com"
scope: "@aokiapp"
always-auth: true

- name: Setup Java 21
uses: actions/[email protected]
Expand All @@ -44,6 +51,8 @@ jobs:

- name: Install dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build packages (generates nitrogen files)
run: npm run build
Expand Down Expand Up @@ -79,6 +88,9 @@ jobs:
with:
node-version: 22
cache: "npm"
registry-url: "https://npm.pkg.github.com"
scope: "@aokiapp"
always-auth: true

- name: Setup Java 21
uses: actions/[email protected]
Expand All @@ -94,6 +106,8 @@ jobs:

- name: Install dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build packages (generates nitrogen files)
run: npm run build
Expand Down
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@aokiapp:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
1 change: 0 additions & 1 deletion examples/rn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ File: `android/app/src/main/AndroidManifest.xml`
<!-- NFC Permissions -->
<uses-permission android:name="android.permission.NFC" />
<uses-feature android:name="android.hardware.nfc" android:required="false" />
<uses-feature android:name="android.hardware.nfc.hce" android:required="false" />
```

## Running the App
Expand Down
1 change: 0 additions & 1 deletion examples/rn/src/screens/SmartCardTestScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ function SmartCardTestScreenInner() {
console.log(`[Plat] Device[${idx}]`, {
id: info.id,
supportsApdu: info.supportsApdu,
supportsHce: info.supportsHce,
integrated: info.isIntegratedDevice,
removable: info.isRemovableDevice,
d2c: info.d2cProtocol,
Expand Down
22 changes: 11 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/interface/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class MyPlatform extends SmartCardPlatform {
id: 'device-1',
friendlyName: 'My Reader',
supportsApdu: true,
supportsHce: false,
isIntegratedDevice: false,
isRemovableDevice: true,
d2cProtocol: 'iso7816',
Expand Down
58 changes: 1 addition & 57 deletions packages/interface/src/abstracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@ export abstract class SmartCardDeviceInfo {
*/
public abstract readonly supportsApdu: boolean;

/**
* Supports Host Card Emulation
*/
public abstract readonly supportsHce: boolean;

/**
* The device is an integrated reader (phone inside)
*/
Expand Down Expand Up @@ -249,7 +244,7 @@ export abstract class SmartCardDevice<
/**
* Card acquired by the device
*/
protected card: SmartCard | EmulatedCard | null = null;
protected card: SmartCard | null = null;

/**
* Get the device information of itself
Expand Down Expand Up @@ -297,10 +292,6 @@ export abstract class SmartCardDevice<
*/
public abstract waitForCardPresence(timeout: number): Promise<void>;

/**
* Start HCE session
*/
public abstract startHceSession(): Promise<EmulatedCard>;
/**
* Release the device and its card session
* @throws {SmartCardError} If release fails
Expand Down Expand Up @@ -389,50 +380,3 @@ export abstract class SmartCard<Events extends EventsMap = DefaultEvents> {
}

type Atr = Uint8Array;

export abstract class EmulatedCard<Events extends EventsMap = DefaultEvents> {
protected eventEmitter = createNanoEvents<Events>();
/**
* @constructor
*/
protected constructor(protected parentDevice: SmartCardDevice) {}

/**
* Whether acquired device session is active or not
*/
public abstract isActive(): boolean;

/**
* Set APDU handler
* @throws {SmartCardError} If setting handler fails
*/
public abstract setApduHandler(
handler: (command: Uint8Array) => Promise<Uint8Array>,
): Promise<void>;

/**
* Release the session
* @throws {SmartCardError} If release fails
*/
public abstract release(): Promise<void>;

/**
* asyncDispose, use in conjunction with `await using`
*/
public async [Symbol.asyncDispose]() {
try {
await this.release();
} catch (error) {
throw fromUnknownError(error);
}
}

/**
* Event emitter for emulated card events
*/
on<K extends keyof Events>(event: K, cb: Events[K]): () => void {
return this.eventEmitter.on(event, cb);
}

// emit is not exposed, use eventEmitter directly
}
1 change: 0 additions & 1 deletion packages/pcsc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ Reader information and capabilities. Extends `SmartCardDeviceInfo`.
- `friendlyName: string` - Display name (same as id for PC/SC)
- `description: string` - Reader description
- `supportsApdu: boolean` - Always true for PC/SC readers
- `supportsHce: boolean` - Always false (PC/SC doesn't support HCE)
- `isIntegratedDevice: boolean` - Always false (PC/SC readers are external)
- `isRemovableDevice: boolean` - Always true
- `d2cProtocol: string` - "iso7816" or "nfc" (detected from reader name)
Expand Down
8 changes: 0 additions & 8 deletions packages/pcsc/src/device-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ export class PcscDeviceInfo extends SmartCardDeviceInfo {
return true;
}

/**
* Supports Host Card Emulation
* PC/SC readers typically don't support HCE
*/
public get supportsHce(): boolean {
return false;
}

/**
* The device is an integrated reader (phone inside)
* PC/SC readers are typically external devices
Expand Down
12 changes: 0 additions & 12 deletions packages/pcsc/src/device.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
EmulatedCard,
SmartCard,
SmartCardDevice,
SmartCardDeviceInfo,
Expand Down Expand Up @@ -204,17 +203,6 @@ export class PcscDevice extends SmartCardDevice {
throw new SmartCardError("TIMEOUT", "Timed out waiting for card presence");
}

/**
* Start an HCE session
* @throws {SmartCardError} Always throws as PC/SC doesn't support HCE
*/
public startHceSession(): Promise<EmulatedCard> {
throw new SmartCardError(
"UNSUPPORTED_OPERATION",
"PC/SC does not support Host Card Emulation",
);
}

/**
* Release the device and its card session
* @throws {SmartCardError} If release fails
Expand Down
1 change: 0 additions & 1 deletion packages/pcsc/tests/pcsc-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ async function testPcscPlatform() {
console.log(` D2C Protocol: ${info.d2cProtocol}`);
console.log(` P2D Protocol: ${info.p2dProtocol}`);
console.log(` Supports APDU: ${info.supportsApdu}`);
console.log(` Supports HCE: ${info.supportsHce}`);
});

if (deviceInfos.length > 0) {
Expand Down
7 changes: 0 additions & 7 deletions packages/rn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Add to `AndroidManifest.xml`:
```xml
<uses-permission android:name="android.permission.NFC" />
<uses-feature android:name="android.hardware.nfc" android:required="false" />
<uses-feature android:name="android.hardware.nfc.hce" android:required="false" />
```

## Quick Start
Expand Down Expand Up @@ -255,7 +254,6 @@ async function getAvailableDevices() {
console.log(` ID: ${device.id}`);
console.log(` Type: ${device.d2cProtocol}`);
console.log(` Supports APDU: ${device.supportsApdu}`);
console.log(` Supports HCE: ${device.supportsHce}`);
});

// Use specific device
Expand Down Expand Up @@ -638,11 +636,6 @@ Whether device supports APDU communication.

**Value:** Always `true` for NFC devices in this package.

#### `supportsHce: boolean`
Whether device supports Host Card Emulation.

**Value:** Currently always `false` (HCE support planned for future).

#### `isIntegratedDevice: boolean`
Whether device is built into the phone.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ object NfcPlatformHelper {
friendlyName = "Integrated NFC Reader",
description = "Android NFC with ISO-DEP support",
supportsApdu = true,
supportsHce = false,
isIntegratedDevice = true,
isRemovableDevice = false,
d2cProtocol = D2CProtocol.NFC,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ object OmapiPlatformHelper {
friendlyName = "$deviceType Secure Element",
description = "OMAPI: $readerName",
supportsApdu = true,
supportsHce = false,
isIntegratedDevice = deviceType == "eSE",
isRemovableDevice = deviceType == "SIM",
d2cProtocol = D2CProtocol.NFC,
Expand Down
1 change: 0 additions & 1 deletion packages/rn/src/JsapduRn.nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export interface DeviceInfo {
friendlyName?: string;
description?: string;
supportsApdu: boolean;
supportsHce: boolean;
isIntegratedDevice: boolean;
isRemovableDevice: boolean;
d2cProtocol: D2CProtocol;
Expand Down
8 changes: 0 additions & 8 deletions packages/rn/src/device/rn-device-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import type { DeviceInfo } from '../JsapduRn.nitro';
* For Android NFC implementation:
* - id: "integrated-nfc-0" (example, not fixed)
* - apduApi: ["nfc", "androidnfc"] (both included)
* - supportsHce: false (initial version)
* - isIntegratedDevice: true
* - isRemovableDevice: false
* - d2cProtocol: "nfc"
Expand Down Expand Up @@ -61,12 +60,6 @@ export class RnDeviceInfo extends SmartCardDeviceInfo {
*/
public readonly supportsApdu: boolean;

/**
* Whether device supports Host Card Emulation
* false in initial version
*/
public readonly supportsHce: boolean;

/**
* Whether device is integrated into the phone
* true for built-in NFC reader
Expand Down Expand Up @@ -122,7 +115,6 @@ export class RnDeviceInfo extends SmartCardDeviceInfo {
this.friendlyName = info.friendlyName;
this.description = info.description;
this.supportsApdu = info.supportsApdu;
this.supportsHce = info.supportsHce;
this.isIntegratedDevice = info.isIntegratedDevice;
this.isRemovableDevice = info.isRemovableDevice;
this.d2cProtocol = info.d2cProtocol;
Expand Down
Loading
Loading