{"action":"opened","issue":{"url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/1120","labels_url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/1120/labels{/name}","comments_url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/1120/comments","events_url":"https://api.github.com/repos/sandstorm-io/sandstorm/issues/1120/events","html_url":"https://github.com/sandstorm-io/sandstorm/issues/1120","id":114910854,"number":1120,"title":"Feature request: QR code offer templates","user":{"login":"zarvox","id":307325,"avatar_url":"https://avatars.githubusercontent.com/u/307325?v=3","gravatar_id":"","url":"https://api.github.com/users/zarvox","html_url":"https://github.com/zarvox","followers_url":"https://api.github.com/users/zarvox/followers","following_url":"https://api.github.com/users/zarvox/following{/other_user}","gists_url":"https://api.github.com/users/zarvox/gists{/gist_id}","starred_url":"https://api.github.com/users/zarvox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zarvox/subscriptions","organizations_url":"https://api.github.com/users/zarvox/orgs","repos_url":"https://api.github.com/users/zarvox/repos","events_url":"https://api.github.com/users/zarvox/events{/privacy}","received_events_url":"https://api.github.com/users/zarvox/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-03T21:10:43Z","updated_at":"2015-11-03T21:10:43Z","closed_at":null,"body":"## Background\r\n\r\nTo allow apps to present users with some useful UI containing privileged API tokens without violating confinement, we have offer templates: https://docs.sandstorm.io/en/latest/developing/http-apis/#creating-an-offer-template .  This approach works decently for text that you want to copy-paste on a desktop or laptop computer into a shell or text editor or other app.  For mobile apps, however, it's still a pain to need to type in a long, randomized API token.\r\n\r\nA common way to get a unique identifier or other credentials into mobile apps is through the use of QR codes scanned by the camera.  By extending offer templates to present the templated text as a QR code, rather than text, Sandstorm apps can pass API keys to mobile apps without making users have to correctly type long strings.  When an user wants to connect a mobile app to a grain, the grain can show an offer template QR code with whatever information it wants to pass to the mobile app.\r\n\r\n## Implementation proposal\r\n\r\nCreate a file `offer-template-qr.html` which behaves exactly like `offer-template.html`, but displays the rendered template as a QR code instead of as unstyled text.  This will probably require integrating some free software JS library for generating QR codes.\r\n\r\nAdd a new optional field `presentationType` with values `text` (default) and `qr` to the `renderTemplate` `postMessage` API to allow apps to specify to the platform which kind of rendering they would like this template to receive.  When apps request `qr` presentation, reply with a URL containing `offer-template-qr.html` instead of `offer-template.html`.\r\n\r\n## Open questions\r\n\r\n* What modifications will mobile apps need to support this?  Can these changes be neatly upstreamed?"}}