post-recoup-withdraw.rst (5263B)
1 .. http:post:: /recoup-withdraw 2 3 Demand that a batch of coins be refunded to the reserve, 4 from which the coins were originally withdrawn. 5 The coins must have been originated from the same call to withdraw, and be 6 a subset of that original batch. 7 The remaining amount on the coin will be credited to the reserve 8 that the coins were withdrawn from, in the same withdraw request. 9 10 Note that the original withdrawal fees will **not** be recouped. 11 12 .. note:: This endpoint still Work-in-Progress. It will be implemented in **vRECOUP**, sometime after **v32**. 13 14 **Request:** 15 16 The request body must be a `RecoupWithdrawRequest` object. 17 18 It provides sufficient information to 19 a) identify the originating withdraw request 20 b) proof that the coins to be recouped were part of that withdraw request 21 c) proof ownership of all coins requested to be recouped. 22 23 **Response:** 24 25 :http:statuscode:`200 OK`: 26 The request was successful, and the response is a `ReserveSummary`. 27 :http:statuscode:`403 Forbidden`: 28 A coin's signature is invalid. 29 This response comes with a standard `ErrorDetail` response. 30 :http:statuscode:`404 Not found`: 31 A denomination key is unknown, 32 the withdraw commitment is unknown 33 or a blinded coin is not known to have been withdrawn. 34 If a denomination key is unknown, the response will be 35 a `DenominationUnknownMessage`. 36 :http:statuscode:`409 Conflict`: 37 The operation is not allowed 38 as a coin has insufficient residual value, 39 or because the same public key of a coin 40 has been previously used with a different denomination. 41 Which case it is can be decided by looking at the error code 42 (usually ``TALER_EC_EXCHANGE_GENERIC_INSUFFICIENT_FUNDS``). 43 The response is a `DepositDoubleSpendError`. 44 :http:statuscode:`410 Gone`: 45 A requested denomination key is not yet or no longer valid. 46 It either before the validity start, past the expiration or was not yet revoked. 47 The response is a `DenominationGoneMessage`. 48 Clients must evaluate the error code provided 49 to understand which of the cases this is and handle it accordingly. 50 51 **Details:** 52 53 .. ts:def:: RecoupWithdrawRequest 54 55 interface RecoupWithdrawRequest { 56 // Public key of the reserve that will receive the recoup. 57 // MUST be the same as the one from the original withdraw. 58 reserve_pub: EddsaPublicKey; 59 60 // The details about the coins: 61 // An array of either 62 // a) the hash code of a blinded coin envelope (not to be recouped) 63 // b) the disclosed coin details, in order to recoup it. 64 // From these, the hash of all coin envelopes 65 // from the original withdraw can be reconstructed. 66 coin_data: RecoupCoinData[]; 67 } 68 69 .. ts:def:: RecoupCoinData 70 71 // This is either 72 // a) the hash code of a blinded coin envelope (not to be recouped) 73 // b) the disclosed coin details, in order to recoup it. 74 type RecoupCoinData = 75 | NonRecoupedCoin 76 | RecoupDisclosedCoinDetails; 77 78 .. ts:def:: NonRecoupedCoin 79 80 interface NonRecoupedCoin { 81 type: "non_recouped_coin"; 82 83 // This is the SHA512 hash code of a blinded coin envelope, 84 // including the corresponding denomination's hash. 85 // It is the output of the TALER_coin_ev_hash function 86 // from libtalerutil. 87 coin_ev: BlindedCoinEnvelopeHash; 88 }; 89 90 .. ts:def:: BlindedCoinEnvelopeHash 91 92 // The hash value of a blinded coin envelope, 93 // as it its generated by the function TALER_coin_ev_hash 94 // in libtalerutil. 95 type BlindedCoinEnvelopeHash = HashCode; 96 97 .. ts:def:: RecoupDisclosedCoinDetails 98 99 // This object provides all necessary coin data 100 // in order to call TALER_denom_blind and retrieve 101 // a blinded coin planchet, from which we can 102 // calculate the blinded coin envelope hash. 103 // It also contains the denomination's signature 104 // for the (unblinded) coin's public key, 105 // and the coin's signature to authorize the recoup request. 106 interface RecoupDisclosedCoinDetails { 107 type: "recoup_coin_details"; 108 109 // The coin's public key 110 coin_pub: CoinPublicKey; 111 112 // The blinding secret for this coin 113 // that was used during withdraw 114 coin_blinding_key_secret: DenominationBlindingKeySecret; 115 116 // The coin's commitment for age restriction, 117 // if the denomination had age restriction support. 118 age_commitment_h?: AgeCommitmentHash; 119 120 // The blinding nonce that went into this coin's 121 // blinded envelope 122 cs_session_nonce?: HashCode; 123 124 // In case of Clause-Schnorr denomination, 125 // the blinding values that were provided 126 // for this coin, by the exchange, as response 127 // to a call to /blinding-prepare. 128 cs_r_pubs?: CSRPublicPair; 129 130 // Unblinded signature of the coins' public key, 131 // signed by the denomination key. 132 denom_pub_sig: DenominationSignature; 133 134 // The denomination public key. 135 // This denomination MUST be eligible for recoup, 136 // i.e. being listed in the "recoup" section of /config. 137 denom_pub_h: HashCode; 138 139 // Signature of `TALER_RecoupRequestPS`, 140 // created by this coin's private key. 141 coin_sig: EddsaSignature; 142 }