070-alias-directory-mailbox.rst (14083B)
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 URI, see :ref:`Alias Management <dd-70 -us-alias-mgmt>`. 181 182 **Technical Note**: The wallet periodically performs lookups for contacts where their Taldir registrations have expired and refresh accordingly. 183 184 Send Money 185 ---------- 186 187 Prerequisites: Alice has installed Taler Wallet, Alice has registered an Alias. 188 189 Bob wants to directly send money to Alice (e.g. PayPal style). 190 He opens his Taler wallet and opens ``Taler Button->Send``. 191 A screen that allows to create a payment offer is shown to Bob. 192 Once Bob has entered all necessary details, the payment offer is created and the screen with the QR code is shown. 193 There, he selects the *Send to Contact*. 194 The *Send to Contact* screen consists of a search input and an Alias type selector. 195 This screen now also allows to send the request to a contact by using the contact list. 196 Bob selects *Send to Contact*. 197 The *Send to Contact* screen brings up the contacts list to select a contact. 198 199 **Note**: At this point, Bob may now also import a contact here ad-hoc, see :ref:`Contacts Management <dd-70-us-contacts-mgmt>`. 200 201 Bob selects the contact and the payment offer is sent to Alice. 202 203 **Technical Note**: The offer is sent to Alice's Mailbox URI through the :ref:`Mailbox API <api-mailbox>`. 204 205 This request may fail, for example if Alice's Mailbox is full. 206 207 **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. 208 209 Resend Payment Request 210 ---------------------- 211 212 Prerequisites: Bos has already sent a payment request to Alice 213 214 Bob may want to resend a payment request if it expired or if Alice lost the request. 215 216 **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. 217 218 Bob opens the open payment request and selects the contact to send it to again. 219 220 **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. 221 222 223 Open Questions 224 ============== 225 226 227 Proposed Solution 228 ================= 229 230 The directory and mailbox services will be implemented as two distinct services. 231 Both with have an open REST API which will be specified as part of the protocol. 232 233 Directory 234 --------- 235 236 The directory will support an extensible interface for alias *validators*. 237 Validators will ensure that users that want to register mailbox URIs under an alias 238 are actually the owner/in control over the particular alias. 239 For example, in order to use an email address as the alias a verification link will be 240 sent to that address and the user needs to confirm registration. 241 242 In addition to the REST API, the directory will support an extensible interface for 243 alias *disseminators*. 244 Disseminators will publish the alias-mailbox mapping. 245 For example, DNS or GNS validators will publish the mappings under zones of the operator. 246 247 Mailbox 248 ------- 249 250 Messages are retuned from the API with a fixed length. 251 The configured messages length must be obtained through the 252 mailbox service configuration endpoint. 253 The first two bytes of the message are 16 bit unsigned integers 254 in network byte order that specify the message type. 255 The remaining bytes contain the encrypted message (including the MAC). 256 Messages are encrypted using HPKE (X25519 with ChaChaPoly1305 as AEAD). 257 Currently, there is only a single message type that carries a taler URI as payload. 258 This type is identified by the bytes ``0x00 0x00``. 259 This message type number is in network byte order prefixed before the HPKE ciphertext. 260 The HPKE ciphertext starts with a 32 byte 261 encapsulation followed by the encrypted URI. 262 The encrypted URI is followed by a 16 byte MAC. 263 The message type is part of the MAC (the additional data portion of the AEAD scheme). 264 265 Wire format MailboxMessage: 266 267 .. _MailboxMessage: 268 .. ts:def:: MailboxMessage 269 270 type MailboxMessage = (PaymentInvoiceMessage | MoneyTransferMessage) & MailboxMessageCommon 271 272 273 .. _PaymentInvoiceMessage: 274 .. ts:def:: PaymentInvoiceMessage 275 276 interface PaymentInvoiceMessage { 277 // Message type 278 type: "payment-invoice"; 279 280 // Pay pull URI. 281 payPullUri: string; 282 283 284 } 285 286 .. _MoneyTransferMessage: 287 .. ts:def:: MoneyTransferMessage 288 289 interface MoneyTransferMessage { 290 // Message type 291 type: "money-transfer"; 292 293 // Pay push URI. 294 payPushUri: string; 295 296 297 } 298 299 .. ts:def:: MailboxMessageCommon 300 301 interface MailboxMessageCommon { 302 // Message type 303 messageType: string; 304 305 // Message identifier 306 messageId: string; 307 308 // Freeform text from sender. 309 senderHint: string; 310 311 } 312 313 Definition of Done 314 ================== 315 316 (Only applicable to design documents that describe a new feature. While the 317 DoD is not satisfied yet, a user-facing feature **must** be behind a feature 318 flag or dev-mode flag.) 319 320 - :ref:`Taldir API <api-taldir>` implemented and deployed with at least SMS and Email validators. (DONE) 321 - :ref:`Mailbox API <api-mailbox>` implemented and deployed. 322 - Wallet functionality to support user stories implemented. 323 324 Alternatives 325 ============ 326 327 Drawbacks 328 ========= 329 330 Discussion / Q&A 331 ================ 332 333 (This should be filled in with results from discussions on mailing lists / personal communication.)