Skip to main content

Combine Secret

Combines previously split secret pieces or Shamwari QKP shares back into the original secret or combined key pair. Either pieces (normal secret sharing) or shares (Shamwari QKP) must be provided, but not both. Requires POST.

Request

POST /nxt?requestType=combineSecret&piece=<piece1>&piece=<piece2>&...&privateShare=<share>&publicShare=<share>&...

Parameters

NameTypeRequiredDescription
piecestring[]ConditionalSecret pieces from normal secret splitting. At least one needed. May be repeated.
privateSharestring[]ConditionalPrivate Shamwari QKP shares. At least one needed. May be repeated.
publicSharestring[]ConditionalPublic Shamwari QKP shares. At least one needed. May be repeated.

Response

Normal Secret

{
"secret": "thecombinedsecret",
"pieces": ["piece1", "piece2"],
"totalPieces": 2,
"minimumPieces": 2,
"actualPrimeFieldSize": "123456789"
}

Shamwari QKP Shares

{
"combinedPrivateKey": "abc123...",
"combinedPublicKey": "def456...",
"pieces": [
{
"index": 1,
"privateShare": "share1",
"publicShare": "share2"
}
],
"totalPieces": 2,
"minimumPieces": 2
}

Error Responses

ConditionResponse
Both pieces and shares provided{"error": "either piece or privateShare/publicShare"}
Neither pieces nor shares provided{"error": "missing piece or privateShare/publicShare"}
Shares don't match account{"error": "Combined shares do not match account SHAMWARI-..."}
Combining failed{"error": "Failed to combine secret: <error>"}

Notes

  • This endpoint does not require the blockchain to be running (requireBlockchain = false).
  • Not chain-specific.
  • Requires POST method (requirePost = true).
  • Does not require admin password authentication (requirePassword = false).
  • Uses SecretSharingGenerator.combine() for normal secrets and SecretSharingGenerator.combineShamwariQKP() for QKP shares.

Source: CombineSecret.java.

Example

curl -X POST "http://localhost:22024/nxt" \
-d "requestType=combineSecret" \
-d "piece=piece1data" \
-d "piece=piece2data"