Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
353 changes: 353 additions & 0 deletions api-reference/activities/claim-spark-transfer.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,353 @@
---
title: "Claim Spark transfer"
description: "Construct receiver-side encrypted operator packages to claim a Spark transfer. Does not perform FROST signing."
---

import { Authorizations } from "/snippets/api/authorizations.mdx";
import { H3Bordered } from "/snippets/h3-bordered.mdx";
import { NestedParam } from "/snippets/nested-param.mdx";
import { EndpointPath } from "/snippets/api/endpoint.mdx";

<EndpointPath type="submit" path="spark_claim_transfer" />

<Authorizations />

<H3Bordered text="Body" />

<ParamField body="type" type="enum<string>" required={true}>

Enum options: `ACTIVITY_TYPE_SPARK_CLAIM_TRANSFER`
</ParamField>

<ParamField body="timestampMs" type="string" required={true}>

Timestamp (in milliseconds) of the request, used to verify liveness of user requests.
</ParamField>

<ParamField body="organizationId" type="string" required={true}>

Unique identifier for a given Organization.
</ParamField>

<ParamField body="parameters" type="object" required={true} path="parameters">
<p>The parameters object containing the specific intent data for this activity.</p>
<Expandable title="details">
<NestedParam parentKey="parameters" childKey="signWith" type="string" required={true} default="">
A Spark wallet account address identifying the wallet.
</NestedParam>

<ParamField body="claim" type="object" required={true} path="parameters.claim">
<p>claim field</p>
<Expandable title="details">
<ParamField body="leaves" type="array" required={true} path="parameters.claim.leaves">
<p>Leaves being claimed.</p>
<Expandable title="item details">
<NestedParam parentKey="parameters.claim.leaves" childKey="leafId" type="string" required={true} default="">
Leaf identifier (UUID).
</NestedParam>

<NestedParam parentKey="parameters.claim.leaves" childKey="ciphertext" type="string" required={true} default="">
ECIES ciphertext (hex-encoded) containing the inbound transfer secret. Decrypted inside the enclave using the wallet's Identity key.
</NestedParam>

<NestedParam parentKey="parameters.claim.leaves" childKey="senderSignature" type="string" required={true} default="">
Hex-encoded 64-byte compact ECDSA signature binding (leaf_id, transfer_id, ciphertext) to the sender's identity key. Verified inside the enclave before decryption.
</NestedParam>
</Expandable>
</ParamField>
<NestedParam parentKey="parameters.claim" childKey="threshold" type="number" required={true} default="">
Shamir threshold for reconstructing the per-leaf claim secret.
</NestedParam>

<ParamField body="operatorRecipients" type="array" required={true} path="parameters.claim.operatorRecipients">
<p>Operators that will receive Shamir shares.</p>
<Expandable title="item details">
<NestedParam parentKey="parameters.claim.operatorRecipients" childKey="operatorId" type="string" required={true} default="">
Spark operator identifier (UUID).
</NestedParam>

<NestedParam parentKey="parameters.claim.operatorRecipients" childKey="encryptionPublicKey" type="string" required={true} default="">
Operator's ECIES encryption pubkey (hex-encoded compressed secp256k1 point).
</NestedParam>
</Expandable>
</ParamField>
<NestedParam parentKey="parameters.claim" childKey="transferId" type="string" required={true} default="">
Spark transfer identifier (UUID). Used together with each leaf's sender_signature to verify the sender bound this ciphertext to this transfer.
</NestedParam>

<NestedParam parentKey="parameters.claim" childKey="senderIdentityPublicKey" type="string" required={true} default="">
Sender's compressed secp256k1 identity public key (hex-encoded, 33 bytes). Used to verify the per-leaf sender_signature fields.
</NestedParam>
</Expandable>
</ParamField>
</Expandable>
</ParamField>

<H3Bordered text="Response" />
A successful response returns the following fields:

<ResponseField name="activity" type="object" required={true}>
The activity object containing type, intent, and result
<Expandable title="activity details">
<NestedParam parentKey="activity" childKey="id" type="string" required={true}>
Unique identifier for a given Activity object.
</NestedParam>
<NestedParam parentKey="activity" childKey="organizationId" type="string" required={true}>
Unique identifier for a given Organization.
</NestedParam>
<NestedParam parentKey="activity" childKey="status" type="string" required={true}>
The activity status
</NestedParam>
<NestedParam parentKey="activity" childKey="type" type="string" required={true}>
The activity type
</NestedParam>
<NestedParam parentKey="activity" childKey="intent" type="object" required={true}>
The intent of the activity
<Expandable title="intent details">
<NestedParam parentKey="activity.intent" childKey="sparkClaimTransferIntent" type="object" required={true}>
The sparkClaimTransferIntent object
<Expandable title="sparkClaimTransferIntent details">
<NestedParam parentKey="activity.intent.sparkClaimTransferIntent" childKey="signWith" type="string" required={true}>
A Spark wallet account address identifying the wallet.
</NestedParam>
<NestedParam parentKey="activity.intent.sparkClaimTransferIntent" childKey="claim" type="object" required={true}>
claim field
<Expandable title="claim details">
<NestedParam parentKey="activity.intent.sparkClaimTransferIntent.claim" childKey="leaves" type="array" required={true}>
Leaves being claimed.
<Expandable title="leaves details">
<NestedParam parentKey="activity.intent.sparkClaimTransferIntent.claim.leaves" childKey="leafId" type="string" required={true}>
Leaf identifier (UUID).
</NestedParam>
<NestedParam parentKey="activity.intent.sparkClaimTransferIntent.claim.leaves" childKey="ciphertext" type="string" required={true}>
ECIES ciphertext (hex-encoded) containing the inbound transfer secret. Decrypted inside the enclave using the wallet's Identity key.
</NestedParam>
<NestedParam parentKey="activity.intent.sparkClaimTransferIntent.claim.leaves" childKey="senderSignature" type="string" required={true}>
Hex-encoded 64-byte compact ECDSA signature binding (leaf_id, transfer_id, ciphertext) to the sender's identity key. Verified inside the enclave before decryption.
</NestedParam>

</Expandable>
</NestedParam>
<NestedParam parentKey="activity.intent.sparkClaimTransferIntent.claim" childKey="threshold" type="number" required={true}>
Shamir threshold for reconstructing the per-leaf claim secret.
</NestedParam>
<NestedParam parentKey="activity.intent.sparkClaimTransferIntent.claim" childKey="operatorRecipients" type="array" required={true}>
Operators that will receive Shamir shares.
<Expandable title="operatorRecipients details">
<NestedParam parentKey="activity.intent.sparkClaimTransferIntent.claim.operatorRecipients" childKey="operatorId" type="string" required={true}>
Spark operator identifier (UUID).
</NestedParam>
<NestedParam parentKey="activity.intent.sparkClaimTransferIntent.claim.operatorRecipients" childKey="encryptionPublicKey" type="string" required={true}>
Operator's ECIES encryption pubkey (hex-encoded compressed secp256k1 point).
</NestedParam>

</Expandable>
</NestedParam>
<NestedParam parentKey="activity.intent.sparkClaimTransferIntent.claim" childKey="transferId" type="string" required={true}>
Spark transfer identifier (UUID). Used together with each leaf's sender_signature to verify the sender bound this ciphertext to this transfer.
</NestedParam>
<NestedParam parentKey="activity.intent.sparkClaimTransferIntent.claim" childKey="senderIdentityPublicKey" type="string" required={true}>
Sender's compressed secp256k1 identity public key (hex-encoded, 33 bytes). Used to verify the per-leaf sender_signature fields.
</NestedParam>

</Expandable>
</NestedParam>

</Expandable>
</NestedParam>

</Expandable>
</NestedParam>
<NestedParam parentKey="activity" childKey="result" type="object" required={true}>
The result of the activity
<Expandable title="result details">
<NestedParam parentKey="activity.result" childKey="sparkClaimTransferResult" type="object" required={true}>
The sparkClaimTransferResult object
<Expandable title="sparkClaimTransferResult details">
<NestedParam parentKey="activity.result.sparkClaimTransferResult" childKey="operatorPackages" type="array" required={true}>
Per-operator ECIES-encrypted packages.
<Expandable title="operatorPackages details">
<NestedParam parentKey="activity.result.sparkClaimTransferResult.operatorPackages" childKey="operatorId" type="string" required={true}>
Spark operator identifier (UUID).
</NestedParam>
<NestedParam parentKey="activity.result.sparkClaimTransferResult.operatorPackages" childKey="encryptedPackage" type="string" required={true}>
ECIES ciphertext (hex-encoded) opaque to Turnkey after emission.
</NestedParam>

</Expandable>
</NestedParam>
<NestedParam parentKey="activity.result.sparkClaimTransferResult" childKey="newLeafPublicKeys" type="array" required={true}>
Newly-derived SigningLeaf public keys, one per leaf, in input order.
<Expandable title="newLeafPublicKeys details">
<NestedParam parentKey="activity.result.sparkClaimTransferResult.newLeafPublicKeys" childKey="leafId" type="string" required={true}>
The Spark leaf_id this public key was derived for.
</NestedParam>
<NestedParam parentKey="activity.result.sparkClaimTransferResult.newLeafPublicKeys" childKey="publicKey" type="string" required={true}>
Hex-encoded compressed secp256k1 point (33 bytes) for the SigningLeaf derivation at leaf_id.
</NestedParam>

</Expandable>
</NestedParam>

</Expandable>
</NestedParam>

</Expandable>
</NestedParam>
<NestedParam parentKey="activity" childKey="votes" type="array" required={true}>
A list of objects representing a particular User's approval or rejection of a Consensus request, including all relevant metadata.
</NestedParam>
<NestedParam parentKey="activity" childKey="fingerprint" type="string" required={true}>
An artifact verifying a User's action.
</NestedParam>
<NestedParam parentKey="activity" childKey="canApprove" type="boolean" required={true}>
Whether the activity can be approved.
</NestedParam>
<NestedParam parentKey="activity" childKey="canReject" type="boolean" required={true}>
Whether the activity can be rejected.
</NestedParam>
<NestedParam parentKey="activity" childKey="createdAt" type="string" required={true}>
The creation timestamp.
</NestedParam>
<NestedParam parentKey="activity" childKey="updatedAt" type="string" required={true}>
The last update timestamp.
</NestedParam>

</Expandable>
</ResponseField>

<RequestExample>

```bash title="cURL"
curl --request POST \
--url https://api.turnkey.com/public/v1/submit/spark_claim_transfer \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header "X-Stamp: <string> (see Authorizations)" \
--data '{
"type": "ACTIVITY_TYPE_SPARK_CLAIM_TRANSFER",
"timestampMs": "<string> (e.g. 1746736509954)",
"organizationId": "<string> (Your Organization ID)",
"parameters": {
"signWith": "<string>",
"claim": {
"leaves": [
{
"leafId": "<string>",
"ciphertext": "<string>",
"senderSignature": "<string>"
}
],
"threshold": "<number>",
"operatorRecipients": [
{
"operatorId": "<string>",
"encryptionPublicKey": "<string>"
}
],
"transferId": "<string>",
"senderIdentityPublicKey": "<string>"
}
}
}'
```

```javascript title="JavaScript"
import { Turnkey } from "@turnkey/sdk-server";

const turnkeyClient = new Turnkey({
apiBaseUrl: "https://api.turnkey.com",
apiPublicKey: process.env.API_PUBLIC_KEY!,
apiPrivateKey: process.env.API_PRIVATE_KEY!,
defaultOrganizationId: process.env.ORGANIZATION_ID!,
});

const response = await turnkeyClient.apiClient().sparkClaimTransfer({
signWith: "<string> (A Spark wallet account address identifying the wallet.)",
claim: { // claim field,
leaves: [{ // Leaves being claimed.,
leafId: "<string> (Leaf identifier (UUID).)",
ciphertext: "<string> (ECIES ciphertext (hex-encoded) containing the inbound transfer secret. Decrypted inside the enclave using the wallet's Identity key.)",
senderSignature: "<string> (Hex-encoded 64-byte compact ECDSA signature binding (leaf_id, transfer_id, ciphertext) to the sender's identity key. Verified inside the enclave before decryption.)",
}],
threshold: 0 // Shamir threshold for reconstructing the per-leaf claim secret.,
operatorRecipients: [{ // Operators that will receive Shamir shares.,
operatorId: "<string> (Spark operator identifier (UUID).)",
encryptionPublicKey: "<string> (Operator's ECIES encryption pubkey (hex-encoded compressed secp256k1 point).)",
}],
transferId: "<string> (Spark transfer identifier (UUID). Used together with each leaf's sender_signature to verify the sender bound this ciphertext to this transfer.)",
senderIdentityPublicKey: "<string> (Sender's compressed secp256k1 identity public key (hex-encoded, 33 bytes). Used to verify the per-leaf sender_signature fields.)",
}
});
```

</RequestExample>

<ResponseExample>

```json 200
{
"activity": {
"id": "<activity-id>",
"status": "ACTIVITY_STATUS_COMPLETED",
"type": "ACTIVITY_TYPE_SPARK_CLAIM_TRANSFER",
"organizationId": "<organization-id>",
"timestampMs": "<timestamp> (e.g. 1746736509954)",
"result": {
"activity": {
"id": "<string>",
"organizationId": "<string>",
"status": "<string>",
"type": "<string>",
"intent": {
"sparkClaimTransferIntent": {
"signWith": "<string>",
"claim": {
"leaves": [
{
"leafId": "<string>",
"ciphertext": "<string>",
"senderSignature": "<string>"
}
],
"threshold": "<number>",
"operatorRecipients": [
{
"operatorId": "<string>",
"encryptionPublicKey": "<string>"
}
],
"transferId": "<string>",
"senderIdentityPublicKey": "<string>"
}
}
},
"result": {
"sparkClaimTransferResult": {
"operatorPackages": [
{
"operatorId": "<string>",
"encryptedPackage": "<string>"
}
],
"newLeafPublicKeys": [
{
"leafId": "<string>",
"publicKey": "<string>"
}
]
}
},
"votes": "<array>",
"fingerprint": "<string>",
"canApprove": "<boolean>",
"canReject": "<boolean>",
"createdAt": "<string>",
"updatedAt": "<string>"
}
}
}
}
```

</ResponseExample>
6 changes: 3 additions & 3 deletions api-reference/activities/create-tvc-manifest-approvals.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { EndpointPath } from "/snippets/api/endpoint.mdx";

<ParamField body="type" type="enum<string>" required={true}>

Enum options: `ACTIVITY_TYPE_APPROVE_TVC_DEPLOYMENT`
Enum options: `ACTIVITY_TYPE_CREATE_TVC_MANIFEST_APPROVALS`
</ParamField>

<ParamField body="timestampMs" type="string" required={true}>
Expand Down Expand Up @@ -148,7 +148,7 @@ curl --request POST \
--header 'Content-Type: application/json' \
--header "X-Stamp: <string> (see Authorizations)" \
--data '{
"type": "ACTIVITY_TYPE_APPROVE_TVC_DEPLOYMENT",
"type": "ACTIVITY_TYPE_CREATE_TVC_MANIFEST_APPROVALS",
"timestampMs": "<string> (e.g. 1746736509954)",
"organizationId": "<string> (Your Organization ID)",
"parameters": {
Expand Down Expand Up @@ -191,7 +191,7 @@ const response = await turnkeyClient.apiClient().createTvcManifestApprovals({
"activity": {
"id": "<activity-id>",
"status": "ACTIVITY_STATUS_COMPLETED",
"type": "ACTIVITY_TYPE_APPROVE_TVC_DEPLOYMENT",
"type": "ACTIVITY_TYPE_CREATE_TVC_MANIFEST_APPROVALS",
"organizationId": "<organization-id>",
"timestampMs": "<timestamp> (e.g. 1746736509954)",
"result": {
Expand Down
Loading