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