> For the complete documentation index, see [llms.txt](https://docs.1q.gg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.1q.gg/documentation/exemplos-de-integracao.md).

# Exemplos de integração

Os exemplos da documentação usam Node.js e PHP e devem ser executados somente no backend do cassino, com segredos armazenados como variáveis de ambiente. O tutorial principal contém o algoritmo HMAC completo.

{% tabs %}
{% tab title="Node.js" %}

```javascript
import {createHmac,createHash,randomUUID} from 'node:crypto';
const body=''; const timestamp=String(Math.floor(Date.now()/1000)); const nonce=randomUUID();
const path='/api/v1/games';
const canonical=['GET',path,timestamp,nonce,createHash('sha256').update(body).digest('hex')].join('\n');
const signature=createHmac('sha256',process.env.ONEQ_SECRET).update(canonical).digest('hex');
console.log({timestamp,nonce,signature}); // Não registre assinatura em logs reais
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$timestamp=(string)time(); $nonce=bin2hex(random_bytes(16));
$canonical=implode("\n",['GET','/api/v1/games',$timestamp,$nonce,hash('sha256','')]);
$signature=hash_hmac('sha256',$canonical,getenv('ONEQ_SECRET'));
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
Em produção, não imprima nem registre assinaturas, chaves ou segredos. Sempre assine os bytes efetivamente enviados.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.1q.gg/documentation/exemplos-de-integracao.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
