URI-Content.md.txt 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. # Popular content and URI schemes
  2. **A brief summary of popular use cases for QR codes.**
  3. ## URL `https`
  4. Perhaps the most common use for QR Codes is to share URLs: simply encode the (URL-encoded) string value
  5. and make sure to include the scheme `http(s)://` so that it can be properly identified by the reader application:
  6. ```
  7. https://en.m.wikipedia.org/wiki/URL
  8. ```
  9. Some URLs may open a vendor specific application, for example the following URL may open the YouTube app:
  10. ```
  11. https://www.youtube.com/watch?v=dQw4w9WgXcQ
  12. ```
  13. **See also:**
  14. - [What is a URL? (Mozilla MDN)](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Web_mechanics/What_is_a_URL)
  15. - [URL (Wikipedia)](https://en.wikipedia.org/wiki/URL)
  16. ## E-Mail `mailto`
  17. E-Mail links are encoded similar to URLs, preceded by the `mailto:` scheme to ensure they are properly identified and the default mail application can be opened.
  18. Parameters may be added as a [URL query string](https://en.wikipedia.org/wiki/Query_string):
  19. ```
  20. mailto:<ADDR>[,...?to=<ADDR>,...&cc=<ADDR>,...&bcc=<ADDR>,...&subject=<SUBJECT>&body=<BODY>]
  21. ```
  22. | Query parameter | Description |
  23. |-----------------|----------------------------------------------------------------------------------------------------------------------------------------------|
  24. | `to` | Alternative to add a recipient address: `mailto:<ADDR>?to=<ADDR>` is equivalent to<br/>`mailto:<ADDR>,<ADDR>` and `mailto:?to=<ADDR>,<ADDR>` |
  25. | `subject` | Subject text: `mailto:<ADDR>?subject=Hello%20World%21` would open the e-mail app<br/>and create a messagewith the subject `Hello World!` |
  26. | `body` | Message body: `mailto:<ADDR>?body=This%20is%20the%20message%20body.`<br/>creates a message with the contents `This is the message body.` |
  27. | `cc` | "Carbon copy" to add one or more `cc` recipients |
  28. | `bcc` | "Blind carbon copy" to add one or more `bcc` recipients |
  29. The fields for recipient adresses (`mailto:`, `to`, `cc`, `bcc`) may contain one or more elements separated by a comma `,`; the values of all fields shall be URL-encoded according to [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986).
  30. **Examples:**
  31. - `mailto:?to=addr1@example.com`
  32. - `mailto:addr1@example.com,addr2@example.com`
  33. - `mailto:addr1@example.com?cc=addr2@example.com&subject=Hello%21`
  34. **See also:**
  35. - [RFC 6068 - The 'mailto' URI Scheme](https://datatracker.ietf.org/doc/html/rfc6068)
  36. - [Email links (Mozilla MDN)](https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/Creating_hyperlinks#email_links)
  37. - [Email (Wikipedia)](https://en.wikipedia.org/wiki/Email)
  38. - [mailto (Wikipedia)](https://en.wikipedia.org/wiki/Mailto)
  39. ## Phone numbers `tel`
  40. A phone number should be prefixed with the `tel:` scheme so that a device's dialer can be invoked properly:
  41. ```
  42. tel:+999-123-456-7890
  43. ```
  44. Generally, the most complete version of a telephone number possible should be used, e.g. `+<country code><area code><number>`, spaces or hyphens may be used to separate blocks.
  45. Some devices may also support the `sms` and `fax` schemes, which are deprecated in favor of `tel`.
  46. **See also:**
  47. - [RFC 3966 - The 'tel' URI for Telephone Numbers](https://datatracker.ietf.org/doc/html/rfc3966)
  48. - [List of country calling codes (Wikipedia)](https://en.wikipedia.org/wiki/List_of_country_calling_codes)
  49. - [National conventions for writing telephone numbers (Wikipedia)](https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers)
  50. - [google/libphonenumber (GitHub)](https://github.com/google/libphonenumber) ([PHP port (GitHub)](https://github.com/giggsey/libphonenumber-for-php))
  51. ## Geo Coordinates `geo`
  52. A geographical coordinate, including altitude can be encoded using the `geo:` URI scheme so that it can be opened with a map application.
  53. ```
  54. geo:<latitude>,<longitude>[,<altitude>;crs=<crs>;u=<num>]
  55. ```
  56. The default coordinate system is WGS-84, for which latitude and longitude should be supplied as decimal degrees, the optional altitude in meters.
  57. The parameter `u` can be used to specify an *uncertainty* value (in meters), a different *coordinate reference system* may be supplied with `crs`.
  58. Some applications support an additional query string with values of `z` for *zoom* level and `q` for a local search *query* (URL-encoded):
  59. ```
  60. geo:<latitude>,<longitude>?z=<zoom>&q=<search>
  61. ```
  62. **Examples:**
  63. - `geo:47.620521,-122.349293`
  64. - `geo:27.988056,86.925278,8848`
  65. - `geo:11.373333,142.591667,-10920;u=10`
  66. - `geo:37.786971,-122.399677;crs=Moon-2011;u=35`
  67. **See also:**
  68. - [RFC 5870 - A Uniform Resource Identifier for Geographic Locations ('geo' URI)](https://datatracker.ietf.org/doc/html/rfc5870)
  69. - [geo URI scheme (Wikipedia)](https://en.wikipedia.org/wiki/Geo_URI_scheme)
  70. - [Coordinate reference system (Wikipedia)](https://en.wikipedia.org/wiki/Coordinate_reference_system)
  71. ## Mobile Authenticators `otpauth`
  72. Mobile authenticators can be added with the `otpauth` scheme:
  73. ```
  74. otpauth://<MODE>/<LABEL>?secret=<SECRET>[&issuer=<ISSUER>&params...]
  75. ```
  76. The path elemets `MODE` and `LABEL` as well as the query parameter `secret` are mandatory, other query parameters are optional,
  77. however, it is strongy advised to add the `issuer` parameter to ease identification.
  78. The `LABEL`, as well as the `issuer` values shall be URL-encoded according to [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986).
  79. | Path element | Description |
  80. |--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
  81. | `MODE` | Authenticator mode, either `totp` (time based) or `hotp` (counter based) |
  82. | `LABEL` | The label is used to identify which account a key is associated with.<br/>It may be prefixed with the issuer name, separated by a colon: `<issuer>:<account>` |
  83. | Query parameter | Description |
  84. |-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
  85. | `secret` | Secret key (required), a cryptographically secure random string, encoded in Base32<br/>according to [RFC 3548](https://datatracker.ietf.org/doc/html/rfc3548) (without padding).<br/>Some authenticators may support Base64 and hexadecimal values as well. |
  86. | `issuer` | A string value indicating the provider or service this account is associated with. |
  87. | `algorithm` | Hash algorithm, may be one of `SHA1` (default), `SHA256` or `SHA512` |
  88. | `digits` | Length of the OTP code: `6` or `8` |
  89. | `counter` | (`hotp` only, required) The initial counter value |
  90. | `period` | (`totp` only) The period of time in seconds a code will be valid for (default: 30) |
  91. The parameters `algorithm`, `digits` and `period` may not be supported by some devices/apps.
  92. **Examples:**
  93. - `otpauth://hotp/example.com:counter-based?secret=JBSWY3DPEHPK3PXP&counter=42`
  94. - `otpauth://hotp/counter-based?secret=JBSWY3DPEHPK3PXP&issuer=example.com&digits=6&algorithm=SHA256&counter=42`
  95. - `otpauth://totp/example.com%3Atime-based?secret=JBSWY3DPEHPK3PXP`
  96. - `otpauth://totp/time-based?secret=JBSWY3DPEHPK3PXP&issuer=example.com&digits=8&algorithm=SHA512&period=60`
  97. **See also:**
  98. - [RFC 4226 - An HMAC-Based One-Time Password Algorithm](https://datatracker.ietf.org/doc/html/rfc4226)
  99. - [RFC 6238 - Time-Based One-Time Password Algorithm](https://datatracker.ietf.org/doc/html/rfc6238)
  100. - [Google Authenticator (Wikipedia)](https://en.wikipedia.org/wiki/Google_Authenticator)
  101. - [google-authenticator: Key Uri Format (GitHub)](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)
  102. - [php-qrcode: Authenticator example (GitHub)](https://github.com/chillerlan/php-qrcode/blob/main/examples/authenticator.php)
  103. ## Wireless Network configuration
  104. Wi-Fi configuration general syntax looks as follows:
  105. ```
  106. WIFI:S:<SSID>[;T:<TYPE>;P:<PASSWORD>;H:<HIDDEN>;];
  107. ```
  108. | Parameter | Description |
  109. |-----------------|----------------------------------------------------------------------------------------------------------------------------------------|
  110. | `S`<sup>*</sup> | Network SSID (required) |
  111. | `T` | Authentication type: can be one of `WEP`, `WPA`, `WPA2-EAP`<br/>or `nopass` for no password (in which case you can omit the parameter) |
  112. | `P`<sup>*</sup> | Password, ignored if parameter `T` is set to `nopass` |
  113. | `H` | Set to `true` the network SSID is hidden. |
  114. <sup>*</sup> the value shall be enclosed in double quotes `"` if it is an ASCII string that can be interpreted as hex, e.g. `"ABCD1234"`,
  115. special characters `\ ; , " :` shall be escaped with a backslash `\`.
  116. Additional parameters for WPA2 and WPA3 (please note that these parameters may not be supported by some devices):
  117. | Parameter | Description |
  118. |-----------|----------------------------------------------------------------------------------------------------------------------------------|
  119. | `A` | WPA2-EAP: Anonymous identity |
  120. | `E` | WPA2-EAP: EAP method, like `TTLS` or `PWD` |
  121. | `PH2` | WPA2-EAP: Phase 2 method, like `MSCHAPV2` |
  122. | `I` | WPA2-EAP, WPA3: UTF-8 encoded password identifier, present if<br/>the password has an SAE password identifier |
  123. | `K` | WPA3: DER of ASN.1 SubjectPublicKeyInfo in compressed form<br/>and encoded in “base64”, present when the network supports SAE-PK |
  124. | `R` | WPA3: Transition Disable value |
  125. **Examples:**
  126. - `WIFI:S:MyNetworkWihoutPassword;;`
  127. - `WIFI:S:MyNetworkWihoutPassword;T:nopass;P:;;`
  128. - `WIFI:S:MyHiddenWpaNetwork;T:WPA;P:"PASSWORD123";H:true;;`
  129. - `WIFI:S:MyHiddenWpa2Network;T:WPA2-EAP;P:"PASSWORD123";H:true;;`
  130. **See also:**
  131. - [WPA3 Specification, Section 7.1](https://www.wi-fi.org/download.php?file=/sites/default/files/private/WPA3%20Specification%20v3.1.pdf)
  132. - [Wi-Fi Protected Access (Wikipedia)](https://en.wikipedia.org/wiki/Wi-Fi_Protected_Access)
  133. ## Contact information: vCard
  134. The vCard is the most commonly used format to exchange contact details. It's too complex to fully explain here, instead just a bare minimum example:
  135. ```
  136. BEGIN:VCARD
  137. VERSION:4.0
  138. N:<NAME>
  139. FN:<FULL NAME>
  140. GENDER:O
  141. EMAIL;type=(WORK|HOME):<EMAIL>
  142. TEL;type=(WORK|CELL|HOME):<PHONE>
  143. ADR;type=WORK:<LINE1>;<LINE2>;<STREET>;<CITY>;<STATE>;<ZIP>;<COUNTRY>
  144. TZ:<CITY/COUNTRY>
  145. URL:<URL>
  146. PHOTO;JPEG:<LINK>
  147. LOGO;JPEG:<LINK>
  148. NOTE:<TEXT>
  149. CATEGORIES:<LIST>
  150. END:VCARD
  151. ```
  152. **See also:**
  153. - [RFC 6350 - vCard Format Specification](https://datatracker.ietf.org/doc/html/rfc6350)
  154. - [vCard (Wikipedia)](https://en.wikipedia.org/wiki/VCard)
  155. - [vCard Ontology - for describing People and Organizations (W3C)](https://www.w3.org/TR/vcard-rdf/)
  156. - [vobject library for PHP (GitHub)](https://github.com/sabre-io/vobject)
  157. ## Calendar Events: vCalendar and iCalendar
  158. Calendar events can be shared via the iCalendar (formerly vCalendar) object (example from [icalendar-generator](https://github.com/spatie/icalendar-generator)):
  159. ```
  160. BEGIN:VCALENDAR
  161. VERSION:2.0
  162. PRODID:spatie/icalendar-generator
  163. NAME:Laracon online
  164. X-WR-CALNAME:Laracon online
  165. BEGIN:VEVENT
  166. UID:5ef5c3f64cb2c
  167. DTSTAMP;TZID=UTC:20200626T094630
  168. SUMMARY:Creating calendar feeds
  169. DTSTART:20190306T150000Z
  170. DTEND:20190306T160000Z
  171. DTSTAMP:20190419T135034Z
  172. END:VEVENT
  173. END:VCALENDAR
  174. ```
  175. **See also:**
  176. - [RFC 5545 - Internet Calendaring and Scheduling Core Object Specification (iCalendar)](https://datatracker.ietf.org/doc/html/rfc5545)
  177. - [iCalendar (Wikipedia)](https://en.wikipedia.org/wiki/ICalendar)
  178. - [vobject library for PHP (GitHub)](https://github.com/sabre-io/vobject)
  179. - [iCalendar generator for PHP (GitHub)](https://github.com/spatie/icalendar-generator)
  180. ## Credit Transfer
  181. ### SEPA (European Payments Council)
  182. - [Guidelines to Enable the Data Capture for the Initiation of a SEPA Credit Transfer](https://www.europeanpaymentscouncil.eu/document-library/guidance-documents/quick-response-code-guidelines-enable-data-capture-initiation)
  183. - [sepa-qr-data library for PHP (GitHub)](https://github.com/smhg/sepa-qr-data-php)
  184. ### Pix (Banco Central do Brasil)
  185. - [Manual de Padrões para Iniciação do Pix (PDF)](https://www.bcb.gov.br/content/estabilidadefinanceira/pix/Regulamento_Pix/II_ManualdePadroesparaIniciacaodoPix.pdf)
  186. - [OpenBoleto (GitHub)](https://github.com/openboleto/openboleto)
  187. ## See also
  188. - [RFC 3986 - Uniform Resource Identifier (URI): Generic Syntax](https://datatracker.ietf.org/doc/html/rfc3986)
  189. - [Uniform Resource Identifier (Wikipedia)](https://en.m.wikipedia.org/wiki/Uniform_Resource_Identifier)
  190. - [List of URI schemes (Wikipedia)](https://en.m.wikipedia.org/wiki/List_of_URI_schemes)
  191. - [zxing: Barcode Contents (GitHub)](https://github.com/zxing/zxing/wiki/Barcode-Contents)