In this tutorial, we will guide you through the process of using our API to associate a wallet address with a device fingerprint.

To associate hardware devices and unique identity across wallets, you can use our SDK to generate a unique device session token for each device. This token can be included in the registration and verification requests to link the device with a specific wallet address. Additionally, you can use our API to retrieve device fingerprints for each device, which can be used to further authenticate and track usage across wallets. By combining device session tokens and device fingerprints, you can create a robust system for tracking usage across wallets across multiple devices.

One use case for the combination of device session tokens and device fingerprints is to track real users across multiple chains and deduplicate unique real users from wallet addresses. By associating device session tokens with device fingerprints, you can ensure that users are only counted once across multiple chains, even if they use different wallet addresses on each chain. This feature can be used in conjunction with other data analytics tools to provide valuable insights into user behavior, thereby potentially helping to identify and prevent fraudulent activity.

This API is designed to work seamlessly with our SDK, which provides device session tokens that are necessary for this process.

Before we begin, please ensure that you have the following:

  • An API key to use our API
  • A device session token obtained through our SDK (contact us for access)
  • The wallet address you wish to associate with the device fingerprint

With these in hand, we can get started.

Step 1: Begin registration

To begin the wallet registration process, you will need to make a POST request to the following endpoint:

cURL
curl \
 -X POST https://api.streambird.io/v1/auth/wallets/registrations/begin \
 -H "Authorization: Bearer $API_KEY" \
 -H "Content-Type: application/json" \
 -d '{"wallet_type":"ETH","user_id":"user_24wFP9pDa9YiMJLun94iKykoZs2","public_address":"0xF7E9D631bfBd90C19691566Db4AB96697A2663C6"}'

Replace API_KEY with your actual access token.

Include the following JSON data in your request body:

Request JSON
{
    "wallet_type": "ETH",
    "user_id": "user_24wFP9pDa9YiMJLun94iKykoZs2",
    "public_address": "0xF7E9D631bfBd90C19691566Db4AB96697A2663C6"
}

Replace the wallet_type, user_id, and public_address values with the actual values you wish to use.

If successful, this request will return a response containing a registration token. Save this token for use in the next step.

Step 2: Get Device Session token

Using the Streambird Device Sense SDK, you can generate a unique device session token that can be used for subsequent API call to link it to an authentication session.

The device session token is a JWT token that can only be used once.

Device Sense Embed Example
<html>
<HEAD>
    <script src=https://js.streambird.io/dist/edge/device-sense.min.js></script>
</HEAD>
<body>
    <button id="login" onclick="login()">Click here to log in!</button>
    <script>
        function login() {
            var deviceSense = new DeviceSense({publicToken: 'pk_test_3nwVhP337ixUVHEO1CONcyi4qLF36gyR2bSjq2Z1pW7ihNJd'});
            var deviceSessionToken = deviceSense.getDeviceSessionToken();
        }
    </script>
</body>
</html>

Step 3: Complete Web3 Wallet Registration using Device Session Token

To complete the wallet registration process, send in the signature and device session token to the following endpoint:

cURL
curl \
 -X POST https://api.streambird.io/v1/auth/wallets/verify \
 -H "Authorization: Bearer $API_KEY" \
 -H "Content-Type: application/json" \
 -d '{"wallet_type":"ETH","signature":"0xb27c94381c930151c4823fd4b7f0b45d700f0c9d30a7b98821413e07eef7604319a1dbc28dda881d0fc8d18b08aceeeb0fcdb80d6caec6f6e9901800c43894c31b","public_address":"0xF7E9D631bfBd90C19691566Db4AB96697A2663C6","device_session_token":"device_session_token_jwt..."}'

It is assumed that the signature value in this step is obtained through some signing mechanism. The tutorial does not specify which tool or method to use for signing. However, it is common for users to sign messages using a wallet like MetaMask or Phantom, which are popular Ethereum and Solana wallets.


{
    "wallet_type": "ETH",
    "signature": "0xb27c94381c930151c4823fd4b7f0b45d700f0c9d30a7b98821413e07eef7604319a1dbc28dda881d0fc8d18b08aceeeb0fcdb80d6caec6f6e9901800c43894c31b",
    "public_address": "0xF7E9D631bfBd90C19691566Db4AB96697A2663C6",
    "device_session_token": "device_session_token_jwt..."
}

Replace the wallet_type, signature, public_address, and device_session_token values with the actual values you wish to use.

Note that the device_session_token value should be the token obtained through our SDK in Step 2.

If successful, this request will return a response containing the wallet ID and wallet address that have been associated with the device fingerprint.

And that’s it! You have successfully associated a wallet address with a device fingerprint using our API. We hope this tutorial was helpful. If you have any questions or feedback, please do not hesitate to reach out to our support team.