Skip to main content

Data Compliance

XQ's platform enables developers to establish data access and loss prevention policies for encryption keys stored within the system. This capability allows developers to create platforms that help users meet compliance requirements, such as GDPR, by restricting access to encryption keys based on geolocation.

Policy Creation​

Developers can empower users to control where encryption keys can be accessed by configuring settings in the Policies section of the XQ Management Portal. For example, a simple Data Access policy might involve restricting access to keys of type "msg" to a specific region. Users can easily implement this by following these steps:

  1. Open the XQ Dashboard.
  2. Log in using one of the available methods: Magic Link, Google, or Microsoft authentication.
  3. Navigate to Policy Manager via the navigation bar on the left.
  4. Click the "ADD NEW" button at the top, next to "Policies".
  5. Provide a name for your policy, set the type to "Data Access", and assign the applicable groups.
  6. Define the conditions of the policy, such as:
    • Data: Email
    • Operator: Not From
    • Data Type: Countries
    • Value: United States
  7. Configure the action for the policy, for example:
    • Then: Block
    • Action: Notify User
    • Message: "Message is only accessible from the United States of America."

Encryption Key Labeling​

Platform users can also establish Data Access policies for labeled keys, which developers can manage using the /packet/add method. Labels are specified through the meta object and can be set using a format like "labels": ["Label1","Label2"].

To integrate this functionality into your application you will have to integrate XQ authentication seamlessly into your application's client-side authentication flow, enabling users to securely store encryption keys for their confidential data directly with XQ.

Step 1: Begin the login process.​

During the user login process, when a user authenticates with their email and password on your platform, you can invoke XQ's Authorize endpoint to initiate secure key management.

Parameters — /authorize

NameTypeRequiredDescription
api-keystringYesGeneral API key
userstringYesThe email address or phone number of the account to validate. The confirmation link or code will be sent to this address or number

POST
Headers
curl
curl -X POST 'https://subscription.xqmsg.net/v2/authorize' \
-H 'Content-Type: application/json' \
-H 'api-key: <API_KEY>' \
-d '{
"user": "test@example.com"
}'

Sent from your browser straight to subscription.xqmsg.net. Credentials stay in this tab and are cleared on reload; missing ones appear as <API_KEY> / <ACCESS_TOKEN> in the curl command.

Step 2: Prompt the user to enter the PIN.​

Your platform can prompt the user to enter the 2FA PIN sent to their registered email address. Once they have received their 2FA PIN they will input the value into your platform and you will call the codevalidation endpoint.

Parameters — /codevalidation

NameTypeRequiredDescription
tokenstringYesThe Pre-Auth token that is returned after an initial request for authorization.
pinintegerYesThe pin that was sent to the users email or phone number.

GET
Headers
Bearer
curl
curl -X GET 'https://subscription.xqmsg.net/v2/codevalidation?pin=123456' \
-H 'Authorization: Bearer <ACCESS_TOKEN>'

Sent from your browser straight to subscription.xqmsg.net. Credentials stay in this tab and are cleared on reload; missing ones appear as <API_KEY> / <ACCESS_TOKEN> in the curl command.

Step 3: Automatic Pre-Auth token exchange.​

If the users 2FA pin is valid, you can automatically exchange the pre-auth token on the client side application for the XQ Access Token.

Parameters — /exchange

NameTypeRequiredDescription
api-keystringYesGeneral API key
AuthorizationstringThis is a bearer token required to make most XQ API calls. To get one, a user must first utilize the authorize endpoint, upon which they get a pre-auth token. After they confirm their account utilizing the code-validation endpoint, they can then exchange the pre-auth token in return for an access token to a specific team.
bintegerThis is the specific Team ID you are using to exchange your pre-auth token for authorization. If no Team ID is specified, you will automatically be authorized into the Team ID with the lowest index that you have access to.

GET
Headers
Bearer
curl
curl -X GET 'https://subscription.xqmsg.net/v2/exchange?b=123' \
-H 'api-key: <API_KEY>' \
-H 'Authorization: Bearer <ACCESS_TOKEN>'

Sent from your browser straight to subscription.xqmsg.net. Credentials stay in this tab and are cleared on reload; missing ones appear as <API_KEY> / <ACCESS_TOKEN> in the curl command.

Step 4: Integrate client-side encryption​

Leverage XQ's Quantum Entropy in combination with client-side encryption libraries to robustly encrypt sensitive user data. This approach ensures that all data entered into your platform is securely encrypted, with encryption keys stored separately by XQ. Access to these keys can be restricted exclusively to the client, providing enhanced security and user control over their confidential information.

You can utilize XQ's Quantum Entropy generator to ensure strong encryption keys are generated.

Parameters — /

NameTypeRequiredDescription
ksstringYesThe number of entropy bits to fetch. Value will be returned as a base64-encoded hex string.

GET
curl
curl -X GET 'https://quantum.xqmsg.net/v2?ks=256'

Sent from your browser straight to quantum.xqmsg.net. Credentials stay in this tab and are cleared on reload.

The response is a base64-encoded hex string.

While the hex string returned in the response can be used as entropy, to retrieve the actual bits, the string should be decoded from base-64 and each hex character in the sequence converted to its 4-bit binary representation.

import CryptoJS from 'crypto-js';

// Example values
const data = "Highly Sensitive Data";
const key = "ff308a2a9e1671244dfe2e35ae0c8d1c9ddeec6b51128457ca29229a932d5574";

// Encrypt the message
const encrypted = CryptoJS.AES.encrypt(message, key).toString();

Step 5: Store the encrypted key packet in XQ's Keystore with a designated label.​

Platform users can also establish Data Access policies for labeled keys, which developers can manage using the /packet/add method. Labels are specified through the meta object and can be set using a format like "labels": ["Label1","Label2"].

Parameters — /packet/add

NameTypeRequiredDescription
api-keystringYesGeneral API key
authorizationstringYesauthToken returned in /exchange response. Prefix the auth token with "Bearer"
recipientsstringYesComma-delimited list of email addresses or phone numbers who are allowed to access the key.
expiresstringYesNumber of hours that this key will remain valid for. After this time, it will no longer be accessible.
keystringYesThe secret key that the user wants to protect.
typestringA value indicating the type of data that is being encrypted. Values are 1 = “file”, 2 = “msg”, 3 = “chat”, 4 = “form”, 5 = “data”
metaobjectAny additional meta information about the key.

POST
Headers
Bearer
curl
curl -X POST 'https://subscription.xqmsg.net/v2/packet/add' \
-H 'Content-Type: application/json' \
-H 'api-key: <API_KEY>' \
-H 'authorization: Bearer <ACCESS_TOKEN>' \
-d '{
"recipients": "test2@example.com",
"expires": "1",
"key": "xyz123",
"type": "msg",
"meta": {
"subject": "demo",
"title": "demo",
"labels": [
"Label1",
"Label2"
]
}
}'

Sent from your browser straight to subscription.xqmsg.net. Credentials stay in this tab and are cleared on reload; missing ones appear as <API_KEY> / <ACCESS_TOKEN> in the curl command.