070-alias-directory-mailbox.rst (14081B)
1 DD 70: Alias Lookup and Mailbox 2 ############################### 3 4 Summary 5 ======= 6 7 GNU Taler is a payment system that makes privacy-contactly online transactions 8 fast and easy. 9 This project will facilitate the support of peer-to-peer payments (P2P) for the 10 GNU Taler payment system between users by implementing a privacy-contactly 11 directory service and lightweight inbox service (TALer DIRectory). 12 The services will allow users to securely associate their 13 online identities (such as email addresses, phone numbers, X/Twitter/Mastodon handles or other suitable verifiable addresses and accounts) with their wallet 14 public keys and the URL of an inbox service and use it for P2P payments. 15 Storage and retrieval may also be offloaded to distributed directory services 16 such as DNS or GNS (RFC 9498) instead of a database 17 and web service while maintaining the respective privacy guarantees. 18 19 Motivation 20 ========== 21 22 The Digital Euro is currently in development and as a part of it the 23 so-called "Alias Lookup Service" is being developed for at least 24 28 Millon Euros (Tender "PRO-009485"). 25 26 To enable peer-to-peer payments for the GNU Taler payment system 27 between users such a directory service and lightweight inbox service are also required. 28 We believe that the estimated development costs from the ECB tender 29 are unreasonably and unexplicably high. We can demostrate how an efficient, 30 privacy-contactly and lean service that offers this kind of functionality can be 31 developed within this proposal at a fraction of the cost of the 32 "Alias Lookup Service": 33 34 The directory service will allow users to securely associate their 35 online identities (such as email addresses, phone numbers, X/Twitter/Mastodon handles or other suitable verifiable addresses and accounts) with their wallet 36 public keys and the URL of an inbox service. 37 Additionally we found that storage and retrieval may also be offloaded to distributed directory services such as DNS or GNS (RFC 9498) instead of a database 38 and web service while maintaining the respective privacy guarantees. 39 We have added such a task to the estimate. 40 41 In order to facilitate fund transfers in the P2P context, we 42 will extend the Taler wallet (in particular, the browser-based 43 WebExtension) to allow users to associate the wallet with one or more 44 (wallet) addresses, to query the directory to send money or invoices, to 45 encrypt the payment messages to the public key obtained from the 46 directory, to transmit the message via the lightweight inbox service, 47 and to poll the inbox service for incoming requests and show them to 48 the user. 49 Both the key directory service and the inbox service may provide their 50 services for a fee to compensate the operator for operational costs 51 including the validation of addresses. 52 53 Requirements 54 ============ 55 56 The implementation must take great care to ensure the privacy and 57 integrity of the mappings from the identity to the wallet keys. 58 For this, plain text identity information such as email addresses should 59 only be processed as part of the validation and registration processes. 60 The actual mappings will be indexed using salted hashes. 61 62 Queries for wallet keys also should require the caller to provide the 63 already hashed identity to minimize data leakage from requests. 64 65 This minimizes the handling of personally identifyable information (PII) 66 at the service and limits exposure in case of data leaks at the operator. 67 68 The service must be suitable to be operated at very high availability constraints. 69 As such, the service must be scalable and ideally have a small footprint and 70 computing base. 71 72 User Stories 73 ============ 74 75 Both the Mailbox server URI and the Taldir server URI have hard-coded defaults that can be overriden in expert settings. 76 In the user stories, we use the placeholders ``$MAILBOX_SERVER`` and 77 ``$TALDIR_SERVER`` for those URIs. 78 79 Alias Registration 80 ------------------ 81 82 Prerequisites: Alice has installed Taler Wallet 83 84 Alice opens the Taler Wallet and browses to ``Settings -> Aliases``. 85 The interface offers registration of any Alias type supported by the Taldir instance through 86 a ``+`` button and suitable follow-up screens. 87 88 **Technical Note**: Alice registers an Alias with the Mailbox URI that corresponds to her Wallet ID (See also :ref:`Mailbox API <api-mailbox>`). The interface does not require Alice to input the URI manually, the Wallet can synthesize the Mailbox URI from an address: ``$MAILBOX_SERVER/SHA512(WalletPublicKey)``. 89 90 91 **Technical Note**: Supported alias types are found in the ``$TALDIR_SERVER/config`` endpoint. 92 93 94 Alice chooses an alias type and is then prompted to provide her type-specific alias, e.g. *alice@example.com* would be an alias of type *email*. 95 This initiates the Alias validation procedure. 96 97 **Technical Note**: This initiates the alias registration flow provided in :ref:`Taldir API <api-taldir>`. 98 99 The registration procedure may succeed or fail. 100 Alice may retry on failure to register the same Alias. 101 Alice may also register other Aliases. 102 103 .. _dd-70-us-alias-mgmt: 104 105 Alias Management 106 ---------------- 107 108 Prerequisites: Alice has registered one or more aliases 109 110 Alice opens ``Settings -> Aliases`` to manage her aliases. 111 The UI shows all registered aliases with expiration times. 112 The UI allows Alice to delete registrations (or disable auto-renewal) and renew a registration pre-emptively before it expires. 113 Alice may use this screen to display a QR code (an ``add-contact`` Taler URI) of her own contact, see also :ref:`Contacts Management <dd-70-us-contacts-mgmt>`. 114 115 This may require separation into two or three stories. 116 117 Send Payment Request 118 -------------------- 119 120 Prerequisites: Bob has installed Taler Wallet, Bob knows one of Alice's aliases 121 122 Bob wants to request money from Alice. 123 He opens his Taler wallet and opens ``Taler Button->Receive`` screen from the menu. 124 A screen that allows to create a payment request is shown to Bob. 125 Once Bob has entered all necessary details, a payment request (:ref:`DD 13 <dd-13>`) is 126 created and the screen with QR code is shown. 127 This screen now also allows to send the request to a contact by using the contact list. 128 The *Request from Contact* screen brings up the contacts list to select a contact. 129 (Optional): Bob may also import a contact here ad-hoc, see :ref:`Contacts Management <dd-70-us-contacts-mgmt>`. 130 Bob selects the contact and the request is sent to Alice. 131 132 **Technical Note**: This will trigger the wallet to send the payment request to Alice's Mailbox URI through the :ref:`Mailbox API <api-mailbox>`. 133 134 The request may fail, for example if Alice's Mailbox is full. 135 136 **Note**: Sending messages via Mailbox API may incur fees. 137 138 139 Receive Payment Request 140 ----------------------- 141 142 Prerequisites: Alice has installed Taler Wallet, Alice has registered an Alias, Bob has sent a payment request. 143 144 **Technical Note**: The Wallet periodically checks Mailboxes using the :ref:`Mailbox API <api-mailbox>` for new payment requests and downloads the messages locally. Remote messages are deleted after download. 145 146 147 The new payment request by Bob is received by the Wallet and it notifies Alice. 148 149 **Technical Note**: Notice request is *NEW*. This requires requests to have unique IDs. Also, maybe notifications should happen even if the ID is already seen, but the message is new. 150 151 Alice interacts with the notification or manually browses to ``Settings->Mailbox``. 152 153 There, the wallet provides a screen with payment request overviews (e.g. list of messages 154 in the local mailbox). 155 Alice selects Bob's payment request either through the notification or from the list 156 of payment requests. 157 The messages contain Taler URIs, so the application may simply offer to process the respective 158 URI as is usually done. 159 160 **Note**: When are local messages deleted? 161 162 .. _dd-70-us-contacts-mgmt: 163 164 Contacts Management 165 ------------------- 166 167 Prerequisites: Alice has installed Taler Wallet 168 169 Alice opens ``Settings->Contacts``. 170 The list of contacts is empty in the beggining. 171 There is a button to *Add a contact* which opens a UI. 172 The UI consists of a search input and an Alias type selector. 173 Alice selects the Alias type (e.g. GitHub or Email) and inputs a contacts Alias. 174 175 **Technical Note**: This will initiate a lookup request using the :ref:`Taldir API <api-taldir>`. 176 177 If no results were found, Alice cannot import this contact. 178 If found, Alice will be able to import this contact into the contact list. 179 180 Alternatively, the contact can also be imported using an ``add-contact`` Taler 181 URI, see :ref:`Alias Management <dd-70-us-alias-mgmt>`. 182 183 **Technical Note**: The wallet periodically performs lookups for contacts where their Taldir registrations have expired and refresh accordingly. 184 185 Send Money 186 ---------- 187 188 Prerequisites: Alice has installed Taler Wallet, Alice has registered an Alias. 189 190 Bob wants to directly send money to Alice (e.g. PayPal style). 191 He opens his Taler wallet and opens ``Taler Button->Send``. 192 A screen that allows to create a payment offer is shown to Bob. 193 Once Bob has entered all necessary details, the payment offer is created and the screen with the QR code is shown. 194 There, he selects the *Send to Contact*. 195 The *Send to Contact* screen consists of a search input and an Alias type selector. 196 This screen now also allows to send the request to a contact by using the contact list. 197 Bob selects *Send to Contact*. 198 The *Send to Contact* screen brings up the contacts list to select a contact. 199 200 **Note**: At this point, Bob may now also import a contact here ad-hoc, see :ref:`Contacts Management <dd-70-us-contacts-mgmt>`. 201 202 Bob selects the contact and the payment offer is sent to Alice. 203 204 **Technical Note**: The offer is sent to Alice's Mailbox URI through the :ref:`Mailbox API <api-mailbox>`. 205 206 This request may fail, for example if Alice's Mailbox is full. 207 208 **Note**: Sending messages via Mailbox API may incur fees. So does creating a purse in the offer. This should probably be done in a single user action. 209 210 Resend Payment Request 211 ---------------------- 212 213 Prerequisites: Bos has already sent a payment request to Alice 214 215 Bob may want to resend a payment request if it expired or if Alice lost the request. 216 217 **Technical Note**: This does not mean that the request can get lost in transit. It means that it is possible that Alice lost her phone and needed to setup her Wallet again. 218 219 Bob opens the open payment request and selects the contact to send it to again. 220 221 **Technical Note**: This likely implies the creation of a new payment request, with the same detail of the already sent request. Sending the same request again is probably not a good idea. This, however, requires a new field to the contract terms (``idempotency_nonce``?) that we keep identical between both requests. That way, the receiving wallet can detect that it is a duplicate and act accordingly --- if already paid, ignore, if hard-rejected/banned ignore, and if merely expired show again. 222 223 224 Open Questions 225 ============== 226 227 228 Proposed Solution 229 ================= 230 231 The directory and mailbox services will be implemented as two distinct services. 232 Both with have an open REST API which will be specified as part of the protocol. 233 234 Directory 235 --------- 236 237 The directory will support an extensible interface for alias *validators*. 238 Validators will ensure that users that want to register mailbox URIs under an alias 239 are actually the owner/in control over the particular alias. 240 For example, in order to use an email address as the alias a verification link will be 241 sent to that address and the user needs to confirm registration. 242 243 In addition to the REST API, the directory will support an extensible interface for 244 alias *disseminators*. 245 Disseminators will publish the alias-mailbox mapping. 246 For example, DNS or GNS validators will publish the mappings under zones of the operator. 247 248 Mailbox 249 ------- 250 251 Messages are retuned from the API with a fixed length. 252 The configured messages length must be obtained through the 253 mailbox service configuration endpoint. 254 The first two bytes of the message are 16 bit unsigned integers 255 in network byte order that specify the message type. 256 The remaining bytes contain the encrypted message (including the MAC). 257 Messages are encrypted using HPKE (X25519 with ChaChaPoly1305 as AEAD). 258 Currently, there is only a single message type that carries a taler URI as payload. 259 This type is identified by the bytes ``0x00 0x00``. 260 This message type number is in network byte order prefixed before the HPKE ciphertext. 261 The HPKE ciphertext starts with a 32 byte 262 encapsulation followed by the encrypted URI. 263 The encrypted URI is followed by a 16 byte MAC. 264 The message type is part of the MAC (the additional data portion of the AEAD scheme). 265 266 Wire format MailboxMessage: 267 268 .. _MailboxMessage: 269 .. ts:def:: MailboxMessage 270 271 type MailboxMessage = (PaymentInvoiceMessage | MoneyTransferMessage) & MailboxMessageCommon 272 273 274 .. _PaymentInvoiceMessage: 275 .. ts:def:: PaymentInvoiceMessage 276 277 interface PaymentInvoiceMessage { 278 // Message type 279 type: "payment-invoice"; 280 281 // Pay pull URI. 282 payPullUri: string; 283 284 285 } 286 287 .. _MoneyTransferMessage: 288 .. ts:def:: MoneyTransferMessage 289 290 interface MoneyTransferMessage { 291 // Message type 292 type: "money-transfer"; 293 294 // Pay push URI. 295 payPushUri: string; 296 297 298 } 299 300 .. ts:def:: MailboxMessageCommon 301 302 interface MailboxMessageCommon { 303 // Message type 304 messageType: string; 305 306 // Message identifier 307 messageId: string; 308 309 // Freeform text from sender. 310 senderHint: string; 311 312 } 313 314 Definition of Done 315 ================== 316 317 (Only applicable to design documents that describe a new feature. While the 318 DoD is not satisfied yet, a user-facing feature **must** be behind a feature 319 flag or dev-mode flag.) 320 321 - :ref:`Taldir API <api-taldir>` implemented and deployed with at least SMS and Email validators. (DONE) 322 - :ref:`Mailbox API <api-mailbox>` implemented and deployed. 323 - Wallet functionality to support user stories implemented. 324 325 Alternatives 326 ============ 327 328 Drawbacks 329 ========= 330 331 Discussion / Q&A 332 ================ 333 334 (This should be filled in with results from discussions on mailing lists / personal communication.)