Skip to content

Commit 130c3d3

Browse files
committed
1 parent a396219 commit 130c3d3

File tree

3 files changed

+259
-0
lines changed

3 files changed

+259
-0
lines changed

docs/Appendix-URI-Content.md

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

docs/Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ The markdown sources for the [Read the Docs online manual](https://php-qrcode.re
9090

9191

9292
### Appendix
93+
- [Glossary](./Appendix-Appendix-URI-Content.md)
9394
- [Glossary](./Appendix-Terminology.md)
9495
- [License](./Appendix-License.rst)
9596

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ This work is licensed under the Creative Commons Attribution 4.0 International (
4444
:caption: Appendix
4545

4646
Appendix-Terminology.md
47+
Appendix-URI-Content.md
4748
Appendix-License.md
4849

0 commit comments

Comments
 (0)