Changes

Jump to: navigation, search

Product key

176 bytes added, 13:54, 6 September 2017
no edit summary
Начиная с версии Starting from version 2.1.0 движок работает по engine works by API только с авторизованными приложениямиwith authorized applications only. Авторизация выполняется на этапе рукопожатияAuthorization takes place during handshake (more detailed description you can find below). Для успешной авторизации у приложения должен быть ключ продуктаTo be successfully authorized an application must have a product key. Ключ продукта можно получить бесплатно, заполнив форму [http://www.acestream.net/developers/request_key.php здесь]
== Авторизация приложения ==You can get your personal product key for your application or use a public key: <tt>kjYX790gTytRaXV04IvC-xZH3A18sj5b1Tf3I-J5XVS1xsj-j0797KwxxLpBl26HPvWMm</tt>
If you use the public key, your app can be used only by users who have activated option "No ADs" (Ace Stream disabling ads). If this option is not activated, the engine will send an error "No ADs option must be activated to use this product" when user tries to start playback of some content. '''Attention!''' When your application is ready and you decide to make an opened/public test, send us a request to receive a test key by registering as [[Developers|developer]], with a description of the application and a link to download it. After verification of your product we will give you a special product key which will allow you to make opened/public tests within 30 days for any users, including users who don't have enabled NoADs option. Test for All! If your app supports ad formats of Ace Stream system, you can get a personal product key for free by registering as [[Developers|developer]]. Application with a personal product key can be used by all users, regardless of whether they have any premium options. == Authorization of application ==Below the schema of application authorization is described: * приложение отсылает сообщениеapplication sends handshake "HELLOBG" message
<tt>HELLOBG version=''api_version''</tt>
* движок отсылает в ответengine sends the answer
<tt>HELLOTS version=''engine_version'' key=''request_key''</tt>
* приложение формирует ответный ключ и отсылает его движкуapplication generates response key and send it to engine
<tt>READY key=''response_key''</tt>
Если авторизация прошла нормально, то движок продолжит работу с приложением, отослав событие <tt>If the authorization was successfull then engine will continue to work with application and send an "AUTH</tt> " event (уровень авторизации пользователяuser authorization level).
Если авторизация не прошла, движок отправит приложению событие If the authorization failed then engine sends event <tt>NOTREADY</tt>. Это же событие будет отправляться в ответ на любые команды от неавторизованного приложения, кроме команд <tt>HELLOBG</tt>, <tt>READY</tt> и <tt>SHUTDOWN</tt>This event is also sent as answer to any command from an unauthorized application.
;''request_key''
: представляет собой буквенноrandom alpha-цифровую строку, сгенерированную случайным образомnumeric string
;''response_key''
: формируется из is generated from ''request_key'' и ключа продукта по следующему алгоритму, представленного в виде псевдокодаand product key with the following algorithm (described in pseudocode): <tt><nowiki>signature = hex(sha1(request_key + product_key)); // сгенерировать подпись запросаgenerate the request signaturex = product_key.split("-")[0]; // вырезаем все символы до первого знака cut all chars until first "-" из ключа продуктаfrom the product keyresponse_key = x + "-" + signature; // отправляем движку вырезанную на предыдущем этапе строку и подпись, разделенные знаком send the string from the previous step and request signature &crarr; separated by hyphen ("-") char to the engine</nowiki></tt>
== Пример Example ==Для примера предположим, что приложение использует ключ продукта In this example we suppose that the application has a product key 123456-111111-222222-333333
Подпись для Request signature for the given ''response_key'' в данном примере формируется такin this example is generated in this way:
<tt>hex(sha1("5eb1f78f123456-111111-222222-333333")) == fd2a247d83adffed56d82cca150d5fab225f1408</tt>

Navigation menu