GoogleChromeLabs/chromeos_smart_card_connector

Access from Android app

Closed this issue ยท 8 comments

Hi there,
I'm developing an application for chrome os which works with pc/sc card reader. Is there any way to call pc/sc apis from an android app?

Hello, currently there's no such possibility. Could you please explain your use case in a more detail, so that we would better understand the goal and priorities? Thanks.

Hi @emaxx-google
We're developing an Android application for chromebook which needs to read smart cards tag id.
What solution do you recommend?
Unfortunately, chrome os doesn't support USB Host, so we can't connect to card reader directly from Android app.

Hi @emaxx-google We're developing an Android application for chromebook which needs to read smart cards tag id. What solution do you recommend? Unfortunately, chrome os doesn't support USB Host, so we can't connect to card reader directly from Android app.

@alizarei95 Yes, sadly I don't think there's a good option for Android applications at the moment.

Current alternatives are writing a Chrome Extension instead. There are also ongoing efforts to expose access to Isolated Web Apps.

@emaxx-google
Is it possible to connect to connector app directly from extension? Or a middleware app is needed?

If you need PC/SC, then direct communication is possible and is exactly what you need - see https://github.com/GoogleChromeLabs/chromeos_smart_card_connector/blob/main/docs/index-third-party-application-developer.md and https://github.com/GoogleChromeLabs/chromeos_smart_card_connector/blob/main/docs/connector-app-api.md.

To suppress warnings in the Connector's UI, you'll want to allowlist your extension ID in our config with "known" clients: https://github.com/GoogleChromeLabs/chromeos_smart_card_connector/blob/main/third_party/pcsc-lite/naclport/server_clients_management/src/known_client_apps.json

P.S. As for the role of the middleware, it's mostly for letting the OS do high-level operations like "authenticate in TLS using the smart card" (https://developer.chrome.com/docs/extensions/reference/certificateProvider/ is used for the OS to talk to the middleware). Right now we don't let other extensions use the middleware's capabilities.

I checked sample projects in this repo, but all of them are using manifest v2, is there any sample based on mv3?
I'm new in chrome extensions and I don't have any idea how to import connector js library in service worker.
@emaxx-google

@alizarei95 You're right, we lack the examples at the moment. I've filed #1051 to track this.

In a nutshell, you need to use google-smart-card-client-library-es-module.js (distributed on Github with every release). You can load it as an ES module, and then use like other examples to call the API methods:

import {GoogleSmartCard} from './google-smart-card-client-library-es-module.js';

Closing this as there's no current plan to provide PC/SC to Android apps on ChromeOS.

In case of further questions regarding the Extension development, please file separate issues.