IPSec VPN Client in Java Script using Chrome's "networkingPrivate" API - javascript

I want to add VPN client support to an existing chrome extension. I noticed that chrome has an API named 'networkingPrivate' for many network configurations. I kick started with a java script that calls some of the methods provided by networkingPrivate API. But, I'm facing chrome.networkingPrivate 'undefined' error. Any reference on how to use the API in a chrome extension would be of great help!

Chrome OS only, kiosk apps only (not extensions), dev channel only, and it is being renamed.
https://developer.chrome.com/apps/networking_onc
You probably want chrome.vpnProvider instead anyway, but that's still Chrome OS only.

Related

'chrome.sockets.tcp' in a PWA?

I am creating a PWA using Nuxt and I want to use the Chrome TCP API to communicate with TCP devices directly. The API is detailed here https://developer.chrome.com/apps/sockets_tcp
I have confirmed that clients are downloading it when they access the page.
manifest.json
{
"name":"pwa-demo",
"short_name":"pwa-demo",
"description":"Test App",
"publicPath":"//_nuxt/",
"icons":[
{
"src":"/_nuxt/icons/icon_64.fj_mLYH_Zr_.png",
"sizes":"64x64",
"type":"image/png"
}
],
"start_url":"/?standalone=true",
"display":"standalone",
"background_color":"#ffffff",
"theme_color":false,
"lang":"en",
"sockets":{
"tcp":{
"connect":[
"*:8023"
]
}
}
}
However, when the PWA is run in the browser or after installation (both on desktop and Android) in all cases I get the following error trying to call a chrome.sockets.tcp API: TypeError: Cannot read property 'tcp' of undefined
The Chrome "apps" API (https://developer.chrome.com/apps) does seem to suggest that it is meant to be done using Cordova but I figured that that suggestion was old (there's other content on the page from 2014) and that once a PWA is installed there shouldn't be a functional difference between an installed Cordova app and a new installed PWA. They're both wrappers around a Chrome WebView (except of course Cordova can expose more native APIs).
I am guessing that the chrome.sockets.tcp API is actually exposed through the Cordova wrapper and not Chrome itself, but I have not found anything that confirms this. Google has publicly expressed that they want PWAs to replace Chrome Apps so one would hope that the API was moved into Chrome itself. There seems to be a lot of people confused about whether it can be used by Chrome extensions too.
Is my manifest wrong? Or can someone confirm that this API is not usable by PWAs?
Chrome Apps are specialized apps that are distributed through the Chrome Web Store. Think browser extensions but more app like. Websites do not have access to the privileged APIs available to Chrome Apps.
Also note that Chrome Apps are being retired for everything other than Chrome OS.

Writing chrome extension to control serial port

I want to write a chrome extension (not chrome app) to control serial port but chrome extension doesnt provide any api to access it.
Because chrome doesnt give permission to direct access the port, I thought I can write C code that control the serial port and then I use this C code in the extension. I found several method to use C codes in the chrome extension. These are;
Pepper api
Emscripten
Native communication
I dont want to use native communication because it requires third party apps.
Emscripten is a tool that convert c code to javascript code. But I cant access the serial port on windows because it doesnt support platform-specific code such as "Windows.h"
Pepper api is part of the chrome development tools but I cant see any api that can access the serial port. Maybe I miss something that can be useful.
Are there any way to control serial port in the chrome extension without using third party app or using chrome app.
You can use the chrome.runtime.connect API to connect your chrome extension to a chrome app. You can then have the chrome app do the serial work, while still being able to access the interface (or whatever your plans are with the chrome extension) in that chrome extension.
This does require both the chrome extension and the chrome app to be installed but it does achieve your goal.

Chrome extension private API?

Hello I would like to use networkingPrivate api, which one is from chrome private API, I have added permission for networkingPrivate but it seems that is not enough. Also I found this
These are only usable by extensions bundled with Chrome, they are not publicly accessible.
here: https://developer.chrome.com/extensions/private_apis, but I'm not sure what that exactly mean, and how to do that.
My original intention is to get info about wifi (ssid,...)?
Thanks
It would be a security risk to allow user extensions to access this information direct from the OS. I think the private API is for Chrome OS, so that you can access and modify OS features direct from the browser, since Chrome OS is basically just a browser.
You could try looking at Native Messaging, which I believe will allow you to connect your extension to a native application installed on the host's machine. The application written by you would have some link between the extension, and then you can pass messages between the two. For example, your extension could request network information, and the native app will get that and send this information back to the extension.
I haven't looked into this so I may be wrong, but worth investigating. I'd be very interested to see the result.
Private APIs are made for internally usage.
For example, DeveloperPrivate API is used on chrome://extensions page.
They have stronger power than other APIs. but they also have security issues if they are open. if you really need to use them, just ask to make new API.

How to get the windows user name using javascript in google chrome browser for google chrome extension

I have used the following code in javascript to get the windows user name in Firefox to create a firefox extension.
Components.classes["#mozilla.org/process/environment;1"].getservice(components.interfaces.nsienvironment).get('username');
Now I need to get the windows user name in javascript for Google Chrome to create a sample google chrome extension.
Google Chrome does not provide an Extension API to access the info from the Operating System, like Firefox does.
But you can write your own NPAPI Plugin, which fetches the required info from the OS; and your Chrome extension can call it via JavaScript.
Please note that NPAPI plugin has full unrestricted access to the system, so any vulnerabilities can be used by an attacker to compromise the users system.
Reference: Chrome Extensions NSAPI, MDC NPAPI Reference
Update [02-Jan-2015]: As pointed out by levant pied, Chrome no longer supports NPAPI, but you can use PPAPI or NaCl modules to access the system. More details.

How to call run/invoke a local application inside google chrome

In out local intranet, we have a website that will be only used inside our intranet.
Before we use it in internet explorer, there are lots of page using JavaScript + ActiveX to open local applications, like Microsoft excel etc.
Now we want to shift to using Google Chrome, but we don't know to call these applications inside Chrome.
Is it possible to do in Google Chrome? Or is there any extensions of Chrome can do it?
You can do it with NPAPI Plugins: "You can bundle an NPAPI plugin with your extension, allowing you to call into native binary code from JavaScript."
I have seen the new desktop notification from google, that does work really outside the browser, so you can have look on its concepts and try to mimic its techniques!
You could check out Native Client SDK for Google Chrome.

Categories