{"action":"created","comment":{"url":"https://api.github.com/repos/google/WebFundamentals/pulls/comments/58024869","id":58024869,"diff_hunk":"@@ -0,0 +1,295 @@\n+---\n+layout: updates/post\n+title: \"Access USB devices on the Web\"\n+description: \"The WebUSB API has been created to provide an easy way to safely expose USB device services to the Web.\"\n+featured_image: /web/updates/images/2016-03-02-access-usb-devices-on-the-web/web-usb-hero.jpg\n+published_on: 2016-03-02\n+updated_on: 2016-03-30\n+authors:\n+  - beaufortfrancois\n+tags:\n+  - news\n+  - USB\n+  - WebUSB\n+  - IoT\n+  - Arduino\n+---\n+\n+If I said plain and simple \"USB\", there are good chances that you will\n+immediately think of keyboards, mice, audio, video and storage devices. You're\n+right but you'll find other kinds of Universal Serial Bus (USB) devices out\n+there.\n+\n+These non-standardized USB devices require hardware vendors to write native\n+drivers and SDKs in order for you (the developer) to take advantage of them.\n+Sadly this native code has historically prevented these devices from being used\n+by the Web. And that's exactly why the WebUSB API has been created: to\n+**provide an easy way to safely expose USB device services to the Web**. With\n+this API, hardware manufacturers will be able to build cross-platform\n+JavaScript SDKs for their devices.\n+\n+## Before we start\n+\n+This article assumes you have some basic knowledge of how USB works. If not, I\n+recommend reading [USB in a NutShell](http://www.beyondlogic.org/usbnutshell).\n+For background information about USB, check out the [official USB\n+specifications](http://www.usb.org/home).\n+\n+The [WebUSB API](https://wicg.github.io/webusb/) draft is hmm... a\n+draft. That's why the Chrome Team is actively looking for eager developers to\n+give it a try and send\n+[feedback on the spec](https://github.com/wicg/webusb/issues) and\n+[feedback on the implementation](https://bugs.chromium.org/p/chromium/issues/entry?components=Blink%3EUSB).\n+\n+At the time of writing, the WebUSB API is partially implemented behind an\n+experimental flag in Chrome for Windows, Mac OS, Linux and Chrome OS. Go to\n+`chrome://flags/#enable-experimental-web-platform-features`, enable the\n+highlighted flag, restart Chrome and you should be good to go.\n+\n+<img style=\"width:723px; max-height:205px\" src=\"/web/updates/images/2016-03-02-access-usb-devices-on-the-web/web-usb-flag.png\" alt=\"Web USB Flag highlighted in chrome://flags\"/>\n+\n+## Privacy & Security\n+\n+### Attacks against USB devices\n+\n+The WebUSB API does not even try to provide a way for any web page to\n+connect to arbitrary USB devices. There are plenty of published attacks against\n+USB devices that makes it unsafe to allow this.\n+\n+For this reason, a USB device can define a set of origins that are allowed to\n+connect to it. This is similar to the\n+[CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS)\n+mechanism in HTTP. In other words, **WebUSB devices are associated with a web\n+origin** and can only be accessed from a page from the same origin.\n+\n+### HTTPS Only\n+\n+Because this experimental API is a powerful new feature added to the Web,\n+Chrome aims to make it available only to [secure\n+contexts](https://w3c.github.io/webappsec/specs/powerfulfeatures/#intro). This\n+means you'll need to build with TLS in mind.\n+\n+During development you'll be able to interact with WebUSB through\n+http://localhost by using some tools like the [Chrome Dev\n+Editor](https://chrome.google.com/webstore/detail/pnoffddplpippgcfjdhbmhkofpnaalpg)\n+or the handy `python -m SimpleHTTPServer`, but to deploy it on a site you'll\n+need to have HTTPS setup on your server. I personally enjoy [GitHub","path":"src/content/en/updates/posts/2016/03/access-usb-devices-on-the-web.markdown","position":76,"original_position":76,"commit_id":"16a60398f822c7d0d30c1913231177d2aa904a56","original_commit_id":"90e49f826a39a84000de1fe613185ea6473cf6b3","user":{"login":"beaufortfrancois","id":634478,"avatar_url":"https://avatars.githubusercontent.com/u/634478?v=3","gravatar_id":"","url":"https://api.github.com/users/beaufortfrancois","html_url":"https://github.com/beaufortfrancois","followers_url":"https://api.github.com/users/beaufortfrancois/followers","following_url":"https://api.github.com/users/beaufortfrancois/following{/other_user}","gists_url":"https://api.github.com/users/beaufortfrancois/gists{/gist_id}","starred_url":"https://api.github.com/users/beaufortfrancois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beaufortfrancois/subscriptions","organizations_url":"https://api.github.com/users/beaufortfrancois/orgs","repos_url":"https://api.github.com/users/beaufortfrancois/repos","events_url":"https://api.github.com/users/beaufortfrancois/events{/privacy}","received_events_url":"https://api.github.com/users/beaufortfrancois/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2016-03-31T09:30:30Z","updated_at":"2016-03-31T09:30:30Z","html_url":"https://github.com/google/WebFundamentals/pull/2685#discussion_r58024869","pull_request_url":"https://api.github.com/repos/google/WebFundamentals/pulls/2685","_links":{"self":{"href":"https://api.github.com/repos/google/WebFundamentals/pulls/comments/58024869"},"html":{"href":"https://github.com/google/WebFundamentals/pull/2685#discussion_r58024869"},"pull_request":{"href":"https://api.github.com/repos/google/WebFundamentals/pulls/2685"}}},"pull_request":{"url":"https://api.github.com/repos/google/WebFundamentals/pulls/2685","id":62720451,"html_url":"https://github.com/google/WebFundamentals/pull/2685","diff_url":"https://github.com/google/WebFundamentals/pull/2685.diff","patch_url":"https://github.com/google/WebFundamentals/pull/2685.patch","issue_url":"https://api.github.com/repos/google/WebFundamentals/issues/2685","number":2685,"state":"open","locked":false,"title":"Add WebUSB article","user":{"login":"beaufortfrancois","id":634478,"avatar_url":"https://avatars.githubusercontent.com/u/634478?v=3","gravatar_id":"","url":"https://api.github.com/users/beaufortfrancois","html_url":"https://github.com/beaufortfrancois","followers_url":"https://api.github.com/users/beaufortfrancois/followers","following_url":"https://api.github.com/users/beaufortfrancois/following{/other_user}","gists_url":"https://api.github.com/users/beaufortfrancois/gists{/gist_id}","starred_url":"https://api.github.com/users/beaufortfrancois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beaufortfrancois/subscriptions","organizations_url":"https://api.github.com/users/beaufortfrancois/orgs","repos_url":"https://api.github.com/users/beaufortfrancois/repos","events_url":"https://api.github.com/users/beaufortfrancois/events{/privacy}","received_events_url":"https://api.github.com/users/beaufortfrancois/received_events","type":"User","site_admin":false},"body":"DO **NOT** MERGE YET","created_at":"2016-03-14T09:39:20Z","updated_at":"2016-03-31T09:30:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7de76f58cd6eddba997c3d6b59b154c204a58cbb","assignee":{"login":"beaufortfrancois","id":634478,"avatar_url":"https://avatars.githubusercontent.com/u/634478?v=3","gravatar_id":"","url":"https://api.github.com/users/beaufortfrancois","html_url":"https://github.com/beaufortfrancois","followers_url":"https://api.github.com/users/beaufortfrancois/followers","following_url":"https://api.github.com/users/beaufortfrancois/following{/other_user}","gists_url":"https://api.github.com/users/beaufortfrancois/gists{/gist_id}","starred_url":"https://api.github.com/users/beaufortfrancois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beaufortfrancois/subscriptions","organizations_url":"https://api.github.com/users/beaufortfrancois/orgs","repos_url":"https://api.github.com/users/beaufortfrancois/repos","events_url":"https://api.github.com/users/beaufortfrancois/events{/privacy}","received_events_url":"https://api.github.com/users/beaufortfrancois/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/google/WebFundamentals/pulls/2685/commits","review_comments_url":"https://api.github.com/repos/google/WebFundamentals/pulls/2685/comments","review_comment_url":"https://api.github.com/repos/google/WebFundamentals/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/WebFundamentals/issues/2685/comments","statuses_url":"https://api.github.com/repos/google/WebFundamentals/statuses/16a60398f822c7d0d30c1913231177d2aa904a56","head":{"label":"google:webUsb","ref":"webUsb","sha":"16a60398f822c7d0d30c1913231177d2aa904a56","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":19249835,"name":"WebFundamentals","full_name":"google/WebFundamentals","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/WebFundamentals","description":"Best practices for modern web development","fork":false,"url":"https://api.github.com/repos/google/WebFundamentals","forks_url":"https://api.github.com/repos/google/WebFundamentals/forks","keys_url":"https://api.github.com/repos/google/WebFundamentals/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/WebFundamentals/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/WebFundamentals/teams","hooks_url":"https://api.github.com/repos/google/WebFundamentals/hooks","issue_events_url":"https://api.github.com/repos/google/WebFundamentals/issues/events{/number}","events_url":"https://api.github.com/repos/google/WebFundamentals/events","assignees_url":"https://api.github.com/repos/google/WebFundamentals/assignees{/user}","branches_url":"https://api.github.com/repos/google/WebFundamentals/branches{/branch}","tags_url":"https://api.github.com/repos/google/WebFundamentals/tags","blobs_url":"https://api.github.com/repos/google/WebFundamentals/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/WebFundamentals/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/WebFundamentals/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/WebFundamentals/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/WebFundamentals/statuses/{sha}","languages_url":"https://api.github.com/repos/google/WebFundamentals/languages","stargazers_url":"https://api.github.com/repos/google/WebFundamentals/stargazers","contributors_url":"https://api.github.com/repos/google/WebFundamentals/contributors","subscribers_url":"https://api.github.com/repos/google/WebFundamentals/subscribers","subscription_url":"https://api.github.com/repos/google/WebFundamentals/subscription","commits_url":"https://api.github.com/repos/google/WebFundamentals/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/WebFundamentals/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/WebFundamentals/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/WebFundamentals/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/WebFundamentals/contents/{+path}","compare_url":"https://api.github.com/repos/google/WebFundamentals/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/WebFundamentals/merges","archive_url":"https://api.github.com/repos/google/WebFundamentals/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/WebFundamentals/downloads","issues_url":"https://api.github.com/repos/google/WebFundamentals/issues{/number}","pulls_url":"https://api.github.com/repos/google/WebFundamentals/pulls{/number}","milestones_url":"https://api.github.com/repos/google/WebFundamentals/milestones{/number}","notifications_url":"https://api.github.com/repos/google/WebFundamentals/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/WebFundamentals/labels{/name}","releases_url":"https://api.github.com/repos/google/WebFundamentals/releases{/id}","deployments_url":"https://api.github.com/repos/google/WebFundamentals/deployments","created_at":"2014-04-28T18:45:45Z","updated_at":"2016-03-30T23:15:49Z","pushed_at":"2016-03-30T22:11:50Z","git_url":"git://github.com/google/WebFundamentals.git","ssh_url":"git@github.com:google/WebFundamentals.git","clone_url":"https://github.com/google/WebFundamentals.git","svn_url":"https://github.com/google/WebFundamentals","homepage":"https://developers.google.com/web/fundamentals","size":990468,"stargazers_count":5429,"watchers_count":5429,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":965,"mirror_url":null,"open_issues_count":237,"forks":965,"open_issues":237,"watchers":5429,"default_branch":"master"}},"base":{"label":"google:master","ref":"master","sha":"a69a14e8e337a34688783cafe13b17753b261bdd","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":19249835,"name":"WebFundamentals","full_name":"google/WebFundamentals","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/WebFundamentals","description":"Best practices for modern web development","fork":false,"url":"https://api.github.com/repos/google/WebFundamentals","forks_url":"https://api.github.com/repos/google/WebFundamentals/forks","keys_url":"https://api.github.com/repos/google/WebFundamentals/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/WebFundamentals/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/WebFundamentals/teams","hooks_url":"https://api.github.com/repos/google/WebFundamentals/hooks","issue_events_url":"https://api.github.com/repos/google/WebFundamentals/issues/events{/number}","events_url":"https://api.github.com/repos/google/WebFundamentals/events","assignees_url":"https://api.github.com/repos/google/WebFundamentals/assignees{/user}","branches_url":"https://api.github.com/repos/google/WebFundamentals/branches{/branch}","tags_url":"https://api.github.com/repos/google/WebFundamentals/tags","blobs_url":"https://api.github.com/repos/google/WebFundamentals/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/WebFundamentals/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/WebFundamentals/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/WebFundamentals/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/WebFundamentals/statuses/{sha}","languages_url":"https://api.github.com/repos/google/WebFundamentals/languages","stargazers_url":"https://api.github.com/repos/google/WebFundamentals/stargazers","contributors_url":"https://api.github.com/repos/google/WebFundamentals/contributors","subscribers_url":"https://api.github.com/repos/google/WebFundamentals/subscribers","subscription_url":"https://api.github.com/repos/google/WebFundamentals/subscription","commits_url":"https://api.github.com/repos/google/WebFundamentals/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/WebFundamentals/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/WebFundamentals/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/WebFundamentals/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/WebFundamentals/contents/{+path}","compare_url":"https://api.github.com/repos/google/WebFundamentals/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/WebFundamentals/merges","archive_url":"https://api.github.com/repos/google/WebFundamentals/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/WebFundamentals/downloads","issues_url":"https://api.github.com/repos/google/WebFundamentals/issues{/number}","pulls_url":"https://api.github.com/repos/google/WebFundamentals/pulls{/number}","milestones_url":"https://api.github.com/repos/google/WebFundamentals/milestones{/number}","notifications_url":"https://api.github.com/repos/google/WebFundamentals/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/WebFundamentals/labels{/name}","releases_url":"https://api.github.com/repos/google/WebFundamentals/releases{/id}","deployments_url":"https://api.github.com/repos/google/WebFundamentals/deployments","created_at":"2014-04-28T18:45:45Z","updated_at":"2016-03-30T23:15:49Z","pushed_at":"2016-03-30T22:11:50Z","git_url":"git://github.com/google/WebFundamentals.git","ssh_url":"git@github.com:google/WebFundamentals.git","clone_url":"https://github.com/google/WebFundamentals.git","svn_url":"https://github.com/google/WebFundamentals","homepage":"https://developers.google.com/web/fundamentals","size":990468,"stargazers_count":5429,"watchers_count":5429,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":965,"mirror_url":null,"open_issues_count":237,"forks":965,"open_issues":237,"watchers":5429,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/google/WebFundamentals/pulls/2685"},"html":{"href":"https://github.com/google/WebFundamentals/pull/2685"},"issue":{"href":"https://api.github.com/repos/google/WebFundamentals/issues/2685"},"comments":{"href":"https://api.github.com/repos/google/WebFundamentals/issues/2685/comments"},"review_comments":{"href":"https://api.github.com/repos/google/WebFundamentals/pulls/2685/comments"},"review_comment":{"href":"https://api.github.com/repos/google/WebFundamentals/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/WebFundamentals/pulls/2685/commits"},"statuses":{"href":"https://api.github.com/repos/google/WebFundamentals/statuses/16a60398f822c7d0d30c1913231177d2aa904a56"}}}}