The API specified here follows the general conventions for all details not specified in the individual requests. The glossary defines all specific terms used in this section.
These APIs allow clients to obtain the terms of service and the privacy policy of a service.
GET
/terms
¶Get the terms of service of the service. The endpoint will consider the “Accept” and “Accept-Language” and “Accept-Encoding” headers when generating a response. Specifically, it will try to find a response with an acceptable mime-type, then pick the version in the most preferred language of the user, and finally apply compression if that is allowed by the client and deemed beneficial.
The endpoint will set an “Etag”, and subsequent requests of the same client should provide the tag in an “If-None-Match” header to detect if the terms of service have changed. If not, a “304 Not Modified” response will be returned. Note that the “304 Not Modified” will also be returned if the client changed the “Accept-Language” or “Accept-Encoding” header. Thus, if the client would like to download the resource in a different language or format, the “If-None-Match” header must be omitted.
If the “Etag” is missing, the client should not cache the response and instead prompt the user again at the next opportunity. This is usually only the case if the terms of service were not configured correctly.
When returning a full response (not a “304 Not Modified”), the server should also include a “Avail-Languages” header which includes a comma-separated list of the languages in which the terms of service are available in (see availability hints specification). Clients can use this to generate a language switcher for users that may not have expressed a proper language preference.
GET
/privacy
¶Get the privacy policy of the service. Behaves the same way as The “/terms” endpoint, except that it returns the privacy policy instead of the terms of service.
This API is used by wallets and merchants to obtain global information about the exchange, such as online signing keys, available denominations and the fee structure. This is typically the first call any exchange client makes, as it returns information required to process all of the other interactions with the exchange. The returned information is secured by (1) signature(s) from the exchange, especially the long-term offline signing key of the exchange, which clients should cache; (2) signature(s) from auditors, and the auditor keys should be hard-coded into the wallet as they are the trust anchors for Taler; (3) possibly by using HTTPS.
GET
/seed
¶Return an entropy seed. The exchange will return a high-entropy value that will differ for every call. The response is NOT in JSON, but simply high-entropy binary data in the HTTP body. This API should be used by wallets to guard themselves against running on low-entropy (bad PRNG) hardware. Naturally, the entropy returned MUST be mixed with locally generated entropy.
GET
/config
¶Return the protocol version and currency supported by this exchange backend, as well as the list of possible KYC requirements. This endpoint is largely for the SPA for AML officers. Merchants should use /keys
which also contains the protocol version and currency.
Response:
interface ExchangeVersionResponse {
// libtool-style representation of the Exchange protocol version, see
// https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning
// The format is "current:revision:age".
version: string;
// Name of the protocol.
name: "taler-exchange";
// Currency supported by this exchange.
currency: string;
// Names of supported KYC requirements.
supported_kyc_requirements: string[];
}
GET
/keys
¶Get a list of all denomination keys offered by the exchange, as well as the exchange’s current online signing key.
Request:
stamp_start
members of the denomination keys of a /keys
response that is already known to the client. Allows the exchange to only return keys that have changed since that timestamp. The given value must be an unsigned 64-bit integer representing seconds after 1970. If the timestamp does not exactly match the stamp_start
of one of the denomination keys, all keys are returned.Response:
taler-exchange-offline
.Details:
interface ExchangeKeysResponse {
// libtool-style representation of the Exchange protocol version, see
// https://www.gnu.org/software/libtool/manual/html_node/Versioning.html#Versioning
// The format is "current:revision:age".
version: string;
// The exchange's base URL.
base_url: string;
// The exchange's currency or asset unit.
currency: string;
// Type of the asset. "fiat", "crypto", "regional"
// or "stock". Wallets should adjust their UI/UX
// based on this value.
asset_type: string;
// Set to true if this exchange allows the use
// of reserves for tipping.
tipping_allowed: boolean;
// EdDSA master public key of the exchange, used to sign entries
// in denoms and signkeys.
master_public_key: EddsaPublicKey;
// Relative duration until inactive reserves are closed;
// not signed (!), can change without notice.
reserve_closing_delay: RelativeTime;
// Threshold amounts beyond which wallet should
// trigger the KYC process of the issuing
// exchange. Optional option, if not given there is no limit.
// Currency must match currency.
wallet_balance_limit_without_kyc?: Amount[];
// Denominations offered by this exchange.
// DEPRECATED: Will eventually be replaced by the
// differently structured "denominations" field.
denoms: Denom[];
// Denominations offered by this exchange
denominations: DenomGroup[];
// Compact EdDSA signature (binary-only) over the XOR of all
// .hash fields (in binary) in the list "denominations".
// Signature of TALER_ExchangeKeySetPS
denominations_sig: EddsaSignature;
// Denominations for which the exchange currently offers/requests recoup.
recoup: Recoup[];
// Array of globally applicable fees by time range.
global_fees: GlobalFees[];
// The date when the denomination keys were last updated.
list_issue_date: Timestamp;
// Auditors of the exchange.
auditors: AuditorKeys[];
// The exchange's signing keys.
signkeys: SignKey[];
// Optional field with a dictionary of (name, object) pairs defining the
// supported and enabled extensions, such as age_restriction.
extensions?: { name: ExtensionManifest };
// Signature by the exchange master key of the SHA-256 hash of the
// normalized JSON-object of field extensions, if it was set.
// The signature has purpose TALER_SIGNATURE_MASTER_EXTENSIONS.
extensions_sig?: EddsaSignature;
// Compact EdDSA signature (binary-only) over the SHA-512 hash of the
// concatenation of all SHA-512 hashes of the RSA denomination public keys
// in denoms in the same order as they were in denoms. Note that for
// hashing, the binary format of the RSA public keys is used, and not their
// base32 encoding. Wallets cannot do much with this signature by itself;
// it is only useful when multiple clients need to establish that the exchange
// is sabotaging end-user anonymity by giving disjoint denomination keys to
// different users. If an exchange were to do this, this signature allows the
// clients to demonstrate to the public that the exchange is dishonest.
// Signature of TALER_ExchangeKeySetPS
// DEPRICATED: Will eventually replaced by "denominations_sig"
eddsa_sig: EddsaSignature;
// Public EdDSA key of the exchange that was used to generate the signature.
// Should match one of the exchange's signing keys from /keys. It is given
// explicitly as the client might otherwise be confused by clock skew as to
// which signing key was used.
eddsa_pub: EddsaPublicKey;
}
interface GlobalFees {
// What date (inclusive) does these fees go into effect?
start_date: Timestamp;
// What date (exclusive) does this fees stop going into effect?
end_date: Timestamp;
// Account history fee, charged when a user wants to
// obtain a reserve/account history.
history_fee: Amount;
// Annual fee charged for having an open account at the
// exchange. Charged to the account. If the account
// balance is insufficient to cover this fee, the account
// is automatically deleted/closed. (Note that the exchange
// will keep the account history around for longer for
// regulatory reasons.)
account_fee: Amount;
// Purse fee, charged only if a purse is abandoned
// and was not covered by the account limit.
purse_fee: Amount;
// How long will the exchange preserve the account history?
// After an account was deleted/closed, the exchange will
// retain the account history for legal reasons until this time.
history_expiration: RelativeTime;
// Non-negative number of concurrent purses that any
// account holder is allowed to create without having
// to pay the purse_fee.
purse_account_limit: Integer;
// How long does an exchange keep a purse around after a purse
// has expired (or been successfully merged)? A 'GET' request
// for a purse will succeed until the purse expiration time
// plus this value.
purse_timeout: RelativeTime;
// Signature of TALER_GlobalFeesPS.
master_sig: EddsaSignature;
}
// Binary representation of the age groups.
// The bits set in the mask mark the edges at the beginning of a next age
// group. F.e. for the age groups
// 0-7, 8-9, 10-11, 12-13, 14-15, 16-17, 18-21, 21-*
// the following bits are set:
//
// 31 24 16 8 0
// | | | | |
// oooooooo oo1oo1o1 o1o1o1o1 ooooooo1
//
// A value of 0 means that the exchange does not support the extension for
// age-restriction.
type AgeMask = Integer;
type DenomGroup =
| DenomGroupRsa
| DenomGroupCs
| DenomGroupRsaAgeRestricted
| DenomGroupCsAgeRestricted;
interface DenomGroupRsa extends DenomGroupCommon {
cipher: "RSA";
denoms: ({
rsa_pub: RsaPublicKey;
} & DenomCommon)[];
}
interface DenomGroupCs extends DenomGroupCommon {
cipher: "CS";
denoms: ({
cs_pub: Cs25519Point;
} & DenomCommon)[];
}
interface DenomGroupRsaAgeRestricted extends DenomGroupCommon {
cipher: "RSA+age_restricted";
age_mask: AgeMask;
denoms: ({
rsa_pub: RsaPublicKey;
} & DenomCommon)[];
}
interface DenomGroupCSAgeRestricted extends DenomGroupCommon {
cipher: "CS+age_restricted";
age_mask: AgeMask;
denoms: ({
cs_pub: Cs25519Point;
} & DenomCommon)[];
}
// Common attributes for all denomination groups
interface DenomGroupCommon {
// How much are coins of this denomination worth?
value: Amount;
// Fee charged by the exchange for withdrawing a coin of this denomination.
fee_withdraw: Amount;
// Fee charged by the exchange for depositing a coin of this denomination.
fee_deposit: Amount;
// Fee charged by the exchange for refreshing a coin of this denomination.
fee_refresh: Amount;
// Fee charged by the exchange for refunding a coin of this denomination.
fee_refund: Amount;
// XOR of all the SHA-512 hash values of the denominations' public keys
// in this group. Note that for hashing, the binary format of the
// public keys is used, and not their base32 encoding.
hash: HashCode;
}
interface DenomCommon {
// Signature of TALER_DenominationKeyValidityPS.
master_sig: EddsaSignature;
// When does the denomination key become valid?
stamp_start: Timestamp;
// When is it no longer possible to deposit coins
// of this denomination?
stamp_expire_withdraw: Timestamp;
// Timestamp indicating by when legal disputes relating to these coins must
// be settled, as the exchange will afterwards destroy its evidence relating to
// transactions involving this coin.
stamp_expire_legal: Timestamp;
}
interface Denom {
// How much are coins of this denomination worth?
value: Amount;
// When does the denomination key become valid?
stamp_start: Timestamp;
// When is it no longer possible to deposit coins
// of this denomination?
stamp_expire_withdraw: Timestamp;
// Timestamp indicating by when legal disputes relating to these coins must
// be settled, as the exchange will afterwards destroy its evidence relating to
// transactions involving this coin.
stamp_expire_legal: Timestamp;
// Public key for the denomination.
denom_pub: DenominationKey;
// Fee charged by the exchange for withdrawing a coin of this denomination.
fee_withdraw: Amount;
// Fee charged by the exchange for depositing a coin of this denomination.
fee_deposit: Amount;
// Fee charged by the exchange for refreshing a coin of this denomination.
fee_refresh: Amount;
// Fee charged by the exchange for refunding a coin of this denomination.
fee_refund: Amount;
// Signature of TALER_DenominationKeyValidityPS.
master_sig: EddsaSignature;
}
type DenominationKey =
| RsaDenominationKey
| CSDenominationKey;
interface RsaDenominationKey {
cipher: "RSA";
// 32-bit age mask.
age_mask: Integer;
// RSA public key
rsa_public_key: RsaPublicKey;
}
interface CSDenominationKey {
cipher: "CS";
// 32-bit age mask.
age_mask: Integer;
// Public key of the denomination.
cs_public_key: Cs25519Point;
}
Fees for any of the operations can be zero, but the fields must still be
present. The currency of the fee_deposit
, fee_refresh
and fee_refund
must match the
currency of the value
. Theoretically, the fee_withdraw
could be in a
different currency, but this is not currently supported by the
implementation.
interface Recoup {
// Hash of the public key of the denomination that is being revoked under
// emergency protocol (see /recoup).
h_denom_pub: HashCode;
// We do not include any signature here, as the primary use-case for
// this emergency involves the exchange having lost its signing keys,
// so such a signature here would be pretty worthless. However, the
// exchange will not honor /recoup requests unless they are for
// denomination keys listed here.
}
A signing key in the signkeys
list is a JSON object with the following fields:
interface SignKey {
// The actual exchange's EdDSA signing public key.
key: EddsaPublicKey;
// Initial validity date for the signing key.
stamp_start: Timestamp;
// Date when the exchange will stop using the signing key, allowed to overlap
// slightly with the next signing key's validity to allow for clock skew.
stamp_expire: Timestamp;
// Date when all signatures made by the signing key expire and should
// henceforth no longer be considered valid in legal disputes.
stamp_end: Timestamp;
// Signature over key and stamp_expire by the exchange master key.
// Signature of TALER_ExchangeSigningKeyValidityPS.
// Must have purpose TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY.
master_sig: EddsaSignature;
}
An entry in the auditors
list is a JSON object with the following fields:
interface AuditorKeys {
// The auditor's EdDSA signing public key.
auditor_pub: EddsaPublicKey;
// The auditor's URL.
auditor_url: string;
// The auditor's name (for humans).
auditor_name: string;
// An array of denomination keys the auditor affirms with its signature.
// Note that the message only includes the hash of the public key, while the
// signature is actually over the expanded information including expiration
// times and fees. The exact format is described below.
denomination_keys: AuditorDenominationKey[];
}
interface AuditorDenominationKey {
// Hash of the public RSA key used to sign coins of the respective
// denomination. Note that the auditor's signature covers more than just
// the hash, but this other information is already provided in denoms and
// thus not repeated here.
denom_pub_h: HashCode;
// Signature of TALER_ExchangeKeyValidityPS.
auditor_sig: EddsaSignature;
}
The same auditor may appear multiple times in the array for different subsets of denomination keys, and the same denomination key hash may be listed multiple times for the same or different auditors. The wallet or merchant just should check that the denomination keys they use are in the set for at least one of the auditors that they accept.
Note
Both the individual denominations and the denomination list is signed, allowing customers to prove that they received an inconsistent list.
GET
/wire
¶Returns a list of payment methods supported by the exchange. The idea is that wallets may use this information to instruct users on how to perform wire transfers to top up their wallets.
Response:
Details:
interface WireResponse {
// Master public key of the exchange, must match the key returned in /keys.
master_public_key: EddsaPublicKey;
// Array of wire accounts operated by the exchange for
// incoming wire transfers.
accounts: WireAccount[];
// Object mapping names of wire methods (i.e. "iban" or "x-taler-bank")
// to wire fees.
fees: { method : AggregateTransferFee[] };
// List of exchanges that this exchange is partnering
// with to enable wallet-to-wallet transfers.
wads: ExchangePartner[];
}
The specification for the account object is:
interface WireAccount {
// payto:// URI identifying the account and wire method
payto_uri: string;
// URI to convert amounts from or to the currency used by
// this wire account of the exchange. Missing if no
// conversion is applicable.
conversion_url?: string;
// Restrictions that apply to bank accounts that would send
// funds to the exchange (crediting this exchange bank account).
// Optional, empty array for unrestricted.
credit_restrictions: AccountRestriction[];
// Restrictions that apply to bank accounts that would receive
// funds from the exchange (debiting this exchange bank account).
// Optional, empty array for unrestricted.
debit_restrictions: AccountRestriction[];
// Signature using the exchange's offline key over
// a TALER_MasterWireDetailsPS
// with purpose TALER_SIGNATURE_MASTER_WIRE_DETAILS.
master_sig: EddsaSignature;
}
type AccountRestriction =
| RegexAccountRestriction
| DenyAllAccountRestriction
// Account restriction that disables this type of
// account for the indicated operation categorically.
interface DenyAllAccountRestriction {
type: "deny";
}
// Accounts interacting with this type of account
// restriction must have a payto://-URI matching
// the given regex.
interface RegexAccountRestriction {
type: "regex";
// Regular expression that the payto://-URI of the
// partner account must follow. The regular expression
// should follow posix-egrep, but without support for character
// classes, GNU extensions, back-references or intervals. See
// https://www.gnu.org/software/findutils/manual/html_node/find_html/posix_002degrep-regular-expression-syntax.html
// for a description of the posix-egrep syntax. Applications
// may support regexes with additional features, but exchanges
// must not use such regexes.
payto_regex: string;
// Hint for a human to understand the restriction
// (that is hopefully easier to comprehend than the regex itself).
human_hint: string;
// Map from IETF BCP 47 language tags to localized
// human hints.
human_hint_i18n?: { [lang_tag: string]: string };
}
Aggregate wire transfer fees representing the fees the exchange
charges per wire transfer to a merchant must be specified as an
array in all wire transfer response objects under fees
. The
respective array contains objects with the following members:
interface AggregateTransferFee {
// Per transfer wire transfer fee.
wire_fee: Amount;
// Per transfer closing fee.
closing_fee: Amount;
// Per exchange-to-exchange transfer (wad) fee.
wad_fee: Amount;
// What date (inclusive) does this fee go into effect?
// The different fees must cover the full time period in which
// any of the denomination keys are valid without overlap.
start_date: Timestamp;
// What date (exclusive) does this fee stop going into effect?
// The different fees must cover the full time period in which
// any of the denomination keys are valid without overlap.
end_date: Timestamp;
// Signature of TALER_MasterWireFeePS with
// purpose TALER_SIGNATURE_MASTER_WIRE_FEES.
sig: EddsaSignature;
}
interface ExchangePartner {
// Base URL of the partner exchange.
partner_base_url: string;
// Public master key of the partner exchange.
partner_master_pub: EddsaPublicKey;
// Exchange-to-exchange wad (wire) transfer frequency.
wad_frequency: RelativeTime;
// When did this partnership begin (under these conditions)?
start_date: Timestamp;
// How long is this partnership expected to last?
end_date: Timestamp;
// Signature using the exchange's offline key over
// TALER_WadPartnerSignaturePS
// with purpose TALER_SIGNATURE_MASTER_PARTNER_DETAILS.
master_sig: EddsaSignature;
}
GET
/management/keys
¶Get a list of future public keys to be used by the exchange. Only to be used by the exchange’s offline key management team. Not useful for anyone else (but also not secret, so access is public).
Response:
Details:
interface FutureKeysResponse {
// Future denominations to be offered by this exchange
// (only those lacking a master signature).
future_denoms: FutureDenom[];
// The exchange's future signing keys (only those lacking a master signature).
future_signkeys: FutureSignKey[];
// Master public key expected by this exchange (provided so that the
// offline signing tool can check that it has the right key).
master_pub: EddsaPublicKey;
// Public key of the denomination security module.
denom_secmod_public_key: EddsaPublicKey;
// Public key of the signkey security module.
signkey_secmod_public_key: EddsaPublicKey;
}
interface FutureDenom {
// Name in the configuration file that defines this denomination.
section_name: string;
// How much are coins of this denomination worth?
value: Amount;
// When does the denomination key become valid?
stamp_start: Timestamp;
// When is it no longer possible to withdraw coins
// of this denomination?
stamp_expire_withdraw: Timestamp;
// When is it no longer possible to deposit coins
// of this denomination?
stamp_expire_deposit: Timestamp;
// Timestamp indicating by when legal disputes relating to these coins must
// be settled, as the exchange will afterwards destroy its evidence relating to
// transactions involving this coin.
stamp_expire_legal: Timestamp;
// Public (RSA) key for the denomination.
denom_pub: RsaPublicKey;
// Fee charged by the exchange for withdrawing a coin of this denomination.
fee_withdraw: Amount;
// Fee charged by the exchange for depositing a coin of this denomination.
fee_deposit: Amount;
// Fee charged by the exchange for refreshing a coin of this denomination.
fee_refresh: Amount;
// Fee charged by the exchange for refunding a coin of this denomination.
fee_refund: Amount;
// Signature by the denomination security module
// over TALER_DenominationKeyAnnouncementPS
// for this denomination with purpose
// TALER_SIGNATURE_SM_DENOMINATION_KEY.
denom_secmod_sig: EddsaSignature;
}
interface SignKey {
// The actual exchange's EdDSA signing public key.
key: EddsaPublicKey;
// Initial validity date for the signing key.
stamp_start: Timestamp;
// Date when the exchange will stop using the signing key, allowed to overlap
// slightly with the next signing key's validity to allow for clock skew.
stamp_expire: Timestamp;
// Date when all signatures made by the signing key expire and should
// henceforth no longer be considered valid in legal disputes.
stamp_end: Timestamp;
// Signature over TALER_SigningKeyAnnouncementPS
// for this signing key by the signkey security
// module using purpose TALER_SIGNATURE_SM_SIGNING_KEY.
signkey_secmod_sig: EddsaSignature;
}
POST
/management/keys
¶Provide master signatures for future public keys to be used by the exchange. Only to be used by the exchange’s offline key management team. Not useful for anyone else.
Request: The request body must be a MasterSignatures object.
Response:
Details:
interface MasterSignatures {
// Provided master signatures for future denomination keys.
denom_sigs: DenomSignature[];
// Provided master signatures for future online signing keys.
signkey_sigs: SignKeySignature[];
}
interface DenomSignature {
// Hash of the public (RSA) key of the denomination.
h_denom_pub: HashCode;
// Signature over TALER_DenominationKeyValidityPS.
// Must have purpose TALER_SIGNATURE_MASTER_DENOMINATION_KEY_VALIDITY
master_sig: EddsaSignature;
}
interface SignKeySignature {
// The actual exchange's EdDSA signing public key.
key: EddsaPublicKey;
// Signature by the exchange master key over
// TALER_ExchangeSigningKeyValidityPS.
// Must have purpose TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY.
master_sig: EddsaSignature;
}
POST
/management/denominations/$H_DENOM_PUB/revoke
¶Revoke denomination key, preventing further use by the exchange. Only to be used by the exchange’s offline key management team. Not useful for anyone else.
Request: The request body must be a DenomRevocationSignature object.
Response:
Details:
interface DenomRevocationSignature {
// Signature by the exchange master key over a
// TALER_MasterDenominationKeyRevocationPS.
// Must have purpose TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED.
master_sig: EddsaSignature;
}
POST
/management/signkeys/$EXCHANGE_PUB/revoke
¶Revoke exchange online signing key, preventing further use by the exchange. Only to be used by the exchange’s offline key management team. Not useful for anyone else.
Request: The request body must be a SignkeyRevocationSignature object.
Response:
Details:
interface SignkeyRevocationSignature {
// Signature by the exchange master key over a
// TALER_MasterSigningKeyRevocationPS.
// Must have purpose TALER_SIGNATURE_MASTER_SIGN_KEY_REVOKED.
master_sig: EddsaSignature;
}
POST
/management/auditors
¶This request will be used to enable an auditor.
Request:
The request must be a AuditorSetupMessage.
Response:
Details:
interface AuditorSetupMessage {
// Base URL of the auditor.
auditor_url: string;
// Human-readable name of the auditor.
auditor_name: string;
// The auditor's EdDSA signing public key.
auditor_pub: EddsaPublicKey;
// Signature by the exchange master ke yover a
// TALER_MasterAddAuditorPS.
// Must have purpose TALER_SIGNATURE_MASTER_ADD_AUDITOR.
master_sig: EddsaSignature;
// When does the auditor become active?
// Should be the time when the signature was created,
// using the (monotonic!) local time of the system
// with the offline master public key. Note that
// even if the time is in the future, the auditor will
// become active immediately! Used ONLY to detect replay attacks.
validity_start: Timestamp;
}
POST
/management/auditors/$AUDITOR_PUB/disable
¶This request will be used to disable the use of the given auditor. We use POST instead of DELETE because the exchange will retain state about the auditor (specifically the end date) to prevent replay attacks abusing the AuditorSetupMessage. Also, DELETE would not support a body, which is needed to provide the signature authorizing the operation.
Request:
The request must be a AuditorTeardownMessage.
Response
Details:
interface AuditorTeardownMessage {
// Signature by the exchange master key over a
// TALER_MasterDelAuditorPS.
// Must have purpose TALER_SIGNATURE_MASTER_AUDITOR_DEL.
master_sig: EddsaSignature;
// When does the auditor become inactive?
// Should be the time when the signature was created,
// using the (monotonic!) local time of the system
// with the offline master public key. Note that
// even if the time is in the future, the auditor will
// become inactive immediately! Used ONLY to detect replay attacks.
validity_end: Timestamp;
}
POST
/management/wire-fee
¶This request is used to configure wire fees.
Request:
The request must be a WireFeeSetupMessage.
Response:
Details:
interface WireFeeSetupMessage {
// Wire method the fee applies to.
wire_method: string;
// Signature using the exchange's offline key
// with purpose TALER_SIGNATURE_MASTER_WIRE_FEES.
master_sig_wire: EddsaSignature;
// When does the wire fee validity period start?
fee_start: Timestamp;
// When does the wire fee validity period end (exclusive).
fee_end: Timestamp;
// Closing fee to charge during that time period for this wire method.
closing_fee: Amount;
// Wire fee to charge during that time period for this wire method.
wire_fee: Amount;
}
POST
/management/global-fees
¶Provides global fee configuration for a timeframe.
Request:
The request must be a GlobalFees message.
Response
POST
/management/wire
¶This request will be used to enable a wire method (exchange bank account).
Request:
The request must be a WireSetupMessage.
Response:
Details:
interface WireSetupMessage {
// payto:// URL identifying the account and wire method
payto_uri: string;
// Signature using the exchange's offline key
// over a TALER_MasterWireDetailsPS
// with purpose TALER_SIGNATURE_MASTER_WIRE_DETAILS.
master_sig_wire: EddsaSignature;
// Signature using the exchange's offline key over a
// TALER_MasterAddWirePS
// with purpose TALER_SIGNATURE_MASTER_WIRE_ADD.
master_sig_add: EddsaSignature;
// When does the wire method become active?
// Should be the time when the signature was created,
// using the (monotonic!) local time of the system
// with the offline master public key. Note that
// even if the time is in the future, the wire method will
// become active immediately! Used ONLY to detect replay attacks.
validity_start: Timestamp;
}
POST
/management/wire/disable
¶This request will be used to disable the use of the given wire method. We use POST instead of DELETE because the exchange will retain state about the wire method (specifically the end date) to prevent replay attacks abusing the WireSetupMessage. Also, DELETE would not support a body, which is needed to provide the signature authorizing the operation.
Request:
The request must be a WireTeardownMessage.
Response
Details:
interface WireTeardownMessage {
// payto:// URL identifying the account and wire method
payto_uri: string;
// Signature using the exchange's offline key over a
// TALER_MasterDelWirePS.
// with purpose TALER_SIGNATURE_MASTER_WIRE_DEL.
master_sig_del: EddsaSignature;
// Should be the time when the signature was created,
// using the (monotonic!) local time of the system
// with the offline master public key. Note that
// even if the time is in the future, the wire method will
// become inactive immediately! Used ONLY to detect replay attacks.
validity_end: Timestamp;
}
POST
/management/drain
¶This request is used to drain profits from the
exchange’s escrow account to another regular
bank account of the exchange. The actual drain
requires running the taler-exchange-drain
tool.
Request:
The request must be a DrainProfitsMessage.
Response:
Details:
interface DrainProfitsMessage {
// Configuration section of the account to debit.
debit_account_section: string;
// Credit payto URI
credit_payto_uri: string;
// Wire transfer identifier to use.
wtid: Base32;
// Signature by the exchange master key over a
// TALER_MasterDrainProfitPS.
// Must have purpose TALER_SIGNATURE_MASTER_DRAIN_PROFITS.
master_sig: EddsaSignature;
// When was the message created.
date: Timestamp;
// Amount to be drained.
amount: Amount;
}
POST
/management/aml-officers
¶Update settings for an AML Officer status.
Request:
The request must be an AmlOfficerSetup message.
Response
Details:
interface AmlOfficerSetup {
// Public key of the AML officer
officer_pub: EddsaPublicKey;
// Legal full name of the AML officer
officer_name: string;
// Is the account active?
is_active: boolean;
// Is the account read-only?
read_only: boolean;
// Signature by the exchange master key over a
// TALER_MasterAmlOfficerStatusPS.
// Must have purpose TALER_SIGNATURE_MASTER_AML_KEY.
master_sig: EddsaSignature;
// When will the change take effect?
change_date: Timestamp;
}
POST
/management/partners
¶Enables a partner exchange for wad transfers.
Request:
The request must be an ExchangePartner message.
Response
Details:
interface ExchangePartner {
// Base URL of the partner exchange
partner_base_url: string;
// Master (offline) public key of the partner exchange.
partner_pub: EddsaPublicKey;
// How frequently will wad transfers be made
wad_frequency: RelativeTime;
// Signature by the exchange master key over a
// TALER_PartnerConfigurationPS.
// Must have purpose TALER_SIGNATURE_MASTER_PARTNER_DETAILS.
master_sig: EddsaSignature;
// When will the partner relationship start (inclusive).
start_date: Timestamp;
// When will the partner relationship end (exclusive).
end_date: Timestamp;
// Wad fee to be charged (to customers).
wad_fee: Amount;
}
This API is only for designated AML officers. It is used to allow exchange staff to monitor suspicious transactions and freeze or unfreeze accounts suspected of money laundering.
GET
/aml/$OFFICER_PUB/decisions/$STATE
¶Obtain list of AML decisions (filtered by $STATE). $STATE
must be either normal
, pending
or frozen
.
Taler-AML-Officer-Signature: The client must provide Base-32 encoded EdDSA signature with $OFFICER_PRIV
, affirming the desire to obtain AML data. Note that this is merely a simple authentication mechanism, the details of the request are not protected by the signature.
N (-N)
, so that at most N
values strictly older (younger) than start
are returned. Defaults to -20
to return the last 20 entries (before start
).delta
for its interpretation. Defaults to INT64_MAX
, namely the biggest row id possible in the database.Response
Details:
interface AmlRecords {
// Array of AML records matching the query.
records: AmlRecord[];
}
interface AmlRecord {
// Which payto-address is this record about.
// Identifies a GNU Taler wallet or an affected bank account.
h_payto: PaytoHash;
// What is the current AML state.
current_state: Integer;
// Monthly transaction threshold before a review will be triggered
threshold: Amount;
// RowID of the record.
rowid: Integer;
}
GET
/aml/$OFFICER_PUB/decision/$H_PAYTO
¶Obtain deails about an AML decision.
Taler-AML-Officer-Signature: The client must provide Base-32 encoded EdDSA signature with $OFFICER_PRIV
, affirming the desire to obtain AML data. Note that this is merely a simple authentication mechanism, the details of the request are not protected by the signature.
Response
Details:
interface AmlDecisionDetails {
// Array of AML decisions made for this account. Possibly
// contains only the most recent decision if "history" was
// not set to 'true'.
aml_history: AmlDecisionDetail[];
// Array of KYC attributes obtained for this account.
kyc_attributes: KycDetail[];
}
interface AmlDecisionDetail {
// What was the justification given?
justification: string;
// What is the new AML state.
new_state: Integer;
// When was this decision made?
decision_time: Timestamp;
// What is the new AML decision threshold (in monthly transaction volume)?
new_threshold: Amount;
// Who made the decision?
decider_pub: AmlOfficerPublicKeyP;
}
interface KycDetail {
// Name of the configuration section that specifies the provider
// which was used to collect the KYC details
provider_section: string;
// The collected KYC data. NULL if the attribute data could not
// be decrypted (internal error of the exchange, likely the
// attribute key was changed).
attributes?: Object;
// Time when the KYC data was collected
collection_time: Timestamp;
// Time when the validity of the KYC data will expire
expiration_time: Timestamp;
}
POST
/aml/$OFFICER_PUB/decision
¶Make an AML decision. Triggers the respective action and records the justification.
Request:
The request must be an AmlDecision message.
Response
Details:
interface AmlDecision {
// Human-readable justification for the decision.
justification: string;
// At what monthly transaction volume should the
// decision be automatically reviewed?
new_threshold: Amount;
// Which payto-address is the decision about?
// Identifies a GNU Taler wallet or an affected bank account.
h_payto: PaytoHash;
// What is the new AML state (e.g. frozen, unfrozen, etc.)
// Numerical values are defined in AmlDecisionState.
new_state: Integer;
// Signature by the AML officer over a
// TALER_MasterAmlOfficerStatusPS.
// Must have purpose TALER_SIGNATURE_MASTER_AML_KEY.
officer_sig: EddsaSignature;
// When was the decision made?
decision_time: Timestamp;
// Optional argument to impose new KYC requirements
// that the customer has to satisfy to unblock transactions.
kyc_requirements?: string[];
}
This part of the API is for the use by auditors interacting with the exchange.
POST
/auditors/$AUDITOR_PUB/$H_DENOM_PUB
¶This is used to add an auditor signature to the /keys
response. It
affirms to wallets and merchants that this auditor is indeed auditing
the coins issued by the respective denomination. There is no “delete”
operation for this, as auditors can only stop auditing a denomination
when it expires.
Request:
The request must be a AuditorSignatureAddMessage.
Response:
Details:
interface DenominationUnknownMessage {
// Taler error code.
code: number;
// Signature by the exchange over a
// TALER_DenominationUnknownAffirmationPS.
// Must have purpose TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_UNKNOWN.
exchange_sig: EddsaSignature;
// Public key of the exchange used to create
// the 'exchange_sig.
exchange_pub: EddsaPublicKey;
// Hash of the denomination public key that is unknown.
h_denom_pub: HashCode;
// When was the signature created.
timestamp: Timestamp;
}
interface AuditorSignatureAddMessage {
// Signature by the auditor over a
// TALER_ExchangeKeyValidityPS.
// Must have purpose TALER_SIGNATURE_AUDITOR_EXCHANGE_KEYS.
auditor_sig: EddsaSignature;
}
This API is used by the wallet to obtain digital coins.
When transferring money to the exchange such as via SEPA transfers, the exchange creates a reserve, which keeps the money from the customer. The customer must specify an EdDSA reserve public key as part of the transfer, and can then withdraw digital coins using the corresponding private key. All incoming and outgoing transactions are recorded under the corresponding public key by the exchange.
Note
Eventually the exchange will need to advertise a policy for how long it will
keep transaction histories for inactive or even fully drained reserves. We
will therefore need some additional handler similar to /keys
to
advertise those terms of service.
GET
/reserves/$RESERVE_PUB
¶Request information about a reserve.
Request:
Response:
Details:
interface ReserveSummary {
// Balance left in the reserve.
balance: Amount;
// If set, age restriction is required to be set for each coin to this
// value during the withdrawal from this reserve. The client then MUST
// use a denomination with support for age restriction enabled for the
// withdrawal.
// The value represents a valid age group from the list of permissible
// age groups as defined by the exchange's output to /keys.
maximum_age_group?: number;
}
POST
/reserves/$RESERVE_PUB/status
¶Request information about a reserve or an account.
Request:
The request body must be a ReserveStatusRequest object.
Response:
Details:
interface ReserveStatusRequest {
// Signature of purpose
// TALER_SIGNATURE_RESERVE_STATUS_REQUEST over
// a TALER_ReserveStatusRequestSignaturePS.
reserve_sig: EddsaSignature;
// Time when the client made the request.
// Timestamp must be reasonably close to the time of
// the exchange, otherwise the exchange may reject
// the request.
request_timestamp: Timestamp;
}
interface ReserveStatus {
// Balance left in the reserve.
balance: Amount;
// If set, gives the maximum age group that the client is required to set
// during withdrawal.
maximum_age_group: number;
// Transaction history for this reserve.
// May be partial (!).
history: TransactionHistoryItem[];
}
Objects in the transaction history have the following format:
// Union discriminated by the "type" field.
type TransactionHistoryItem =
| AccountSetupTransaction
| ReserveHistoryTransaction
| ReserveWithdrawTransaction
| ReserveAgeWithdrawTransaction
| ReserveCreditTransaction
| ReserveClosingTransaction
| ReserveOpenRequestTransaction
| ReserveCloseRequestTransaction
| PurseMergeTransaction;
interface AccountSetupTransaction {
type: "SETUP";
// KYC fee agreed to by the reserve owner.
kyc_fee: Amount;
// Time when the KYC was triggered.
kyc_timestamp: Timestamp;
// Hash of the wire details of the account.
// Note that this hash is unsalted and potentially
// private (as it could be inverted), hence access
// to this endpoint must be authorized using the
// private key of the reserve.
h_wire: HashCode;
// Signature created with the reserve's private key.
// Must be of purpose TALER_SIGNATURE_ACCOUNT_SETUP_REQUEST over
// a TALER_AccountSetupRequestSignaturePS.
reserve_sig: EddsaSignature;
}
interface ReserveHistoryTransaction {
type: "HISTORY";
// Fee agreed to by the reserve owner.
amount: Amount;
// Time when the request was made.
request_timestamp: Timestamp;
// Signature created with the reserve's private key.
// Must be of purpose TALER_SIGNATURE_RESERVE_HISTORY_REQUEST over
// a TALER_ReserveHistoryRequestSignaturePS.
reserve_sig: EddsaSignature;
}
interface ReserveWithdrawTransaction {
type: "WITHDRAW";
// Amount withdrawn.
amount: Amount;
// Hash of the denomination public key of the coin.
h_denom_pub: HashCode;
// Hash of the blinded coin to be signed.
h_coin_envelope: HashCode;
// Signature over a TALER_WithdrawRequestPS
// with purpose TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW
// created with the reserve's private key.
reserve_sig: EddsaSignature;
// Fee that is charged for withdraw.
withdraw_fee: Amount;
}
interface ReserveAgeWithdrawTransaction {
type: "AGEWITHDRAW";
// Total Amount withdrawn.
amount: Amount;
// Commitment of all n*kappa blinded coins.
h_commitment: HashCode;
// Signature over a TALER_AgeWithdrawRequestPS
// with purpose TALER_SIGNATURE_WALLET_RESERVE_AGE_WITHDRAW
// created with the reserve's private key.
reserve_sig: EddsaSignature;
// Fee that is charged for withdraw.
withdraw_fee: Amount;
}
interface ReserveCreditTransaction {
type: "CREDIT";
// Amount deposited.
amount: Amount;
// Sender account payto:// URL.
sender_account_url: string;
// Opaque identifier internal to the exchange that
// uniquely identifies the wire transfer that credited the reserve.
wire_reference: Integer;
// Timestamp of the incoming wire transfer.
timestamp: Timestamp;
}
interface ReserveClosingTransaction {
type: "CLOSING";
// Closing balance.
amount: Amount;
// Closing fee charged by the exchange.
closing_fee: Amount;
// Wire transfer subject.
wtid: Base32;
// payto:// URI of the wire account into which the funds were returned to.
receiver_account_details: string;
// This is a signature over a
// struct TALER_ReserveCloseConfirmationPS with purpose
// TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED.
exchange_sig: EddsaSignature;
// Public key used to create 'exchange_sig'.
exchange_pub: EddsaPublicKey;
// Time when the reserve was closed.
timestamp: Timestamp;
}
interface ReserveOpenRequestTransaction {
type: "OPEN";
// Open fee paid from the reserve.
open_fee: Amount;
// This is a signature over
// a struct TALER_ReserveOpenPS with purpose
// TALER_SIGNATURE_WALLET_RESERVE_OPEN.
reserve_sig: EddsaSignature;
// Timestamp of the open request.
request_timestamp: Timestamp;
// Requested expiration.
requested_expiration: Timestamp;
// Requested number of free open purses.
requested_min_purses: Integer;
}
interface ReserveCloseRequestTransaction {
type: "CLOSE";
// This is a signature over
// a struct TALER_ReserveClosePS with purpose
// TALER_SIGNATURE_WALLET_RESERVE_CLOSE.
reserve_sig: EddsaSignature;
// Target account payto://, optional.
h_payto?: PaytoHash;
// Timestamp of the close request.
request_timestamp: Timestamp;
}
interface ReserveCreditTransaction {
type: "CREDIT";
// Amount deposited.
amount: Amount;
// Sender account payto:// URL.
sender_account_url: string;
// Opaque identifier internal to the exchange that
// uniquely identifies the wire transfer that credited the reserve.
wire_reference: Integer;
// Timestamp of the incoming wire transfer.
timestamp: Timestamp;
}
interface PurseMergeTransaction {
type: "MERGE";
// SHA-512 hash of the contact of the purse.
h_contract_terms: HashCode;
// EdDSA public key used to approve merges of this purse.
merge_pub: EddsaPublicKey;
// Minimum age required for all coins deposited into the purse.
min_age: Integer;
// Number that identifies who created the purse
// and how it was paid for.
flags: Integer;
// Purse public key.
purse_pub: EddsaPublicKey;
// EdDSA signature of the account/reserve affirming the merge
// over a TALER_AccountMergeSignaturePS.
// Must be of purpose TALER_SIGNATURE_ACCOUNT_MERGE
reserve_sig: EddsaSignature;
// Client-side timestamp of when the merge request was made.
merge_timestamp: Timestamp;
// Indicative time by which the purse should expire
// if it has not been merged into an account. At this
// point, all of the deposits made should be
// auto-refunded.
purse_expiration: Timestamp;
// Purse fee the reserve owner paid for the purse creation.
purse_fee: Amount;
// Total amount merged into the reserve.
// (excludes fees).
amount: Amount;
// True if the purse was actually merged.
// If false, only the purse_fee has an impact
// on the reserve balance!
merged: boolean;
}
POST
/reserves/$RESERVE_PUB/history
¶Request information about the full history of a reserve or an account.
Request:
The request body must be a ReserveHistoryRequest object.
Response:
Details:
interface ReserveHistoryRequest {
// Signature of type
// TALER_SIGNATURE_RESERVE_HISTORY_REQUEST
// over a TALER_ReserveHistoryRequestSignaturePS.
reserve_sig: EddsaSignature;
// Time when the client made the request.
// Timestamp must be reasonably close to the time of
// the exchange, otherwise the exchange may reject
// the request.
request_timestamp: Timestamp;
}
DELETE
/reserves/$RESERVE_PUB
¶Forcefully closes a reserve. The request header must contain an Account-Request-Signature. Note: this endpoint is not currently implemented!
Request:
Account-Request-Signature: The client must provide Base-32 encoded EdDSA signature made with $ACCOUNT_PRIV
, affirming its authorization to delete the account. The purpose used MUST be TALER_SIGNATURE_RESERVE_CLOSE
.
Response:
void
and the force option was not provided.
This response comes with a standard ErrorDetail response.Details:
interface ReserveClosedResponse {
// Final balance of the account.
closing_amount: Amount;
// Current time of the exchange, used as part of
// what the exchange signs over.
close_time: Timestamp;
// Hash of the wire account into which the remaining
// balance will be transferred. Note: may be the
// hash over ``payto://void/`, in which case the
// balance is forfeit to the profit of the exchange.
h_wire: HashCode;
// This is a signature over a
// struct TALER_AccountDeleteConfirmationPS with purpose
// TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED.
exchange_sig: EddsaSignature;
}
POST
/csr-withdraw
¶Obtain exchange-side input values in preparation for a withdraw step for certain denomination cipher types, specifically at this point for Clause-Schnorr blind signatures.
Request: The request body must be a WithdrawPrepareRequest object.
Response:
Details:
type WithdrawPrepareResponse =
| ExchangeWithdrawValue;
type ExchangeWithdrawValue =
| ExchangeRsaWithdrawValue
| ExchangeCsWithdrawValue;
interface ExchangeRsaWithdrawValue {
cipher: "RSA";
}
POST
/reserves/$RESERVE_PUB/withdraw
¶Withdraw a coin of the specified denomination. Note that the client should commit all of the request details, including the private key of the coin and the blinding factor, to disk before issuing this request, so that it can recover the information if necessary in case of transient failures, like power outage, network outage, etc.
Request: The request body must be a WithdrawRequest object.
Response:
/keys
.
In this case, the response will be a DenominationUnknownMessage.
If the reserve is unknown, the wallet should not report a hard error yet, but
instead simply wait for up to a day, as the wire transaction might simply
not yet have completed and might be known to the exchange in the near future.
In this case, the wallet should repeat the exact same request later again
using exactly the same blinded coin.This reserve has received funds from a purse or the amount withdrawn exceeds another legal threshold and thus the reserve must be upgraded to an account (with KYC) before the withdraw can complete. Note that this response does NOT affirm that the withdraw will ultimately complete with the requested amount. The user should be redirected to the provided location to perform the required KYC checks to open the account before withdrawing. Afterwards, the request should be repeated. The response will be an KycNeededRedirect object.
Implementation note: internally, we need to distinguish between upgrading the reserve to an account (due to P2P payment) and identifying the owner of the origin bank account (due to exceeding the withdraw amount threshold), as we need to create a different payto://-URI for the KYC check depending on the case.
Details:
interface DenominationExpiredMessage {
// Taler error code. Note that beyond
// expiration this message format is also
// used if the key is not yet valid, or
// has been revoked.
code: number;
// Signature by the exchange over a
// TALER_DenominationExpiredAffirmationPS.
// Must have purpose TALER_SIGNATURE_EXCHANGE_AFFIRM_DENOM_EXPIRED.
exchange_sig: EddsaSignature;
// Public key of the exchange used to create
// the 'exchange_sig.
exchange_pub: EddsaPublicKey;
// Hash of the denomination public key that is unknown.
h_denom_pub: HashCode;
// When was the signature created.
timestamp: Timestamp;
// What kind of operation was requested that now
// failed?
oper: string;
}
interface WithdrawRequest {
// Hash of a denomination public key (RSA), specifying the type of coin the client
// would like the exchange to create.
denom_pub_hash: HashCode;
// Coin's blinded public key, should be (blindly) signed by the exchange's
// denomination private key.
coin_ev: CoinEnvelope;
// Signature of TALER_WithdrawRequestPS created with
// the reserves's private key
// using purpose TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW.
reserve_sig: EddsaSignature;
}
interface WithdrawResponse {
// The blinded signature over the 'coin_ev', affirms the coin's
// validity after unblinding.
ev_sig: BlindedDenominationSignature;
}
type BlindedDenominationSignature =
| RsaBlindedDenominationSignature
| CSBlindedDenominationSignature;
interface RsaBlindedDenominationSignature {
cipher: "RSA";
// (blinded) RSA signature
blinded_rsa_signature: BlindedRsaSignature;
}
interface CSBlindedDenominationSignature {
type: "CS";
// Signer chosen bit value, 0 or 1, used
// in Clause Blind Schnorr to make the
// ROS problem harder.
b: Integer;
// Blinded scalar calculated from c_b.
s: Cs25519Scalar;
}
interface KycNeededRedirect {
// Numeric error code unique to the condition.
// Should always be TALER_EC_EXCHANGE_GENERIC_KYC_REQUIRED.
code: number;
// Human-readable description of the error, i.e. "missing parameter", "commitment violation", ...
// Should give a human-readable hint about the error's nature. Optional, may change without notice!
hint?: string;
// Hash of the payto:// account URI that identifies
// the account which is being KYCed.
h_payto: PaytoHash;
// Legitimization target that the merchant should
// use to check for its KYC status using
// the /kyc-check/$REQUIREMENT_ROW/... endpoint.
requirement_row: Integer;
}
interface WithdrawError {
// Text describing the error.
hint: string;
// Detailed error code.
code: Integer;
// Amount left in the reserve.
balance: Amount;
// History of the reserve's activity, in the same format
// as returned by /reserve/$RID/history.
history: TransactionHistoryItem[]
}
POST
/reserves/$RESERVE_PUB/batch-withdraw
¶Withdraw multiple coins from the same reserve. Note that the client should commit all of the request details, including the private key of the coins and the blinding factors, to disk before issuing this request, so that it can recover the information if necessary in case of transient failures, like power outage, network outage, etc.
Request: The request body must be a BatchWithdrawRequest object.
Response:
/keys
.
In this case, the response will be a DenominationUnknownMessage.
If the reserve is unknown, the wallet should not report a hard error yet, but
instead simply wait for up to a day, as the wire transaction might simply
not yet have completed and might be known to the exchange in the near future.
In this case, the wallet should repeat the exact same request later again
using exactly the same blinded coin.This reserve has received funds from a purse or the amount withdrawn exceeds another legal threshold and thus the reserve must be upgraded to an account (with KYC) before the withdraw can complete. Note that this response does NOT affirm that the withdraw will ultimately complete with the requested amount. The user should be redirected to the provided location to perform the required KYC checks to open the account before withdrawing. Afterwards, the request should be repeated. The response will be an KycNeededRedirect object.
Implementation note: internally, we need to distinguish between upgrading the reserve to an account (due to P2P payment) and identifying the owner of the origin bank account (due to exceeding the withdraw amount threshold), as we need to create a different payto://-URI for the KYC check depending on the case.
Details:
interface BatchWithdrawRequest {
// Array of requests for the individual coins to withdraw.
planchets: WithdrawRequest[];
}
interface BatchWithdrawResponse {
// Array of blinded signatures, in the same order as was
// given in the request.
ev_sigs: WithdrawResponse[];
}
If the reserve was marked with a maximum age group, the client has to perform a
cut&choose protocol with the exchange. It first calls
/reserves/$RESERVE_PUB/age-withdraw
and commits to n*kappa
coins. On
success, the exchange answers this request with an noreveal-index. The client
then has to call /age-withdraw/$ACH/reveal
to reveal all n*(kappa - 1)
coins along with their age commitments to proof that they were appropriate.
If so, the exchange will blindly sign n
undisclosed coins from the request.
POST
/reserves/$RESERVE_PUB/age-withdraw
¶Withdraw multiple coins with age restriction from the same reserve. Note that the client should commit all of the request details, including the private key of the coins and the blinding factors, to disk before issuing this request, so that it can recover the information if necessary in case of transient failures, like power outage, network outage, etc.
Request: The request body must be a AgeWithdrawRequest object.
Response:
interface AgeWithdrawRequest {
// Array of n hash codes of denomination public keys to order.
// These denominations MUST support age restriction as defined in the
// output to /keys.
// The sum of all denomination's values plus fees MUST be at most the
// balance of the reserve. The balance of the reserve will be
// immediatley reduced by that amount.
denoms_h: HashCode[];
// n arrays of kappa entries with blinded coin envelopes. Each
// (toplevel) entry represents kappa canditates for a particular
// coin. The exchange will respond with an index gamma, which is
// the index that shall remain undisclosed during the reveal phase.
// The SHA512 hash $ACH over the blinded coin envelopes is the commitment
// that is later used as the key to the reveal-URL.
blinded_coins_evs: CoinEnvelope[][];
// The maximum age to commit to. MUST be the same as the maximum
// age in the reserve.
max_age: number;
// Signature of TALER_AgeWithdrawRequestPS created with
// the reserves's private key
// using purpose TALER_SIGNATURE_WALLET_RESERVE_AGE_WITHDRAW.
reserve_sig: EddsaSignature;
}
interface AgeWithdrawResponse {
// index of the commitments that the client doesn't
// have to disclose
noreveal_index: Integer;
// Signature of TALER_AgeWithdrawRequestPS whereby
// the exchange confirms the noreveal_index.
exchange_sig: EddsaSignature;
// Public EdDSA key of the exchange that was used to
// generate the signature. Should match one of the exchange's signing
// keys from /keys. Again given explicitly as the client might
// otherwise be confused by clock skew as to which signing key was used.
exchange_pub: EddsaPublicKey;
}
POST
/age-withdraw/$ACH/reveal
¶The client has previously committed to multiple coins with age restriction
in a call to /reserve/$RESERVE_PUB/age-withdraw
and got a
AgeWithdrawResponse from the exchange. By calling this
endpoint, the client has to reveal each coin and their kappa - 1
age commitments, except for the age commitments with index
noreveal_index
. The hash of all commitments from the former withdraw
request is given as the $ACH
value in the URL to this endpoint.
Request: The request body must be a AgeWithdrawRevealRequest object.
Response:
The reveal operation failed and the response is an WithdrawError object. The error codes indicate one of two cases:
TALER_EC_EXCHANGE_GENERIC_COIN_AGE_REQUIREMENT_FAILURE
.TALER_EC_EXCHANGE_GENERIC_MISMATCH_OF_AMOUNT_AND_DENOMINATIONS
.interface AgeWithdrawRevealRequest {
// Array of n of (kappa - 1) disclosed coin master secrets, from
// which the coins' private key coin_priv, blinding beta and nonce
// nonce (for Clause-Schnorr) itself are derived as usually in wallet
// core. Given a coin's secret, the age commitment for the coin MUST be
// derived from this private key as follows:
//
// Let m ∈ {1,...,M} be the maximum age group as defined in the reserve
// that the wallet can commit to.
//
// For age group $AG ∈ {1,...m}, set
// seed = HDKF(coin_secret, "age-commitment", $AG)
// p[$AG] = Edx25519_generate_private(seed)
// and calculate the corresponding Edx25519PublicKey as
// q[$AG] = Edx25519_public_from_private(p[$AG])
//
// For age groups $AG ∈ {m,...,M}, set
// f[$AG] = HDKF(coin_secret, "age-factor", $AG)
// and calculate the corresponding Edx25519PublicKey as
// q[$AG] = Edx25519_derive_public(PublishedAgeRestrictionBaseKey, f[$AG])
//
// Given each coin's private key and age commitment (q[]), the
// exchange will calculate each coin's blinded hash value und use all
// those (disclosed) blinded hashes together with the non-disclosed
// envelopes coin_evs during the verification of the original
// age-withdraw-commitment.
disclosed_coin_secrets: AgeRestrictedCoinSecret[][];
}
// The Master key material for the derivation of age restricted private
// coins, blinding factors and age restrictions
type AgeRestrictedCoinSecret = string;
// The value for PublishedAgeRestrictionBaseKey is a randomly chosen
// Edx25519PublicKey for which the private key is not known to the clients. It is
// used during the age-withdraw protocol so that clients can proof that they
// derived all public keys to age groups higher than their allowed maximum
// from this particular value.
const PublishedAgeRestrictionBaseKey =
new Edx25519PublicKey("DZJRF6HXN520505XDAWM8NMH36QV9J3VH77265WQ09EBQ76QSKCG");
Deposit operations are requested f.e. by a merchant during a transaction or a bidder during an auction.
For the deposit operation during purchase, the merchant has to obtain the deposit permission for a coin from their customer who owns the coin. When depositing a coin, the merchant is credited an amount specified in the deposit permission, possibly a fraction of the total coin’s value, minus the deposit fee as specified by the coin’s denomination.
For auctions, a bidder performs an deposit operation and provides all relevant
information for the auction policy (such as timeout and public key as bidder)
and can use the exchange_sig
field from the DepositSuccess message as a
proof to the seller for the escrow of sufficient fund.
POST
/coins/$COIN_PUB/deposit
¶Deposit the given coin and ask the exchange to transfer the given Amounts to the merchant’s bank account. This API is used by the merchant to redeem the digital coins.
The base URL for
/coins/
-requests may differ from the main base URL of the exchange. The exchange MUST return a 307 or 308 redirection to the correct base URL if this is the case.Request:
The request body must be a DepositRequest object.
Response:
- 200 OK:
- The operation succeeded, the exchange confirms that no double-spending took place. The response will include a DepositSuccess object.
- 403 Forbidden:
- One of the signatures is invalid. This response comes with a standard ErrorDetail response.
- 404 Not found:
- Either the denomination key is not recognized (expired or invalid), or the wire type is not recognized. If the denomination key is unknown, the response will be a DenominationUnknownMessage.
- 409 Conflict:
- The deposit operation has either failed because the coin has insufficient residual value, or because the same public key of the coin has been previously used with a different denomination. It is also a conflict to use the same coin multiple times (with different amounts) for the same contract. Which case it is can be decided by looking at the error code (
TALER_EC_EXCHANGE_DEPOSIT_CONFLICTING_CONTRACT
(same coin used in different ways),TALER_EC_EXCHANGE_GENERIC_INSUFFICIENT_FUNDS
(balance insufficient) orTALER_EC_EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY
(same coin public key, but different denomination)). The fields of the response are still evolving (see bug 7267), for now the format of the response is a DepositDoubleSpendError. The request should not be repeated again with this coin.- 410 Gone:
- The requested denomination key is not yet or no longer valid. It either before the validity start, past the expiration or was revoked. The response is a DenominationExpiredMessage. Clients must evaluate the error code provided to understand which of the cases this is and handle it accordingly.
Details:
interface DepositRequest { // Amount to be deposited, can be a fraction of the // coin's total value. contribution: Amount; // The merchant's account details. // In case of an auction policy, it refers to the seller. merchant_payto_uri: string; // The salt is used to hide the payto_uri from customers // when computing the h_wire of the merchant. wire_salt: WireSalt; // SHA-512 hash of the contract of the merchant with the customer. Further // details are never disclosed to the exchange. h_contract_terms: HashCode; // Hash of denomination RSA key with which the coin is signed. denom_pub_hash: HashCode; // IFF the corresponding denomination has support for // age restriction enabled, this field MUST contain the SHA256 // value of the age commitment that MUST have been provided during the // purchase. age_commitment_hash?: AgeCommitmentHash; // Exchange's unblinded RSA signature of the coin. ub_sig: DenominationSignature; // Timestamp when the contract was finalized. timestamp: Timestamp; // Indicative time by which the exchange undertakes to transfer the funds to // the merchant, in case of successful payment. A wire transfer deadline of 'never' // is not allowed. wire_transfer_deadline: Timestamp; // EdDSA public key of the merchant, so that the client can identify the // merchant for refund requests. // // THIS FIELD WILL BE DEPRICATED, once the refund mechanism becomes a // policy via extension. merchant_pub: EddsaPublicKey; // Date until which the merchant can issue a refund to the customer via the // exchange, to be omitted if refunds are not allowed. // // THIS FIELD WILL BE DEPRICATED, once the refund mechanism becomes a // policy via extension. refund_deadline?: Timestamp; // CAVEAT: THIS IS WORK IN PROGRESS // (Optional) policy for the deposit. // This might be a refund, auction or escrow policy. // // Note that support for policies is an optional feature of the exchange. // Optional features are so called "extensions" in Taler. The exchange // provides the list of supported extensions, including policies, in the // ExtensionsManifestsResponse response to the /keys endpoint. policy?: DepositPolicy; // Signature over TALER_DepositRequestPS, made by the customer with the // coin's private key. coin_sig: EddsaSignature; }type DenominationSignature = | RsaDenominationSignature | CSDenominationSignature;interface RsaDenominationSignature { cipher: "RSA"; // RSA signature rsa_signature: RsaSignature; }interface CSDenominationSignature { type: "CS"; // R value component of the signature. cs_signature_r: Cs25519Point; // s value component of the signature. cs_signature_s: Cs25519Scalar: }type DepositPolicy = | PolicyMerchantRefund | PolicyBrandtVickreyAuction | PolicyEscrowedPayment;// CAVEAT: THIS IS STILL WORK IN PROGRESS. // This policy is optional and might not be supported by the exchange. // If it does, the exchange MUST show support for this policy in the // extensions field in the response to /keys. interface PolicyMerchantRefund { type: "merchant_refund"; // EdDSA public key of the merchant, so that the client // can identify the merchant for refund requests. merchant_pub: EddsaPublicKey; // Date until which the merchant can issue a refund to the customer via // the /extensions/policy_refund-endpoint of the exchange. deadline: Timestamp; }// CAVEAT: THIS IS STILL WORK IN PROGRESS. // This policy is optional and might not be supported by the exchange. // If it does, the exchange MUST show support for this policy in the // extensions field in the response to /keys. interface PolicyBrandtVickreyAuction { type: "brandt_vickrey_auction"; // Public key of this bidder. // // The bidder uses this key to sign the auction information and // the messages it sends to the seller during the auction. bidder_pub: EddsaPublicKey; // Hash of the auction terms // // The hash should be taken over a normalized JSON object of type // BrandtVickreyAuction. h_auction: HashCode; // The amount that this bidder commits to for this auction // // This amount can be larger than the contribution of a single coin. // The bidder can increase funding of this auction policy by using // sufficiently many coins during the deposit operation (single or batch) // with the same policy. commitment: Amount; // Date until the auction must have been successfully executed and // a valid transcript provided to the // /extensions/policy_brandt_vickrey_auction-endpoint of the // exchange. // // [If the auction has not been executed by then] OR [has been executed // before then, but this bidder did not win], the coin's value doesn't // change and the owner can refresh the coin. // // If this bidder won the auction, the winning price/amount from the // outcome will be substracted from the coin and transfered to the // merchant's payout_uri from the deposit request (minus a potential // auction fee). For any remaining value, the bidder can refresh the // coin to retrieve change. deadline: Timestamp; }// CAVEAT: THIS IS STILL WORK IN PROGRESS. // This structure defines an auction of Brandt-Vickory kind. // It is used for the PolicyBrandtVickreyAuction. interface BrandtVickreyAuction { // Start date of the auction time_start: Timestamp; // Maximum duration per round. There are four rounds in an auction of // Brandt-Vickrey kind. time_round: RelativeTime; // This integer m refers to the (m+1)-type of the Brandt-Vickrey-auction. // - Type 0 refers to an auction with one highest-price winner, // - Type 1 refers to an auction with one winner, paying the second // highest price, // - Type 2 refers to an auction with two winners, paying // the third-highest price, // - etc. auction_type: number; // The vector of prices for the Brandt-Vickrey auction. The values MUST // be in strictly increasing order. prices: Amount[]; // The type of outcome of the auction. // In case the auction is declared public, each bidder can calculate the // winning price. This field is not relevant for the replay of a // transcript, as the transcript must be provided by the seller who sees // the winner(s) and winning price of the auction. outcome_public: boolean; // The public key of the seller. pubkey: EddsaPublicKey; // The seller's account details. payto_uri: string; }// CAVEAT: THIS IS STILL WORK IN PROGRESS // This policy is optional and might not be supported by the exchange. // If it does, the exchange MUST show support for this policy in the // extensions field in the response to /keys. interface PolicyEscrowedPayment { type: "escrowed_payment"; // Public key of this trustor, the owner of the coins. // // To claim the deposit, the merchant must provide the valid signature // of the h_contract_terms field from the deposit, signed by _this_ // key, to the /extensions/policy_escrow-endpoint of the exchange, // after the date specified in not_before and before the date // specified in not_after. trustor_pub: EddsaPublicKey; // Latest date by which the deposit must be claimed. If the deposit // has not been claimed by that date, the deposited coins can be // refreshed by the (still) owner. deadline: Timestamp; }The deposit operation succeeds if the coin is valid for making a deposit and has enough residual value that has not already been deposited or melted.
interface DepositSuccess { // Optional base URL of the exchange for looking up wire transfers // associated with this transaction. If not given, // the base URL is the same as the one used for this request. // Can be used if the base URL for /transactions/ differs from that // for /coins/, i.e. for load balancing. Clients SHOULD // respect the transaction_base_url if provided. Any HTTP server // belonging to an exchange MUST generate a 307 or 308 redirection // to the correct base URL should a client uses the wrong base // URL, or if the base URL has changed since the deposit. transaction_base_url?: string; // Timestamp when the deposit was received by the exchange. exchange_timestamp: Timestamp; // The EdDSA signature of TALER_DepositConfirmationPS using a current // signing key of the exchange affirming the successful // deposit and that the exchange will transfer the funds after the refund // deadline, or as soon as possible if the refund deadline is zero. exchange_sig: EddsaSignature; // Public EdDSA key of the exchange that was used to // generate the signature. // Should match one of the exchange's signing keys from /keys. It is given // explicitly as the client might otherwise be confused by clock skew as to // which signing key was used. exchange_pub: EddsaPublicKey; }interface DepositDoubleSpendError { // The string constant "insufficient funds". hint: string; // Transaction history for the coin that is // being double-spended. history: CoinSpendHistoryItem[]; }// Union discriminated by the "type" field. type CoinSpendHistoryItem = | CoinDepositTransaction | CoinMeltTransaction | CoinRefundTransaction | CoinRecoupTransaction | CoinOldCoinRecoupTransaction | CoinRecoupRefreshTransaction | CoinPurseDepositTransaction | CoinPurseRefundTransaction | CoinReserveOpenDepositTransaction;interface CoinDepositTransaction { type: "DEPOSIT"; // The total amount of the coin's value absorbed (or restored in the // case of a refund) by this transaction. // The amount given includes // the deposit fee. The current coin value can thus be computed by // subtracting this amount. amount: Amount; // Deposit fee. deposit_fee: Amount; // Public key of the merchant. merchant_pub: EddsaPublicKey; // Date when the operation was made. timestamp: Timestamp; // Date until which the merchant can issue a refund to the customer via the // exchange, possibly zero if refunds are not allowed. refund_deadline?: Timestamp; // Signature over TALER_DepositRequestPS, made by the customer with the // coin's private key. coin_sig: EddsaSignature; // Hash of the bank account from where we received the funds. h_wire: HashCode; // Hash of the public denomination key used to sign the coin. // Needed because 'coin_sig' signs over this, and // that is important to fix the coin's denomination. h_denom_pub: HashCode; // Hash over the proposal data of the contract that // is being paid. h_contract_terms: HashCode; }interface CoinMeltTransaction { type: "MELT"; // The total amount of the coin's value absorbed by this transaction. // Note that for melt this means the amount given includes // the melt fee. The current coin value can thus be computed by // subtracting the amounts. amount: Amount; // Signature by the coin over a // TALER_RefreshMeltCoinAffirmationPS of // purpose TALER_SIGNATURE_WALLET_COIN_MELT. coin_sig: EddsaSignature; // Melt fee. melt_fee: Amount; // Commitment from the melt operation. rc: TALER_RefreshCommitmentP; // Hash of the public denomination key used to sign the coin. // Needed because 'coin_sig' signs over this, and // that is important to fix the coin's denomination. h_denom_pub: HashCode; }
interface CoinRefundTransaction {
type: "REFUND";
// The total amount of the coin's value restored
// by this transaction.
// The amount given excludes the transaction fee.
// The current coin value can thus be computed by
// adding the amounts to the coin's denomination value.
amount: Amount;
// Refund fee.
refund_fee: Amount;
// Hash over the proposal data of the contract that
// is being refunded.
h_contract_terms: HashCode;
// Refund transaction ID.
rtransaction_id: Integer;
// EdDSA Signature authorizing the REFUND over a
// TALER_MerchantRefundConfirmationPS with
// purpose TALER_SIGNATURE_MERCHANT_REFUND_OK. Made with
// the public key of the merchant.
merchant_sig: EddsaSignature;
}
interface CoinRecoupTransaction {
type: "RECOUP";
// The total amount of the coin's value absorbed
// by this transaction.
// The current coin value can thus be computed by
// subtracting the amount from
// the coin's denomination value.
amount: Amount;
// Date when the operation was made.
timestamp: Timestamp;
// Signature by the coin over a
// TALER_RecoupRequestPS with purpose
// TALER_SIGNATURE_WALLET_COIN_RECOUP.
coin_sig: EddsaSignature;
// Hash of the public denomination key used to sign the coin.
// Needed because 'coin_sig' signs over this, and
// that is important to fix the coin's denomination.
h_denom_pub: HashCode;
// Coin blinding key.
coin_blind: DenominationBlindingKeyP;
// Reserve receiving the recoup.
reserve_pub: EddsaPublicKey;
// Signature by the exchange over a
// TALER_RecoupConfirmationPS, must be
// of purpose TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP.
exchange_sig: EddsaSignature;
// Public key of the private key used to create 'exchange_sig'.
exchange_pub: EddsaPublicKey;
}
interface CoinOldCoinRecoupTransaction {
type: "OLD-COIN-RECOUP";
// The total amount of the coin's value restored
// by this transaction.
// The current coin value can thus be computed by
// adding the amount to the coin's denomination value.
amount: Amount;
// Date when the operation was made.
timestamp: Timestamp;
// Signature by the exchange over a
// TALER_RecoupRefreshConfirmationPS
// of purpose TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH.
exchange_sig: EddsaSignature;
// Public key of the private key used to create 'exchange_sig'.
exchange_pub: EddsaPublicKey;
}
interface CoinRecoupRefreshTransaction {
type: "RECOUP-REFRESH";
// The total amount of the coin's value absorbed
// by this transaction.
// The current coin value can thus be computed by
// subtracting this amounts from
// the coin's denomination value.
amount: Amount;
// Date when the operation was made.
timestamp: Timestamp;
// Signature by the coin over a TALER_RecoupRequestPS
// with purpose TALER_SIGNATURE_WALLET_COIN_RECOUP.
coin_sig: EddsaSignature;
// Hash of the public denomination key used to sign the coin.
// Needed because 'coin_sig' signs over this, and
// that is important to fix the coin's denomination.
h_denom_pub: HashCode;
// Coin blinding key.
coin_blind: DenominationBlindingKeyP;
// Signature by the exchange over a
// TALER_RecoupRefreshConfirmationPS
// of purpose TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP_REFRESH.
exchange_sig: EddsaSignature;
// Public key used to sign 'exchange_sig'.
exchange_pub: EddsaPublicKey;
// Blinding factor of the revoked new coin.
new_coin_blinding_secret: DenominationBlindingKeySecret;
// Blinded public key of the revoked new coin.
new_coin_ev: DenominationBlindingKeySecret;
}
interface CoinPurseDepositTransaction {
type: "PURSE-DEPOSIT";
// The total amount of the coin's value absorbed
// by this transaction.
// Note that this means the amount given includes
// the deposit fee. The current coin value can thus be computed by
// subtracting the amount from
// the coin's denomination value.
amount: Amount;
// Deposit fee.
deposit_fee: Amount;
// Public key of the purse.
purse_pub: EddsaPublicKey;
// Date when the purse was set to expire.
purse_expiration: Timestamp;
// Signature by the coin over a
// TALER_PurseDepositSignaturePS of
// purpose TALER_SIGNATURE_PURSE_DEPOSIT.
coin_sig: EddsaSignature;
// Hash of the public denomination key used to sign the coin.
// Needed because 'coin_sig' signs over this, and
// that is important to fix the coin's denomination.
h_denom_pub: HashCode;
}
interface CoinPurseRefundTransaction {
type: "PURSE-REFUND";
// The total amount of the coin's value restored
// by this transaction.
// The amount given excludes the refund fee.
// The current coin value can thus be computed by
// adding the amount to the coin's denomination value.
amount: Amount;
// Refund fee (of the coin's denomination). The deposit
// fee will be waived.
refund_fee: Amount;
// Public key of the purse that expired.
purse_pub: EddsaPublicKey;
// Signature by the exchange over a
// TALER_CoinPurseRefundConfirmationPS
// of purpose TALER_SIGNATURE_EXCHANGE_CONFIRM_PURSE_REFUND.
exchange_sig: EddsaSignature;
// Public key used to sign 'exchange_sig'.
exchange_pub: EddsaPublicKey;
}
interface CoinReserveOpenDepositTransaction {
type: "RESERVE-OPEN-DEPOSIT";
// The total amount of the coin's value absorbed
// by this transaction.
// Note that this means the amount given includes
// the deposit fee.
coin_contribution: Amount;
// Signature of the reserve open operation being paid for.
reserve_sig: EddsaSignature;
// Signature by the coin over a
// TALER_ReserveOpenDepositSignaturePS of
// purpose TALER_SIGNATURE_RESERVE_OPEN_DEPOSIT.
coin_sig: EddsaSignature;
}
POST
/batch-deposit
¶Deposit multiple coins and ask the exchange to transfer the given Amounts into the merchant’s bank account. This API is used by the merchant to redeem the digital coins.
Request:
The request body must be a BatchDepositRequest object.
Response:
TALER_EC_EXCHANGE_DEPOSIT_CONFLICTING_CONTRACT
(same coin used in different ways),
TALER_EC_EXCHANGE_GENERIC_INSUFFICIENT_FUNDS
(balance insufficient) or
TALER_EC_EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY
(same coin public key, but different denomination)).
The fields of the response are still evolving (see bug 7267),
for now the format of the response is a DepositDoubleSpendError.
The request should not be repeated again with this coin.Details:
interface BatchDepositRequest {
// The merchant's account details.
merchant_payto_uri: string;
// The salt is used to hide the payto_uri from customers
// when computing the h_wire of the merchant.
wire_salt: WireSalt;
// SHA-512 hash of the contract of the merchant with the customer. Further
// details are never disclosed to the exchange.
h_contract_terms: HashCode;
// The list of coins that are going to be deposited with this Request.
coins: BatchDepositRequestCoin[];
// Timestamp when the contract was finalized.
timestamp: Timestamp;
// Indicative time by which the exchange undertakes to transfer the funds to
// the merchant, in case of successful payment. A wire transfer deadline of 'never'
// is not allowed.
wire_transfer_deadline: Timestamp;
// EdDSA public key of the merchant, so that the client can identify the
// merchant for refund requests.
merchant_pub: EddsaPublicKey;
// Date until which the merchant can issue a refund to the customer via the
// exchange, to be omitted if refunds are not allowed.
//
// THIS FIELD WILL BE DEPRICATED, once the refund mechanism becomes a
// policy via extension.
refund_deadline?: Timestamp;
// CAVEAT: THIS IS WORK IN PROGRESS
// (Optional) policy for the batch-deposit.
// This might be a refund, auction or escrow policy.
policy?: DepositPolicy;
}
interface BatchDepositRequestCoin {
// EdDSA public key of the coin being deposited.
coin_pub: EddsaPublicKey;
// Hash of denomination RSA key with which the coin is signed.
denom_pub_hash: HashCode;
// Exchange's unblinded RSA signature of the coin.
ub_sig: DenominationSignature;
// Amount to be deposited, can be a fraction of the
// coin's total value.
contribution: Amount;
// Signature over TALER_DepositRequestPS, made by the customer with the
// coin's private key.
coin_sig: EddsaSignature;
}
The deposit operation succeeds if the coin is valid for making a deposit and has enough residual value that has not already been deposited or melted.
interface BatchDepositSuccess {
// Optional base URL of the exchange for looking up wire transfers
// associated with this transaction. If not given,
// the base URL is the same as the one used for this request.
// Can be used if the base URL for /transactions/ differs from that
// for /coins/, i.e. for load balancing. Clients SHOULD
// respect the transaction_base_url if provided. Any HTTP server
// belonging to an exchange MUST generate a 307 or 308 redirection
// to the correct base URL should a client uses the wrong base
// URL, or if the base URL has changed since the deposit.
transaction_base_url?: string;
// Timestamp when the deposit was received by the exchange.
exchange_timestamp: Timestamp;
// Public EdDSA key of the exchange that was used to
// generate the signature.
// Should match one of the exchange's signing keys from /keys. It is given
// explicitly as the client might otherwise be confused by clock skew as to
// which signing key was used.
exchange_pub: EddsaPublicKey;
// Array of deposit confirmation signatures from the exchange
// Entries must be in the same order the coins were given
// in the batch deposit request.
exchange_sigs: DepositConfirmationSignature[];
}
interface DepositConfirmationSignature {
// The EdDSA signature of TALER_DepositConfirmationPS using a current
// signing key of the exchange affirming the successful
// deposit and that the exchange will transfer the funds after the refund
// deadline, or as soon as possible if the refund deadline is zero.
exchange_sig: EddsaSignature;
}
Refreshing creates n
new coins from m
old coins, where the sum of
denominations of the new coins must be smaller than the sum of the old coins’
denominations plus melting (refresh) and withdrawal fees charged by the exchange.
The refreshing API can be used by wallets to melt partially spent coins, making
transactions with the freshly exchangeed coins unlinkabe to previous transactions
by anyone except the wallet itself.
However, the new coins are linkable from the private keys of all old coins
using the /refresh/link
request. While /refresh/link
must be implemented by
the exchange to achieve taxability, wallets do not really ever need that part of
the API during normal operation.
POST
/csr-melt
¶Obtain exchange-side input values in preparation for a melt step for certain denomination cipher types, specifically at this point for Clause-Schnorr blind signatures.
Request: The request body must be a MeltPrepareRequest object.
Response:
Details:
interface WithdrawPrepareRequest {
// Master seed for the Clause-schnorr R-value
// creation.
// Must not have been used in any prior request.
rms: RefreshMasterSeed;
// Array of denominations and coin offsets for
// each of the fresh coins with a CS-cipher
// denomination.
nks: MeltPrepareDenomNonce[];
}
interface MeltPrepareDenomNonce {
// Offset of this coin in the list of
// fresh coins. May not match the array offset
// as the fresh coins may include non-CS
// denominations as well.
coin_offset: Integer;
// Hash of the public key of the denomination the
// request relates to. Must be a CS denomination type.
denom_pub_hash: HashCode;
}
interface MeltPrepareResponse {
// Responses for each request, in the same
// order that was used in the request.
ewvs: ExchangeWithdrawValue[];
}
POST
/coins/$COIN_PUB/melt
¶“Melts” a coin. Invalidates the coins and prepares for exchanging of fresh
coins. Taler uses a global parameter kappa
for the cut-and-choose
component of the protocol, for which this request is the commitment. Thus,
various arguments are given kappa
-times in this step. At present kappa
is always 3.
The base URL for /coins/
-requests may differ from the main base URL of the
exchange. The exchange MUST return a 307 or 308 redirection to the correct
base URL if this is the case.
TALER_EC_EXCHANGE_GENERIC_INSUFFICIENT_FUNDS
or
TALER_EC_EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY
).
The response is MeltForbiddenResponse in both cases.Details:
interface MeltRequest {
// Hash of the denomination public key, to determine total coin value.
denom_pub_hash: HashCode;
// Signature over the coin public key by the denomination.
denom_sig: DenominationSignature;
// Signature by the coin over the melt commitment.
confirm_sig: EddsaSignature;
// Amount of the value of the coin that should be melted as part of
// this refresh operation, including melting fee.
value_with_fee: Amount;
// Melt commitment. Hash over the various coins to be withdrawn.
// See also TALER_refresh_get_commitment().
rc: TALER_RefreshCommitmentP;
// Master seed for the Clause-schnorr R-value
// creation. Must match the /csr-melt request.
// Must not have been used in any prior melt request.
// Must be present if one of the fresh coin's
// denominations is of type Clause-Schnorr.
rms?: RefreshMasterSeed;
// IFF the denomination has age restriction support, the client MUST
// provide the SHA256 hash of the age commitment of the coin.
// MUST be omitted otherwise.
age_commitment_hash?: AgeCommitmentHash;
}
For details about the HKDF used to derive the new coin private keys and
the blinding factors from ECDHE between the transfer public keys and
the private key of the melted coin, please refer to the
implementation in libtalerutil
.
interface MeltResponse {
// Which of the kappa indices does the client not have to reveal.
noreveal_index: Integer;
// Signature of TALER_RefreshMeltConfirmationPS whereby the exchange
// affirms the successful melt and confirming the noreveal_index.
exchange_sig: EddsaSignature;
// Public EdDSA key of the exchange that was used to generate the signature.
// Should match one of the exchange's signing keys from /keys. Again given
// explicitly as the client might otherwise be confused by clock skew as to
// which signing key was used.
exchange_pub: EddsaPublicKey;
// Base URL to use for operations on the refresh context
// (so the reveal operation). If not given,
// the base URL is the same as the one used for this request.
// Can be used if the base URL for /refreshes/ differs from that
// for /coins/, i.e. for load balancing. Clients SHOULD
// respect the refresh_base_url if provided. Any HTTP server
// belonging to an exchange MUST generate a 307 or 308 redirection
// to the correct base URL should a client uses the wrong base
// URL, or if the base URL has changed since the melt.
//
// When melting the same coin twice (technically allowed
// as the response might have been lost on the network),
// the exchange may return different values for the refresh_base_url.
refresh_base_url?: string;
}
interface MeltForbiddenResponse {
// Text describing the error.
hint: string;
// Detailed error code.
code: Integer;
// The transaction list of the respective coin that failed to have sufficient funds left.
// Note that only the transaction history for one bogus coin is given,
// even if multiple coins would have failed the check.
history: CoinSpendHistoryItem[];
}
POST
/refreshes/$RCH/reveal
¶Reveal previously committed values to the exchange, except for the values
corresponding to the noreveal_index
returned by the /coins/
-melt step.
The $RCH is the hash over the refresh commitment from the /coins/
-melt step
(note that the value is calculated independently by both sides and has never
appeared explicitly in the protocol before).
The base URL for /refreshes/
-requests may differ from the main base URL of
the exchange. Clients SHOULD respect the refresh_base_url
returned for the
coin during melt operations. The exchange MUST return a
307 or 308 redirection to the correct base URL if the client failed to
respect the refresh_base_url
or if the allocation has changed.
Errors such as failing to do proper arithmetic when it comes to calculating
the total of the coin values and fees are simply reported as bad requests.
This includes issues such as melting the same coin twice in the same session,
which is simply not allowed. However, theoretically it is possible to melt a
coin twice, as long as the value_with_fee
of the two melting operations is
not larger than the total remaining value of the coin before the melting
operations. Nevertheless, this is not really useful.
Details:
Request body contains a JSON object with the following fields:
interface RevealRequest {
// Array of n new hash codes of denomination public keys to order.
new_denoms_h: HashCode[];
// Array of n entries with blinded coins,
// matching the respective entries in new_denoms.
coin_evs: CoinEnvelope[];
// kappa - 1 transfer private keys (ephemeral ECDHE keys).
transfer_privs: EddsaPrivateKey[];
// Transfer public key at the noreveal_index.
transfer_pub: EddsaPublicKey;
// Array of n signatures made by the wallet using the old coin's private key,
// used later to verify the /refresh/link response from the exchange.
// Signs over a TALER_CoinLinkSignaturePS.
link_sigs: EddsaSignature[];
// IFF the corresponding denomination has support for age restriction,
// the client MUST provide the original age commitment, i. e. the
// vector of public keys.
// The size of the vector MUST be the number of age groups as defined by the
// Exchange in the field .age_groups of the extension age_restriction.
old_age_commitment?: Edx25519PublicKey[];
}
interface RevealResponse {
// List of the exchange's blinded RSA signatures on the new coins.
ev_sigs : Array<{ ev_sig: BlindedDenominationSignature }>;
}
GET
/coins/$COIN_PUB/link
¶Link the old public key of a melted coin to the coin(s) that were exchanged during the refresh operation.
Request:
Response:
Details:
interface LinkResponse {
// Transfer ECDHE public key corresponding to the coin_pub, used to
// compute the blinding factor and private key of the fresh coins.
transfer_pub: EcdhePublicKey;
// Array with (encrypted/blinded) information for each of the coins
// exchangeed in the refresh operation.
new_coins: NewCoinInfo[];
}
interface NewCoinInfo {
// RSA public key of the exchangeed coin.
denom_pub: RsaPublicKey;
// Exchange's blinded signature over the fresh coin.
ev_sig: BlindedDenominationSignature;
// Blinded coin.
coin_ev : CoinEnvelope;
// Values contributed by the exchange during the
// withdraw operation (see /csr-melt).
ewv: ExchangeWithdrawValue;
// Offset of this coin in the refresh operation.
// Input needed to derive the private key.
coin_idx: Integer;
// Signature made by the old coin over the refresh request.
// Signs over a TALER_CoinLinkSignaturePS.
link_sig: EddsaSignature;
}
This API is only used if the exchange is either about to go out of
business or has had its private signing keys compromised (so in
either case, the protocol is only used in abnormal
situations). In the above cases, the exchange signals to the
wallets that the emergency cash back protocol has been activated
by putting the affected denomination keys into the cash-back
part of the /keys
response. If and only if this has happened,
coins that were signed with those denomination keys can be cashed
in using this API.
POST
/coins/$COIN_PUB/recoup
¶Demand that a coin be refunded via wire transfer to the original owner.
The base URL for /coins/
-requests may differ from the main base URL of the
exchange. The exchange MUST return a 307 or 308 redirection to the correct
base URL if this is the case.
The remaining amount on the coin will be credited to the reserve
that $COIN_PUB
was withdrawn from.
Note that the original withdrawal fees will not be recouped.
Request: The request body must be a RecoupRequest object.
Response:
TALER_EC_EXCHANGE_GENERIC_INSUFFICIENT_FUNDS
).
The response is a DepositDoubleSpendError.Details:
interface RecoupRequest {
// Hash of denomination public key, specifying the type of coin the client
// would like the exchange to pay back.
denom_pub_hash: HashCode;
// Signature over the coin public key by the denomination.
denom_sig: DenominationSignature;
// Exchange-contributed values during the refresh
// operation (see /csr-withdraw).
ewv: ExchangeWithdrawValue;
// Signature of TALER_RecoupRequestPS created with
// the coin's private key.
coin_sig: EddsaSignature;
// Coin's blinding factor.
coin_blind_key_secret: DenominationBlindingKeySecret;
// Nonce that was used by the exchange to derive
// its private inputs from during withdraw. Only
// present if the cipher of the revoked denomination
// is of type Clause-Schnorr (CS).
cs_nonce?: CSNonce;
}
interface RecoupWithdrawalConfirmation {
// Public key of the reserve that will receive the recoup.
reserve_pub: EddsaPublicKey;
}
POST
/coins/$COIN_PUB/recoup-refresh
¶Demand that a coin be refunded via wire transfer to the original owner.
The base URL for /coins/
-requests may differ from the main base URL of the
exchange. The exchange MUST return a 307 or 308 redirection to the correct
base URL if this is the case.
The remaining amount on the coin will be credited to
the old coin that $COIN_PUB
was refreshed from.
Note that the original refresh fees will not be recouped.
Request: The request body must be a RecoupRefreshRequest object.
Response:
TALER_EC_EXCHANGE_GENERIC_INSUFFICIENT_BALANCE
).
The response is a DepositDoubleSpendError.Details:
interface RecoupRefreshRequest {
// Hash of denomination public key, specifying the type of coin the client
// would like the exchange to pay back.
denom_pub_hash: HashCode;
// Signature over the coin public key by the denomination.
denom_sig: DenominationSignature;
// Exchange-contributed values during the refresh
// operation (see /csr-melt).
ewv: ExchangeWithdrawValue;
// Signature of TALER_RecoupRequestPS created with
// the coin's private key.
coin_sig: EddsaSignature;
// Coin's blinding factor.
coin_blind_key_secret: DenominationBlindingKeySecret;
// Nonce that was used by the exchange to derive
// its private inputs from during withdraw. Only
// present if the cipher of the revoked denomination
// is of type Clause-Schnorr (CS).
cs_nonce?: CSNonce;
}
interface RecoupRefreshConfirmation {
// Public key of the old coin that will receive the recoup.
old_coin_pub: EddsaPublicKey;
}
This API is used by merchants that need to find out which wire transfers (from the exchange to the merchant) correspond to which deposit operations. Typically, a merchant will receive a wire transfer with a wire transfer identifier and want to know the set of deposit operations that correspond to this wire transfer. This is the preferred query that merchants should make for each wire transfer they receive. If a merchant needs to investigate a specific deposit operation (i.e. because it seems that it was not paid), then the merchant can also request the wire transfer identifier for a deposit operation.
Sufficient information is returned to verify that the coin signatures are correct. This also allows governments to use this API when doing a tax audit on merchants.
Naturally, the returned information may be sensitive for the merchant. We do not require the merchant to sign the request, as the same requests may also be performed by the government auditing a merchant. However, wire transfer identifiers should have sufficient entropy to ensure that obtaining a successful reply by brute-force is not practical. Nevertheless, the merchant should protect the wire transfer identifiers from his bank statements against unauthorized access, lest his income situation is revealed to an adversary. (This is not a major issue, as an adversary that has access to the line-items of bank statements can typically also view the balance.)
GET
/transfers/$WTID
¶Provides deposits associated with a given wire transfer. The wire transfer identifier (WTID) and the base URL for tracking the wire transfer are both given in the wire transfer subject.
Request:
Response:
interface TrackTransferResponse {
// Actual amount of the wire transfer, excluding the wire fee.
total: Amount;
// Applicable wire fee that was charged.
wire_fee: Amount;
// Public key of the merchant (identical for all deposits).
merchant_pub: EddsaPublicKey;
// Hash of the payto:// account URI (identical for all deposits).
h_payto: PaytoHash;
// Time of the execution of the wire transfer by the exchange.
execution_time: Timestamp;
// Details about the deposits.
deposits: TrackTransferDetail[];
// Signature from the exchange made with purpose
// TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT
// over a TALER_WireDepositDataPS.
exchange_sig: EddsaSignature;
// Public EdDSA key of the exchange that was used to generate the signature.
// Should match one of the exchange's signing keys from /keys. Again given
// explicitly as the client might otherwise be confused by clock skew as to
// which signing key was used.
exchange_pub: EddsaSignature;
}
interface TrackTransferDetail {
// SHA-512 hash of the contact of the merchant with the customer.
h_contract_terms: HashCode;
// Coin's public key, both ECDHE and EdDSA.
coin_pub: CoinPublicKey;
// The total amount the original deposit was worth.
deposit_value: Amount;
// Applicable fees for the deposit.
deposit_fee: Amount;
}
GET
/deposits/$H_WIRE/$MERCHANT_PUB/$H_CONTRACT_TERMS/$COIN_PUB
¶Provide the wire transfer identifier associated with an (existing) deposit operation. The arguments are the hash of the merchant’s payment details (H_WIRE), the merchant’s public key (EdDSA), the hash of the contract terms that were paid (H_CONTRACT_TERMS) and the public key of the coin used for the payment (COIN_PUB).
Request:
TALER_SIGNATURE_MERCHANT_TRACK_TRANSACTION
over a
TALER_DepositTrackPS
, affirming that it is really the merchant who
requires obtaining the wire transfer identifier.NUMBER
milliseconds for completion of a deposit operation before
sending the HTTP response.Response:
Details:
interface TrackTransactionResponse {
// Raw wire transfer identifier of the deposit.
wtid: Base32;
// When was the wire transfer given to the bank.
execution_time: Timestamp;
// The contribution of this coin to the total (without fees)
coin_contribution: Amount;
// Binary-only Signature_ with purpose TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE
// over a TALER_ConfirmWirePS
// whereby the exchange affirms the successful wire transfer.
exchange_sig: EddsaSignature;
// Public EdDSA key of the exchange that was used to generate the signature.
// Should match one of the exchange's signing keys from /keys. Again given
// explicitly as the client might otherwise be confused by clock skew as to
// which signing key was used.
exchange_pub: EddsaPublicKey;
}
interface TrackTransactionAcceptedResponse {
// Legitimization target that the merchant should
// use to check for its KYC status using
// the /kyc-check/$REQUIREMENT_ROW/... endpoint.
// Optional, not present if the deposit has not
// yet been aggregated to the point that a KYC
// need has been evaluated.
requirement_row?: Integer;
// Current AML state for the target account. Non-zero
// values indicate that the transfer is blocked due to
// AML enforcement.
aml_decision: Integer;
// True if the KYC check for the merchant has been
// satisfied. False does not mean that KYC
// is strictly needed, unless also a
// legitimization_uuid is provided.
kyc_ok: boolean;
// Time by which the exchange currently thinks the deposit will be executed.
// Actual execution may be later if the KYC check is not satisfied by then.
execution_time: Timestamp;
}
POST
/coins/$COIN_PUB/refund
¶Undo deposit of the given coin, restoring its value.
Request: The request body must be a RefundRequest object.
Response:
rtransaction_id
is not unique.)
The response will be a RefundFailure object with the conflicting refund request.Details:
interface RefundRequest {
// Amount to be refunded, can be a fraction of the
// coin's total deposit value (including deposit fee);
// must be larger than the refund fee.
refund_amount: Amount;
// SHA-512 hash of the contact of the merchant with the customer.
h_contract_terms: HashCode;
// 64-bit transaction id of the refund transaction between merchant and customer.
rtransaction_id: Integer;
// EdDSA public key of the merchant.
merchant_pub: EddsaPublicKey;
// EdDSA signature of the merchant over a
// TALER_RefundRequestPS with purpose
// TALER_SIGNATURE_MERCHANT_REFUND
// affirming the refund.
merchant_sig: EddsaPublicKey;
}
interface RefundSuccess {
// The EdDSA :ref:signature (binary-only) with purpose
// TALER_SIGNATURE_EXCHANGE_CONFIRM_REFUND over
// a TALER_RecoupRefreshConfirmationPS
// using a current signing key of the
// exchange affirming the successful refund.
exchange_sig: EddsaSignature;
// Public EdDSA key of the exchange that was used to generate the signature.
// Should match one of the exchange's signing keys from /keys. It is given
// explicitly as the client might otherwise be confused by clock skew as to
// which signing key was used.
exchange_pub: EddsaPublicKey;
}
interface RefundFailure {
// Numeric error code unique to the condition, which can be either
// related to the deposit value being insufficient for the requested
// refund(s), or the requested refund conflicting due to refund
// transaction number re-use (with different amounts).
code: Integer;
// Human-readable description of the error message.
hint: string;
// Information about the conflicting refund request(s).
// This will not be the full history of the coin, but only
// the relevant subset of the transactions.
history: CoinSpendHistoryItem[];
}
GET
/purses/$PURSE_PUB/merge
¶GET
/purses/$PURSE_PUB/deposit
¶Obtain information about a purse. Depending on the suffix, the long-polling (if any) will wait for either a merge or a deposit event.
Request:
NUMBER
milliseconds for completion
of a merge operation before sending the HTTP response.NUMBER
milliseconds for completion
of a deposit operation before sending the HTTP response.Response:
Details:
interface PurseStatus {
// Total amount deposited into the purse so far.
// If 'total_deposit_amount' minus 'deposit_fees'
// exceeds 'merge_value_after_fees', and a
// 'merge_request' exists for the purse, then the
// purse will (have been) merged with the account.
balance: Amount;
// When does the purge expire.
purse_expiration: Timestamp;
// Time of the merge, missing if "never".
merge_timestamp?: Timestamp;
// Time of the deposits being complete, missing if "never".
// Note that this time may not be "stable": once sufficient
// deposits have been made, is "now" before the purse
// expiration, and otherwise set to the purse expiration.
// However, this should also not be relied upon. The key
// property is that it is either "never" or in the past.
deposit_timestamp?: Timestamp;
// Time when the purse expires and
// funds that were not merged are refunded
// on the deposited coins.
// FIXME: Document the exchange protocol version
// in which this field became available.
purse_expiration: Timestamp;
// EdDSA signature of the exchange over a
// TALER_PurseStatusResponseSignaturePS
// with purpose TALER_SIGNATURE_PURSE_STATUS_RESPONSE
// affirming the purse status.
exchange_sig: EddsaSignature;
// EdDSA public key exchange used for 'exchange_sig'.
exchange_pub: EddsaPublicKey;
}
POST
/purses/$PURSE_PUB/create
¶Create a purse by depositing money into it. First step of a PUSH payment.
Request:
The request body must be a PurseCreate object.
Response:
TALER_EC_EXCHANGE_GENERIC_INSUFFICIENT_FUNDS
or
TALER_EC_EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY
or
TALER_EC_EXCHANGE_PURSE_CREATE_CONFLICTING_META_DATA
or
TALER_EC_EXCHANGE_PURSE_DEPOSIT_CONFLICTING_META_DATA
or
TALER_EC_EXCHANGE_PURSE_ECONTRACT_CONFLICTING_META_DATA
).
The specific fields of the response depend on the error code
and include the signatures (and what was signed over) proving the
conflict.Date:
header
of the response to see if a minor time difference is to
blame and possibly adjust the request accordingly.
(Note: this status code is not yet used.)Details:
interface PurseCreate {
// Total value of the purse, excluding fees.
amount: Amount;
// Minimum age required for all coins deposited into the purse.
min_age: Integer;
// Optional encrypted contract, in case the buyer is
// proposing the contract and thus establishing the
// purse with the payment.
econtract?: EncryptedContract;
// EdDSA public key used to approve merges of this purse.
merge_pub: EddsaPublicKey;
// EdDSA signature of the purse over a
// TALER_PurseRequestSignaturePS
// of purpose TALER_SIGNATURE_WALLET_PURSE_CREATE
// confirming the key
// invariants associated with the purse.
// (amount, h_contract_terms, expiration).
purse_sig: EddsaSignature;
// SHA-512 hash of the contact of the purse.
h_contract_terms: HashCode;
// Array of coins being deposited into the purse.
// Maximum length is 128.
deposits: PurseDeposit[];
// Indicative time by which the purse should expire
// if it has not been merged into an account. At this
// point, all of the deposits made will be auto-refunded.
purse_expiration: Timestamp;
}
interface EncryptedContract {
// Encrypted contract.
econtract: string;
// Signature over the (encrypted) contract.
econtract_sig: EddsaSignature;
// Ephemeral public key for the DH operation to decrypt the encrypted contract.
contract_pub: EddsaPublicKey;
}
interface PurseDeposit {
// Amount to be deposited, can be a fraction of the
// coin's total value.
amount: Amount;
// Hash of denomination RSA key with which the coin is signed.
denom_pub_hash: HashCode;
// Exchange's unblinded RSA signature of the coin.
ub_sig: DenominationSignature;
// Age commitment for the coin, if the denomination is age-restricted.
age_commitment?: AgeCommitment;
// Attestation for the minimum age, if the denomination is age-restricted.
attest?: Attestation;
// Signature over TALER_PurseDepositSignaturePS
// of purpose TALER_SIGNATURE_WALLET_PURSE_DEPOSIT
// made by the customer with the
// coin's private key.
coin_sig: EddsaSignature;
// Public key of the coin being deposited into the purse.
coin_pub: EddsaPublicKey;
}
interface PurseDepositSuccess {
// Total amount deposited into the purse so far (without fees).
total_deposited: Amount;
// Time at the exchange.
exchange_timestamp: Timestamp;
// EdDSA signature of the exchange affirming the payment,
// of purpose TALER_SIGNATURE_PURSE_DEPOSIT_CONFIRMED
// over a TALER_PurseDepositConfirmedSignaturePS.
// Signs over the above and the purse public key and
// the hash of the contract terms.
exchange_sig: EddsaSignature;
// public key used to create the signature.
exchange_pub: EddsaPublicKey;
}
// Union discriminated by the "code" field.
type PurseConflict =
| DepositDoubleSpendError
| PurseCreateConflict
| PurseDepositConflict
| PurseContractConflict;
interface PurseCreateConflict {
// Must be equal to TALER_EC_EXCHANGE_PURSE_CREATE_CONFLICTING_META_DATA
code: Integer;
// Total amount to be merged into the reserve.
// (excludes fees).
amount: Amount;
// Minimum age required for all coins deposited into the purse.
min_age: Integer;
// Indicative time by which the purse should expire
// if it has not been merged into an account. At this
// point, all of the deposits made should be
// auto-refunded.
purse_expiration: Timestamp;
// EdDSA signature of the purse over
// TALER_PurseMergeSignaturePS of
// purpose TALER_SIGNATURE_WALLET_PURSE_MERGE
// confirming that the
// above details hold for this purse.
purse_sig: EddsaSignature;
// SHA-512 hash of the contact of the purse.
h_contract_terms: HashCode;
// EdDSA public key used to approve merges of this purse.
merge_pub: EddsaPublicKey;
}
interface PurseDepositConflict {
// Must be equal to TALER_EC_EXCHANGE_PURSE_DEPOSIT_CONFLICTING_META_DATA
code: Integer;
// Public key of the coin being deposited into the purse.
coin_pub: EddsaPublicKey;
// Signature over TALER_PurseDepositSignaturePS
// of purpose TALER_SIGNATURE_WALLET_PURSE_DEPOSIT
// made by the customer with the
// coin's private key.
coin_sig: EddsaSignature;
// Target exchange URL for the purse. Not present for the
// same exchange.
partner_url?: string;
// Amount to be contributed to the purse by this coin.
amount: Amount;
}
interface PurseContractConflict {
// Must be equal to TALER_EC_EXCHANGE_PURSE_ECONTRACT_CONFLICTING_META_DATA
code: Integer;
// Hash of the encrypted contract.
h_econtract: HashCode;
// Signature over the contract.
econtract_sig: EddsaSignature;
// Ephemeral public key for the DH operation to decrypt the contract.
contract_pub: EddsaPublicKey;
}
DELETE
/purses/$PURSE_PUB
¶Delete a purse that is unmerged and not yet expired. Refunds any money that is already in the purse.
Request:
The request body must be empty, as recommended for HTTP delete in general.
To authorize the request, the header must contain a
Taler-Purse-Signature: $PURSE_SIG
where $PURSE_SIG
is the Crockford base32-encoded
EdDSA signature of purpose TALER_SIGNATURE_WALLET_PURSE_DELETE.
Response:
POST
/purses/$PURSE_PUB/merge
¶Merge purse with account, adding the value of the purse into the account. Endpoint to be used by the receiver of a PUSH payment.
Request:
The request body must be a MergeRequest object.
Response:
Details:
interface MergeRequest {
// payto://-URI of the account the purse is to be merged into.
// Must be of the form: 'payto://taler/$EXCHANGE_URL/$RESERVE_PUB'.
payto_uri: string;
// EdDSA signature of the account/reserve affirming the merge
// over a TALER_AccountMergeSignaturePS.
// Must be of purpose TALER_SIGNATURE_ACCOUNT_MERGE
reserve_sig: EddsaSignature;
// EdDSA signature of the merge private key affirming the merge
// over a TALER_PurseMergeSignaturePS.
// Must be of purpose TALER_SIGNATURE_PURSE_MERGE.
merge_sig: EddsaSignature;
// Client-side timestamp of when the merge request was made.
merge_timestamp: Timestamp;
}
interface MergeSuccess {
// Amount merged (excluding deposit fees).
merge_amount: Amount;
// Time at which the merge came into effect.
// Maximum of the "payment_timestamp" and the
// "merge_timestamp".
exchange_timestamp: Timestamp;
// EdDSA signature of the exchange affirming the merge of
// purpose TALER_SIGNATURE_PURSE_MERGE_SUCCESS
// over TALER_PurseMergeSuccessSignaturePS.
// Signs over the above and the account public key.
exchange_sig: EddsaSignature;
// public key used to create the signature.
exchange_pub: EddsaPublicKey;
}
interface MergeConflict {
// Client-side timestamp of when the merge request was made.
merge_timestamp: Timestamp;
// EdDSA signature of the purse private key affirming the merge
// over a TALER_PurseMergeSignaturePS.
// Must be of purpose TALER_SIGNATURE_PURSE_MERGE.
merge_sig: EddsaSignature;
// Base URL of the exchange receiving the payment, only present
// if the exchange hosting the reserve is not this exchange.
partner_url?: string;
// Public key of the reserve that the purse was merged into.
reserve_pub: EddsaPublicKey;
}
POST
/reserves/$RESERVE_PUB/purse
¶Create purse for an account. First step of a PULL payment.
Request:
The request body must be a ReservePurseRequest object.
Response:
TALER_EC_EXCHANGE_PURSE_CREATE_CONFLICTING_META_DATA
or
TALER_EC_EXCHANGE_PURSE_DEPOSIT_CONFLICTING_META_DATA
or
TALER_EC_EXCHANGE_PURSE_ECONTRACT_CONFLICTING_META_DATA
).
The specific fields of the response depend on the error code
and include the signatures (and what was signed over) proving the
conflict.
The response will be a PurseConflict response
(but not a DepositDoubleSpendError).Details:
interface ReservePurseRequest {
// Minimum amount that must be credited to the reserve, that is
// the total value of the purse minus the deposit fees.
// If the deposit fees are lower, the contribution to the
// reserve can be higher!
purse_value: Amount;
// Minimum age required for all coins deposited into the purse.
min_age: Integer;
// Purse fee the reserve owner is willing to pay
// for the purse creation. Optional, if not present
// the purse is to be created from the purse quota
// of the reserve.
purse_fee: Amount;
// Optional encrypted contract, in case the buyer is
// proposing the contract and thus establishing the
// purse with the payment.
econtract?: EncryptedContract;
// EdDSA public key used to approve merges of this purse.
merge_pub: EddsaPublicKey;
// EdDSA signature of the purse private key affirming the merge
// over a TALER_PurseMergeSignaturePS.
// Must be of purpose TALER_SIGNATURE_PURSE_MERGE.
merge_sig: EddsaSignature;
// EdDSA signature of the account/reserve affirming the merge.
// Must be of purpose TALER_SIGNATURE_WALLET_ACCOUNT_MERGE
reserve_sig: EddsaSignature;
// Purse public key.
purse_pub: EddsaPublicKey;
// EdDSA signature of the purse over
// TALER_PurseRequestSignaturePS of
// purpose TALER_SIGNATURE_PURSE_REQUEST
// confirming that the
// above details hold for this purse.
purse_sig: EddsaSignature;
// SHA-512 hash of the contact of the purse.
h_contract_terms: HashCode;
// Client-side timestamp of when the merge request was made.
merge_timestamp: Timestamp;
// Indicative time by which the purse should expire
// if it has not been paid.
purse_expiration: Timestamp;
}
POST
/purses/$PURSE_PUB/deposit
¶Deposit money into a purse. Used by the buyer for a PULL payment.
Request:
The request body must be a PurseDeposits object.
Response:
TALER_EC_EXCHANGE_GENERIC_INSUFFICIENT_FUNDS
or
TALER_EC_EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY
or
TALER_EC_EXCHANGE_PURSE_DEPOSIT_CONFLICTING_META_DATA
).
This response comes with a standard PurseConflict response
(alas some cases are impossible).Details:
interface PurseDeposits { // Array of coins to deposit into the purse. deposits: PurseDeposit[]; }
interface PurseDeposit {
// Amount to be deposited, can be a fraction of the
// coin's total value.
amount: Amount;
// Hash of denomination RSA key with which the coin is signed.
denom_pub_hash: HashCode;
// Exchange's unblinded RSA signature of the coin.
ub_sig: DenominationSignature;
// Age commitment for the coin, if the denomination is age-restricted.
age_commitment?: AgeCommitment;
// Attestation for the minimum age, if the denomination is age-restricted.
attest?: Attestation;
// Signature over TALER_PurseDepositSignaturePS
// of purpose TALER_SIGNATURE_WALLET_PURSE_DEPOSIT
// made by the customer with the
// coin's private key.
coin_sig: EddsaSignature;
// Public key of the coin being deposited into the purse.
coin_pub: EddsaPublicKey;
}
interface PurseDepositSuccess {
// Total amount paid into the purse.
total_deposited: Amount;
// Total amount expected in the purse.
purse_value_after_fees: Amount;
// Time at which the deposit came into effect.
exchange_timestamp: Timestamp;
// Indicative time by which the purse should expire
// if it has not been merged into an account. At this
// point, all of the deposits made will be auto-refunded.
purse_expiration: Timestamp;
// SHA-512 hash of the contact of the purse.
h_contract_terms: HashCode;
// EdDSA signature of the exchange affirming the payment,
// of purpose TALER_SIGNATURE_PURSE_DEPOSIT_CONFIRMED
// over a TALER_PurseDepositConfirmedSignaturePS.
// Signs over the above and the purse public key and
// the hash of the contract terms.
exchange_sig: EddsaSignature;
// public key used to create the signature.
exchange_pub: EddsaPublicKey;
}
// AgeCommitment is an array of public keys, one for each age group of the
// age-restricted denomination.
type AgeCommitment = Edx25519PublicKey[];
// An attestation for a minimum age is an Edx25519 signature of the age
// with purpose TALER_SIGNATURE_WALLET_AGE_ATTESTATION.
type Attestation = string;
Note
This is a draft API that is not yet implemented.
These endpoints are used to manage exchange-to-exchange payments in support of wallet-to-wallet payments. Only another exchange should access this endpoint.
GET
/wads/$WAD_ID
¶Obtain information about a wad.
Request:
Response:
Details:
interface WadDetails {
// Total transfer amount claimed by the exchange.
total: Amount;
// Indicative time by which the wad was given to the
// bank to execute the wire transfer.
wad_execution_time: Timestamp;
// Transfers aggregated in the wad.
items: WadItem[];
// EdDSA signature of the exchange affirming the wad
// data is correct, must be over TALER_WadDataSignaturePS
// and of purpose TALER_SIGNATURE_WAD_DATA.
exchange_sig: EddsaSignature;
// public key used to create the signature.
exchange_pub: EddsaPublicKey;
}
Objects in the wad item list have the following format:
interface WadItem {
// Amount in the purse.
amount: Amount;
// payto://-URI of the account the purse is to be merged into.
// Must be of the form: 'payto://taler/EXCHANGE_URL/RESERVE_PUB'.
payto_uri: string;
// Purse public key.
purse_pub: EddsaPublicKey;
// Hash of the contract.
h_contract: HashCode;
// Indicative time by which the purse should expire
// if it has not been paid.
purse_expiration: Timestamp;
// Client-side timestamp of when the merge request was made.
merge_timestamp: Timestamp;
// Signature created with the reserve's private key.
// Must be of purpose TALER_SIGNATURE_ACCOUNT_MERGE
// and over TALER_AccountMergeSignaturePS.
reserve_sig: EddsaSignature;
// Signature created with the purse's private key.
// Must be of purpose TALER_SIGNATURE_PURSE_MERGE
// and over TALER_PurseMergeSignaturePS.
purse_sig: EddsaSignature;
// Deposit fees that were charged to the purse.
deposit_fees: Amount;
// Wad fees that was charged to the purse.
wad_fees: Amount;
}
POST
/kyc-wallet
¶Setup KYC identification for a wallet. Returns the KYC UUID.
Request:
The request body must be a WalletKycRequest object.
Response:
Details:
interface WalletKycRequest {
// Balance threshold (not necessarily exact balance)
// to be crossed by the wallet that (may) trigger
// additional KYC requirements.
balance: Amount;
// EdDSA signature of the wallet affirming the
// request, must be of purpose
// TALER_SIGNATURE_WALLET_ACCOUNT_SETUP
reserve_sig: EddsaSignature;
// long-term wallet reserve-account
// public key used to create the signature.
reserve_pub: EddsaPublicKey;
}
interface WalletKycUuid {
// UUID that the wallet should use when initiating
// the KYC check.
requirement_row: number;
// Hash of the payto:// account URI for the wallet.
h_payto: PaytoHash;
}
GET
/kyc-check/$REQUIREMENT_ROW/$H_PAYTO/$USERTYPE
¶Check or update KYC status of a particular payment target.
Returns the current KYC status of the account and, if
negative, returns the URL where the KYC process can be
initiated. The $REQUIREMENT_ROW
must have been
returned previously from an exchange API endpoint that
determined that KYC was needed. The $H_PATYO
must be
the hash of the payto:// URI of the payment target.
The $USERTYPE
states whether the entity to perform
the KYC is an “individual” or “business”.
Request:
timeout_ms
milliseconds if the payment target
is currently not legitimized. Ignored if the payment target
is already legitimized. Note that the legitimization would be
triggered by another request to the same endpoint with a valid
token
.Response:
/kyc-check/
request should be repeated.
The response will be an AccountKycRedirect object.Details:
interface AccountKycStatus {
// Details about the KYC check that the user
// passed.
kyc_details: KycDetails;
// Current time of the exchange, used as part of
// what the exchange signs over.
now: Timestamp;
// EdDSA signature of the exchange affirming the account
// is KYC'ed, must be of purpose
// TALER_SIGNATURE_EXCHANGE_ACCOUNT_SETUP_SUCCESS
// and over TALER_AccountSetupStatusSignaturePS.
exchange_sig: EddsaSignature;
// public key used to create the signature.
exchange_pub: EddsaPublicKey;
}
interface AccountKycRedirect {
// URL that the user should open in a browser to
// proceed with the KYC process.
kyc_url: string;
}
// Object that specifies which KYC checks are satisfied.
interface KycDetails {
// Keys are the names of the check(s).
// The values are for now always empty objects.
}
GET
/kyc-proof/$PROVIDER_SECTION?state=$H_PAYTO
¶Update KYC status of a particular payment target. Provides information to the exchange that allows it to verify that the user has completed the KYC process. The details depend on the logic, which is selected by the $PROVIDER_SECTION.
Request:
Details on the request depend on the specific KYC logic that was used.
If the KYC plugin logic is OAuth 2.0, the query parameters are:
Note
Depending on the OAuth variant used, additional query parameters may need to be passed here.
Response:
GET
/kyc-webhook/$PROVIDER_SECTION/*
¶POST
/kyc-webhook/$PROVIDER_SECTION/*
¶GET
/kyc-webhook/$LOGIC/*
¶POST
/kyc-webhook/$LOGIC/*
¶Update KYC status of a particular payment target. Provides information to the KYC logic of the exchange that allows it to verify that the user has completed the KYC process. May be a GET or a POST request, depending on $LOGIC or $PROVIDER_SECTION.
Request:
Details on the request depend on the specific KYC logic that was used.
Response:
This section describes the reserve control API which can be used to (1) prevent a reserve from expiring (which is useful if the reserve is used for tipping), to (2) pay an annual fee to allow a number of purses to be created for the respective reserve without paying a purse fee each time, to (3) obtain KYC information associated with a reserve to prove the identity of the person sending an invoice to the payer, and to (4) close a reserve before it would naturally expire and possibly (5) wire the funds to a designated account.
Note
This section is about a proposed API. It is not implemented. See also DD 31.
POST
/reserves/$RESERVE_PUB/open
¶Request keeping a reserve open for tipping or invoicing.
Request:
The request body must be a ReserveOpenRequest object.
Response:
TALER_EC_EXCHANGE_GENERIC_INSUFFICIENT_FUNDS
or
TALER_EC_EXCHANGE_GENERIC_COIN_CONFLICTING_DENOMINATION_KEY
or
TALER_EC_EXCHANGE_OPEN_INSUFFICIENT_FUNDS
).
The specific fields of the response depend on the error code
and include the signatures (and what was signed over) proving the
conflict.
The response is WithdrawError object or a DepositDoubleSpendError
depending on the error type.Details:
interface ReserveOpenRequest {
// Signature of purpose
// TALER_SIGNATURE_WALLET_RESERVE_OPEN over
// a TALER_ReserveOpenPS.
reserve_sig: EddsaSignature;
// Array of payments made towards the cost of the
// operation.
payments: OpenPaymentDetail[];
// Amount to be paid from the reserve for this
// operation.
reserve_payment: Amount;
// Time when the client made the request.
// Timestamp must be reasonably close to the time of
// the exchange, otherwise the exchange may reject
// the request (with a status code of 400).
request_timestamp: Timestamp;
// Desired new expiration time for the reserve.
// If the reserve would expire before this time,
// the exchange will charge account fees (and
// possibly KYC fees) until the expiration time
// exceeds this timestamp. Note that the exchange
// will refuse requests (with a status code of 400)
// if the time is so far in the future that the
// fees are not yet known (see /keys).
reserve_expiration: Timestamp;
// Desired open purse limit. Can be used to pay the
// annual account fee more than once to get a larger
// purse limit.
purse_limit: Integer;
}
interface OpenPaymentDetail {
// Contribution of this coin to the overall amount.
// Can be a fraciton of the coin's total value.
amount: Amount;
// Hash of denomination RSA key with which the coin is signed.
denom_pub_hash: HashCode;
// Exchange's unblinded RSA signature of the coin.
ub_sig: DenominationSignature;
// Age commitment for the coin, if the denomination is age-restricted.
age_commitment?: AgeCommitment;
// Signature over TALER_ReserveOpenDepositSignaturePS
// of purpose TALER_SIGNATURE_WALLET_RESERVE_OPEN_DEPOSIT
// made by the customer with the
// coin's private key.
coin_sig: EddsaSignature;
// Public key of the coin being used to pay for
// opening the reserve.
coin_pub: EddsaPublicKey;
}
GET
/reserves-attest/$RESERVE_PUB
¶Request list of available KYC attributes about the owner of a reserve. Used as a preliminary step to find out which subsets of attributes the exchange could provide signatures over.
Response:
Details:
interface ReserveKycAttributes {
// Array of KYC attributes available. The attribute names
// listed are expected to be from the respective GANA
// registry.
details: string[];
}
POST
/reserves-attest/$RESERVE_PUB
¶Request signed KYC information about the owner of a reserve. This can be used by a reserve owner to include a proof of their identity in invoices.
Request:
The request body must be a ReserveAttestRequest object.
Response:
Details:
interface ReserveAttestRequest {
// Signature of purpose
// TALER_SIGNATURE_WALLET_ATTEST_DETAILS over
// a TALER_WalletReserveAttestRequestSignaturePS.
reserve_sig: EddsaSignature;
// Client's time for the request.
request_timestamp: Timestamp;
// Array of KYC attributes requested.
details: string[];
}
interface ReserveAttestResponse {
// Signature of purpose
// TALER_SIGNATURE_EXCHANGE_RESERVE_ATTEST_DETAILS over
// a TALER_ExchangeAttestPS.
exchange_sig: EddsaSignature;
// Exchange public key used to create the
// signature.
exchange_pub: EddsaPublicKey;
// Time when the exchange created the signature.
exchange_timestamp: Timestamp;
// Expiration time for the provided information.
expiration_time: Timestamp;
// KYC details (key-value pairs) as requested.
// The keys will match the elements of the
// details array from the request.
attributes: Object;
}
POST
/reserves/$RESERVE_PUB/close
¶Force immediate closure of a reserve. Does not actually delete the reserve or the KYC data, but merely forces the reserve’s current balance to be wired back to the account where it originated from, or another account of the user’s choosing if they performed the required KYC check and designated another target account.
Request:
The request body must be a ReserveCloseRequest object.
Response:
Details:
interface ReserveCloseRequest {
// Signature of purpose
// TALER_SIGNATURE_WALLET_RESERVE_CLOSE over
// a TALER_ReserveCloseRequestSignaturePS.
reserve_sig: EddsaSignature;
// Time when the client made the request.
// Timestamp must be reasonably close to the time of
// the exchange, otherwise the exchange may reject
// the request (with a status code of 400).
request_timestamp: Timestamp;
// payto://-URI of the account the reserve balance is to be
// wired to. Must be of the form: 'payto://$METHOD' for a
// wire method supported by this exchange (if the
// method is not supported, this is a bad request (400)).
// If not given, the reserve's origin account
// will be used. If no origin account is known for the
// reserve and not given, this is a conflict (409).
payto_uri?: string;
}
interface ReserveCloseResponse {
// Actual amount that will be wired (excludes closing fee).
wire_amount: Amount;
}