3966eaba25c9d56a0e17b2a207d29c7e59f1b7fc
[src/app-framework-main.git] / docs / widgets.md
1 The widgets
2 ===========
3
4 The widgets are described by the W3C's technical recommendations
5 [Packaged Web Apps (Widgets)][widgets] and [XML Digital Signatures for Widgets][widgets-digsig]
6
7 In summary, **widgets are ZIP files that can be signed and
8 whose content is described by the file <config.xml>**.
9
10 Tools for managing widgets
11 --------------------------
12
13 This project includes tools for managing widgets.
14 These tools are:
15
16 - ***wgtpkg-info***: command line tool to display
17   informations about a widget file.
18
19 - ***wgtpkg-installer***: command line tool to
20   install a widget file.
21
22 - ***wgtpkg-pack***: command line tool to create
23   a widget file from a widget directory.
24
25 - ***wgtpkg-sign***: command line tool to add a signature
26   to a widget directory.
27
28 For all these commands, a tiny help is available with
29 options **-h** or **--help**.
30
31 There is no tool for unpacking a widget. For doing such operation,
32 you can use the command **unzip**.
33
34 To list the files of a widget:
35
36 ```bash
37 $ unzip -l WIDGET
38 ```
39
40 To extract a widget in some directory:
41
42 ```bash
43 $ unzip WIDGET -d DIRECTORY
44 ```
45
46 *Note that DIRECTORY will be created if needed*.
47
48 Getting data about a widget file
49 ---------------------------------
50
51 The command **wgtpkg-info** opens a widget file, reads its **config.xml**
52 file and displays its content in a human readable way.
53
54 Signing and packing widget
55 --------------------------
56
57 ### Signing
58
59 To sign a widget, you need a private key and its certificate.
60
61 The tool **wgtpkg-sign** creates or replace a signature file in
62 the directory of the widget BEFORE its packaging.
63
64 There are two types of signature files: author and distributor.
65
66 Example 1: add an author signature
67
68 ```bash
69 $ wgtpkg-sign -a -k me.key.pem -c me.cert.pem DIRECTORY
70 ```
71
72 Example 2: add a distributor signature
73
74 ```bash
75 $ wgtpkg-sign -k authority.key.pem -c authority.cert.pem DIRECTORY
76 ```
77
78 ### Packing
79
80 This operation can be done using the command **zip** but
81 we provide the tool **wgtpkg-pack** that may add checking.
82
83 Example:
84 ```bash
85 $ wgtpkg-pack DIRECTORY -o file.wgt
86 ```
87 Writing a widget
88 ----------------
89
90 ### The steps for writing a widget
91
92 1. make your application
93
94 2. create its configuration file **config.xml**
95
96 3. sign it
97
98 4. pack it
99
100 Fairly easy, no?
101
102 Organization of directory of applications
103 -----------------------------------------
104
105 ### directory where are stored applications
106
107 Applications can be installed in different places: the system itself, extension device.
108 On a phone application are typically installed on the sd card.
109
110 This translates to:
111
112  - /usr/applications: system wide applications
113  - /opt/applications: removable applications
114
115 From here those paths are referenced as: "APPDIR".
116
117 The main path for applications is: APPDIR/PKGID/VER.
118
119 Where:
120
121  - APPDIR is as defined above
122  - PKGID is a directory whose name is the package identifier
123  - VER is the version of the package MAJOR.MINOR
124
125 This organization has the advantage to allow several versions to leave together.
126 This is needed for some good reasons (rolling back) and also for less good reasons (user habits).
127
128 ### Identity of installed files
129
130 All files are installed as user "afm" and group "afm".
131 All files have rw(x) for user and r-(x) for group and others.
132
133 This allows every user to read every file.
134
135 ### labeling the directories of applications
136
137 The data of a user are in its directory and are labelled by the security-manager
138 using the labels of the application.
139
140 [widgets]:          http://www.w3.org/TR/widgets                                    "Packaged Web Apps"
141 [widgets-digsig]:   http://www.w3.org/TR/widgets-digsig                             "XML Digital Signatures for Widgets"
142 [libxml2]:          http://xmlsoft.org/html/index.html                              "libxml2"
143 [app-manifest]:     http://www.w3.org/TR/appmanifest                                "Web App Manifest"
144
145
146 [meta-intel]:       https://github.com/01org/meta-intel-iot-security                "A collection of layers providing security technologies"
147 [widgets]:          http://www.w3.org/TR/widgets                                    "Packaged Web Apps"
148 [widgets-digsig]:   http://www.w3.org/TR/widgets-digsig                             "XML Digital Signatures for Widgets"
149 [libxml2]:          http://xmlsoft.org/html/index.html                              "libxml2"
150 [openssl]:          https://www.openssl.org                                         "OpenSSL"
151 [xmlsec]:           https://www.aleksey.com/xmlsec                                  "XMLSec"
152 [json-c]:           https://github.com/json-c/json-c                                "JSON-c"
153 [d-bus]:            http://www.freedesktop.org/wiki/Software/dbus                   "D-Bus"
154 [libzip]:           http://www.nih.at/libzip                                        "libzip"
155 [cmake]:            https://cmake.org                                               "CMake"
156 [security-manager]: https://wiki.tizen.org/wiki/Security/Tizen_3.X_Security_Manager "Security-Manager"
157 [app-manifest]:     http://www.w3.org/TR/appmanifest                                "Web App Manifest"
158 [tizen-security]:   https://wiki.tizen.org/wiki/Security                            "Tizen security home page"
159 [tizen-secu-3]:     https://wiki.tizen.org/wiki/Security/Tizen_3.X_Overview         "Tizen 3 security overview"
160
161
162
163