zklogin.import
Import the salts your users already have, so their addresses stay the same.
Details
- Endpoint
- POST /v1/zklogin/import
- Credits
- Free
- Rate class
- Light. Counts against your light requests per second.
For apps moving existing zkLogin users to tide. Send up to 1,000 users per call for one client id, each as { subHash, salt } (subHash = hex SHA-256 of the user's sub) or { sub, salt }, or one user as { jwt, salt }. Imported salts are encrypted at rest and win over tide's own salt from then on. The client id must be registered to your key with a sign-in token (verified). A user who already has a different salt here, or who already got tide's own salt, is skipped unless replace is true, because their address would change. Free.
Parameters
| Name | Type | Description |
|---|---|---|
| clientId | string | The OAuth client id (aud) these users signed in with. Not needed with jwt. |
| users | array of object | Users to import.Up to 1000 items. |
| users[].sub | string | |
| users[].subHash | string | |
| users[].salt | string | |
| jwt | string | One user's ID token, instead of clientId and users. |
| salt | string | That user's salt (with jwt). |
| replace | boolean | Overwrite an existing salt (changes that user's address). Default false. |
Request
Send your key in the x-api-key header, or leave it out to use the keyless tier.
curl -X POST "https://api.tide.ad/v1/zklogin/import" \
-H "x-api-key: YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"clientId": "1234567890-abc.apps.googleusercontent.com",
"users": [
{
"subHash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"salt": "129390038577185583942388216820280642146"
}
]
}'const res = await fetch("https://api.tide.ad/v1/zklogin/import", {
method: "POST",
headers: {
"x-api-key": process.env.TIDE_API_KEY!,
"content-type": "application/json",
},
body: JSON.stringify({
"clientId": "1234567890-abc.apps.googleusercontent.com",
"users": [
{
"subHash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"salt": "129390038577185583942388216820280642146"
}
]
}),
});
const data = await res.json();Response
{
"imported": 1,
"unchanged": 0,
"replaced": 0,
"skipped": [],
"total": 1
}