Skip to content

GenerateChallenge

Walter Lara edited this page Apr 7, 2024 · 2 revisions

Generate Wallet Connection Challenge

Allows to request generation of a Wallet Connection Challenge.

Request

URL: /v1/wallet-connections/challenges/generate

Method: POST

Path Parameters: None

Query Parameters: None

Headers:

Content-Type: application/json

Accept: application/json

g-recaptcha-platform: Web

g-recaptcha-token: {reCAPTCHA Token for "generate_challenge" action}

Content:

Field Type Description Requirement Type
method string Challenge method to use. Valid values are: SignedData and SignedTransaction Required
stakeAddress string Stake address of the wallet to be connected. Required
changeAddress string Change address of the wallet to be connected. Only needed if method is SignedTransaction. Optional
utxoCborHexList string list List of UTxO's (CBOR/hex encoded) to create signed-transaction challenge. Only needed if method is SignedTransaction. Optional

Content example:

{
    "method": "SignedTransaction",
    "stakeAddress": "stake1uzl65wzu364hh0wxex94qsf5xkeaq2mnmc7xgnsnsjuqr4qruvxwu",
    "changeAddress": "addr1qrvnxkaylr4upwxfxctpxpcumj0fl6fdujdc72j8sgpraa9l4gu9er4t0w7udjvt2pqngddn6q4h8h3uv38p8p9cq82qav4lmp",
    "utxoCborHexList": [
        "82825820bc43a0453f0681d841798aafa11be39c49215ed9031d6dc29cb79dfeda05239a0182583",
        "828258204dd9215f2c3900f9760793148e4ca37f22d8447e45947c27321134672fd64b200185667",
        "82825820bc43a04598aafa11be39c49215ed903149a21a2efb428101825839003a5cbc099211950",
        "828258204dd921520793148e4ca37f22d84479211950e25f9877ab7abd63d056d515bd64823a5d7" 
    ]
}

✅ Success Response

Code: 200 OK

Headers:

Content-Type: application/json

Content:

Field Type Description Condition
challengeId string UUID of the generated Challenge. Always
expiresAt string Date and time when the Challenge will expire (ISO-8601 format). Always
payload string Payload to be signed. Always

Content example:

{
    "challengeId": "7bd2862f-8deb-4814-8943-156d9dab80dd",
    "expiresAt": "2024-03-17T20:47:55.738918",
    "payload": "724589a0453f0681d841798aafa11be39c49215ed9031d6dc29cb79dfeda05239a0182583"    
}

❌ Error Responses

1. Bad Request

Code: 400 BAD REQUEST

Condition: If a mandatory header or content field is missing.

Headers:

Content-Type: application/json

Content example:

{
    "code": 400,
    "description": "Bad Request",
    "cause": "Missing header: g-recaptcha-token"
}

2. Forbidden

Code: 403 FORBIDDEN

Condition: If reCAPTCHA fails.

Headers:

Content-Type: application/json

Content example:

{
    "code": 403,
    "description": "Forbidden",
    "cause": "Recaptcha failed"
}

See Also

Answer Wallet Connection Challenge

Generate Wallet Connection QR Code

Connect Wallet

Disconnect Wallet

Get Wallet Connections

Clone this wiki locally