Difference between revisions of "Product key"

From Ace Stream Wiki
Jump to: navigation, search
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
Начиная с версии 2.1.0 движок работает по API только с авторизованными приложениями. Авторизация выполняется на этапе рукопожатия (более подробное описание смотрите ниже). Для успешной авторизации у приложения должен быть ключ продукта.
+
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.
  
Вы можете получить персональный ключ продукта для Вашего приложения, либо использовать публичный ключ:
+
You can get your personal product key for your application or use a public key:
 
  <tt>kjYX790gTytRaXV04IvC-xZH3A18sj5b1Tf3I-J5XVS1xsj-j0797KwxxLpBl26HPvWMm</tt>
 
  <tt>kjYX790gTytRaXV04IvC-xZH3A18sj5b1Tf3I-J5XVS1xsj-j0797KwxxLpBl26HPvWMm</tt>
  
Если Вы используете публичный ключ, то Ваше приложение смогут использовать только пользователи, у которая активирована опция "No ADs" (отключение рекламы Ace Stream). Если у пользователя не активирована указанная опция, то при попытке начать просмотр какого-либо контента движок отправит ошибку "No ADs option must be activated to use this product"
+
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.
  
'''Внимание!''' После того как ваше приложение будет готово и Вы решите провести открытый/публичный тест, отправьте нам запрос на получение тестового ключа заполнив форму [http://www.acestream.net/developers/request_key.php здесь], с описанием приложения и ссылкой на его скачивание. После проверки вашего продукта, мы предоставим вам специальный ключ продукта, который позволит вам в течении 30 дней провести открытые/публичные тесты для любых пользователей, в.ч. и для пользователей у которых нет подключенной опции NoADs. Тест для Всех!
+
'''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!
  
Если Ваше приложение поддерживает рекламные форматы системы Ace Stream, Вы можете бесплатно получить персональный ключ продукта, заполнив форму [http://www.acestream.net/developers/request_key.php здесь]. Приложения с персональным ключом продукта могут использовать все пользователи, независимо от наличия у них каких-либо премиум-опций.
+
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>
 
  <tt>HELLOBG version=''api_version''</tt>
* движок отсылает в ответ
+
* engine sends the answer
 
  <tt>HELLOTS version=''engine_version'' key=''request_key''</tt>
 
  <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>READY key=''response_key''</tt>
  
Если авторизация прошла нормально, то движок продолжит работу с приложением, отослав событие <tt>AUTH</tt> (уровень авторизации пользователя).
+
If the authorization was successfull then engine will continue to work with application and send an "AUTH" event (user authorization level).
  
Если авторизация не прошла, движок отправит приложению событие <tt>NOTREADY</tt>. Это же событие будет отправляться в ответ на любые команды от неавторизованного приложения, кроме команд <tt>HELLOBG</tt>, <tt>READY</tt> и <tt>SHUTDOWN</tt>.
+
If the authorization failed then engine sends event <tt>NOTREADY</tt>. This event is also sent as answer to any command from an unauthorized application.
  
 
;''request_key''
 
;''request_key''
: представляет собой буквенно-цифровую строку, сгенерированную случайным образом
+
: random alpha-numeric string
  
 
;''response_key''
 
;''response_key''
: формируется из ''request_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)); // сгенерировать подпись запроса
+
  <tt><nowiki>signature = hex(sha1(request_key + product_key)); // generate the request signature
x = product_key.split("-")[0];                    // вырезаем все символы до первого знака "-" из ключа продукта
+
x = product_key.split("-")[0];                    // cut all chars until first "-" from the product key
response_key = x + "-" + signature;              // отправляем движку вырезанную на предыдущем этапе строку и подпись, разделенные знаком "-"</nowiki></tt>
+
response_key = x + "-" + signature;              // send the string from the previous step and request signature &crarr;
 +
                                                    separated by hyphen ("-") char to the engine</nowiki></tt>
  
== Пример ==
+
== Example ==
Для примера предположим, что приложение использует ключ продукта 123456-111111-222222-333333
+
In this example we suppose that the application has a product key 123456-111111-222222-333333
  
Подпись для ''response_key'' в данном примере формируется так:
+
Request signature for the given ''response_key'' in this example is generated in this way:
 
<tt>hex(sha1("5eb1f78f123456-111111-222222-333333")) == fd2a247d83adffed56d82cca150d5fab225f1408</tt>
 
<tt>hex(sha1("5eb1f78f123456-111111-222222-333333")) == fd2a247d83adffed56d82cca150d5fab225f1408</tt>
  

Latest revision as of 12:54, 6 September 2017

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.

You can get your personal product key for your application or use a public key:

kjYX790gTytRaXV04IvC-xZH3A18sj5b1Tf3I-J5XVS1xsj-j0797KwxxLpBl26HPvWMm

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 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 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
HELLOBG version=api_version
  • engine sends the answer
HELLOTS version=engine_version key=request_key
  • application generates response key and send it to engine
READY key=response_key

If the authorization was successfull then engine will continue to work with application and send an "AUTH" event (user authorization level).

If the authorization failed then engine sends event NOTREADY. 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):
signature = hex(sha1(request_key + product_key)); // generate the request signature
x = product_key.split("-")[0];                    // cut all chars until first "-" from the product key
response_key = x + "-" + signature;               // send the string from the previous step and request signature ↵
                                                     separated by hyphen ("-") char to the engine

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: hex(sha1("5eb1f78f123456-111111-222222-333333")) == fd2a247d83adffed56d82cca150d5fab225f1408


>>HELLOBG version=4
<<HELLOTS version=2.1.0 key=5eb1f78f
>>READY key=123456-fd2a247d83adffed56d82cca150d5fab225f1408
<<AUTH 1