> ## Documentation Index
> Fetch the complete documentation index at: https://docs.repdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Secure Redirects: Link Hashing (SHA-256)

> How Research Desk uses a SHA-256 hashed key to securely return respondents to your platform.

## Introduction

Research Desk supports the ability to securely receive survey respondents from survey platforms and redirect them back to the supplier. An encrypted hashed key is added to the redirect link so you can confirm the values within the URL have not been altered.

## Survey Respondent Transactions

There are four distinct redirect transactions in the survey respondent experience:

1. Respondent entry to Research Desk from the supplier platform.
2. Respondent entry to the researcher survey (e.g. Decipher, Qualtrics, SurveyMonkey) from Research Desk.
3. Respondent exit with a survey disposition (complete, term, over-quota) from the researcher survey to Research Desk.
4. Respondent exit with a survey disposition from Research Desk to the supplier platform.

<img src="https://mintcdn.com/repdata/h9itcoqanyYKUFuk/images/supply-redirect-transactions.png?fit=max&auto=format&n=h9itcoqanyYKUFuk&q=85&s=5f7f02c141c4aaebb12062392fd66b08" alt="Respondent URL traffic between supplier, Research Desk, and the researcher survey" width="1356" height="492" data-path="images/supply-redirect-transactions.png" />

Steps 3 and 4 use encryption technology for enhanced security.

<Note>
  The scope of this page is limited to item 4 — respondent exit with a survey disposition from Research Desk to the supplier platform. Please contact [supply@repdata.com](mailto:supply@repdata.com) with questions and support requests.
</Note>

## Encryption

Research Desk uses a hashed key based on **SHA-256** to return post-survey respondents back to suppliers with a survey disposition code (e.g. complete, term, OQ). The hashed key is based on the entire URL redirect combined with the supplier's secret key.

Your **secret key is the same value as your Supply API key**, available through Rep Data's supplier registration process. SHA-256 hashed keys can be validated with this online tool: [https://emn178.github.io/online-tools/sha256.html](https://emn178.github.io/online-tools/sha256.html).

<Warning>
  **Keep your secret key secure.** Do not share it with any third party, and use it as your sole means of validating secure URL redirects. Rep Data reserves the right to revoke your secret key at any time.
</Warning>

### Example

The example below uses a fictitious supplier, XYZ Sample, whose fictitious secret key is `5bf1ae0d-148b-4160-ad0c-fa3ad96b90c5`.

**URL *before* encryption** — the respondent "complete" (`status=1`) link, showing the underlying URL prior to encryption. This URL, including the supplier key, is never visible to the respondent:

```text theme={null}
https://xyzsample.net/surveydone?status=1&respid=abc123&sk=5bf1ae0d-148b-4160-ad0c-fa3ad96b90c5
```

* Respondent ID (`rid`): `abc123`
* Supplier Secret Key (`sk`): `5bf1ae0d-148b-4160-ad0c-fa3ad96b90c5`

**URL *after* encryption** — the value used to send the respondent back to the supplier. This URL is fully visible to the respondent:

```text theme={null}
https://xyzsample.net/surveydone?status=1&respid=abc123&hk=817e313f1f9ab2d47a388a27d4394f7d8afa9c296364e94caf5b364f765f0326
```

* Respondent ID (`rid`): `abc123`
* SHA-256 Hashed Key (`hk`): `817e313f1f9ab2d47a388a27d4394f7d8afa9c296364e94caf5b364f765f0326`

### Converting the URL

To convert the URL *before* encryption to the URL *after* encryption:

1. Use the entire link before encryption (including `https` through the end of the supplier key value) as the input to SHA-256 encryption.
2. Replace the supplier key (`sk`) in the link with the resulting SHA-256 hashed key (`hk`).

The hashed key for the example above can be confirmed using the [SHA-256 online tool](https://emn178.github.io/online-tools/sha256.html). The screenshot below shows the input (entire URL before encryption) and output (hashed key):

<img src="https://mintcdn.com/repdata/h9itcoqanyYKUFuk/images/supply-sha256-example.png?fit=max&auto=format&n=h9itcoqanyYKUFuk&q=85&s=411ecabfab178fc27e8a41b3a4a061cf" alt="SHA-256 online tool showing the input URL and resulting hashed key" width="687" height="691" data-path="images/supply-sha256-example.png" />
