commit c194139031c347336839142b5d326a64560d621b
parent 03b54e9690f0fe291ca26145ebf38c89b59fd813
Author: Sebastian <sebasjm@gmail.com>
Date: Fri, 28 Jun 2024 14:35:12 -0300
new discriminator type in v2
Diffstat:
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/core/api-challenger.rst b/core/api-challenger.rst
@@ -240,6 +240,9 @@ Login
// on the ``ADDRESS_TYPE``, should be used to pre-populate the form
last_address?: Object;
+ // is the challenge already solved?
+ solved: boolean;
+
// number of times the address can still be changed, may or may not be
// shown to the user
changes_left: Integer;
@@ -312,6 +315,8 @@ Challenge
transmissions for this $NONCE. The user-agent should
wait and (eventually) request a fresh nonce to be set
up by the client.
+ If the request ask for application/json the response will include error
+ code, hint and detail. Since protocol **v2**.
:http:statuscode:`500 Internal Server Error`:
Server is not able to respond due to internal problems.
If the request ask for application/json the response will include error
@@ -320,12 +325,16 @@ Challenge
.. ts:def:: ChallengeResponse
+ // Union discriminated by the "type" field.
type ChallengeResponse = ChallengeRedirect | ChallengeCreateResponse
.. ts:def:: ChallengeRedirect
// @since v2
interface ChallengeRedirect {
+ // Union discriminator field.
+ type: "completed";
+
// challenge is completed, use should redirect here
redirect_url: string;
}
@@ -333,6 +342,8 @@ Challenge
.. ts:def:: ChallengeCreateResponse
interface ChallengeCreateResponse {
+ // Union discriminator field.
+ type: "created"
// how many more attempts are allowed, might be shown to the user,
// highlighting might be appropriate for low values such as 1 or 2 (the
@@ -403,6 +414,8 @@ Solve
for this address (and $NONCE). The user-agent should
either try a different address (or wait and (eventually)
request a fresh nonce to be set up by the client).
+ If the request ask for application/json the response will include error
+ code, hint and detail. Since protocol **v2**.
:http:statuscode:`500 Internal Server Error`:
Server is not able to respond due to internal problems.
If the request ask for application/json the response will include error
@@ -411,11 +424,15 @@ Solve
.. ts:def:: ChallengeSolveResponse
+ // Union discriminated by the "type" field.
type ChallengeSolveResponse = ChallengeRedirect | InvalidPinResponse;
.. ts:def:: InvalidPinResponse
interface InvalidPinResponse {
+ // Union discriminator field.
+ type: "pending";
+
// numeric Taler error code, should be shown to indicate the error
// compactly for reporting to developers
ec: Integer;