Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access from Android app #965

Closed
alizarei95 opened this issue Aug 28, 2023 · 8 comments
Closed

Access from Android app #965

alizarei95 opened this issue Aug 28, 2023 · 8 comments

Comments

@alizarei95
Copy link

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?

@emaxx-google
Copy link
Collaborator

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.

@alizarei95
Copy link
Author

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.

@emaxx-google
Copy link
Collaborator

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.

@alizarei95
Copy link
Author

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

@emaxx-google
Copy link
Collaborator

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.

@alizarei95
Copy link
Author

alizarei95 commented Sep 13, 2023

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

@emaxx-google
Copy link
Collaborator

@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';

@emaxx-google
Copy link
Collaborator

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.

@emaxx-google emaxx-google closed this as not planned Won't fix, can't repro, duplicate, stale Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants