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