JMAP is an open protocol that will replace IMAP when exchanging emails.

Earlier this month on Hacker News actively discussed JMAP Protocol, IETF-led. We decided to talk about why it was needed and how it works.

JMAP is an open protocol that will replace IMAP when exchanging emails.
/ PxHere /PD

What did not please IMAP

Protocol IMAP was introduced in 1986. Many things described in the standard are no longer relevant today. For example, the protocol can return the number of lines of a letter and checksums MD5 - this functionality is practically not used in modern mail clients.

Another problem is related to traffic consumption. In the case of IMAP, emails are stored on the server and periodically synchronized with local clients. If for some reason the copy on the user's device "corrupts", you have to re-sync all the mail. In the modern world, when thousands of mobile devices can be connected to the server, this approach leads to increased consumption of traffic and computing resources.

Difficulties arise not only with the protocol itself, but also with the mail clients that work with it. Since its inception, IMAP has been repeatedly subjected to various revisions - the current version today is IMAP4. At the same time, there are many optional extensions for it - on the network published ninety RFCs with additions. One of the most recent is RFC8514introduced in 2019.

At the same time, many companies offer their own proprietary solutions that should simplify working with IMAP or replace it altogether: gmail, Outlook, nylas. The result is that existing email clients only support a few of the available features. This diversity leads to market segmentation.

β€œMoreover, a modern email client should not only send messages, but be able to work with contacts and synchronize with the calendar,” says Sergey Belkin, head of development at an IaaS provider. 1cloud.ru. - Today, third-party protocols are used for these purposes, like LDAP, CardDAV ΠΈ CalDAV. This approach complicates the configuration of firewalls in corporate networks and opens up new vectors for cyberattacks.”

JMAP is designed to solve the identified problems. It is being developed by FastMail experts under the direction of the Internet Engineering Task Force (IETF). The protocol works on top of HTTPS, uses JSON (for this reason, it is suitable not only for email exchange, but also for solving a number of tasks in the cloud), and simplifies the organization of mail on mobile systems. In addition to processing letters, JMAP also provides the ability to connect extensions for working with contacts and a calendar scheduler.

Features of the new protocol

JMAP is stateless protocol (stateless) and does not require a permanent connection to the mail server. This feature makes it easier to work in unstable mobile networks and saves battery power of devices.

An email in JMAP is represented as a JSON structure. It contains all the information from the message RFC5322 (Internet Message Format), which mail applications may need. According to the developers, this approach should simplify the creation of clients, since for solving potential difficulties (related to MIME, reading headers, and encoding) the server will respond.

The client uses the API to access the server. To do this, it generates an authenticated POST request, the properties of which are described in the JMAP session object. The request is in the application/json format and consists of a single JSON request object. The server also generates one response object.

Π’ spit-up (point 3) the authors provide the following example with a request:

{
  "using": [ "urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail" ],
  "methodCalls": [
    [ "method1", {
      "arg1": "arg1data",
      "arg2": "arg2data"
    }, "c1" ],
    [ "method2", {
      "arg1": "arg1data"
    }, "c2" ],
    [ "method3", {}, "c3" ]
  ]
}

Below is an example of the response that the server will generate:

{
  "methodResponses": [
    [ "method1", {
      "arg1": 3,
      "arg2": "foo"
    }, "c1" ],
    [ "method2", {
      "isBlah": true
    }, "c2" ],
    [ "anotherResponseFromMethod2", {
      "data": 10,
      "yetmoredata": "Hello"
    }, "c2"],
    [ "error", {
      "type":"unknownMethod"
    }, "c3" ]
  ],
  "sessionState": "75128aab4b1b"
}

The complete JMAP specification with implementation examples can be found at the official website project. In the same place, the authors posted a description of the specifications for JMAP Contacts ΠΈ JMAP Calendars - they are aimed at working with calendars and contact lists. By words Authors, Contacts and Calendars have been separated into separate documents so that they can be refined and standardized independently of the β€œcore”. Source codes for JMAP - in repositories on GitHub.

JMAP is an open protocol that will replace IMAP when exchanging emails.
/ PxHere /PD

Prospects

Despite the fact that the work on the standard has not yet been officially completed, it is already being implemented in production environments. For example, the creators of the open mail server Cyrus IMAP implemented its JMAP version. Developers from FastMail released server framework for the new protocol in Perl, and the authors of JMAP presented proxy server.

It can be expected that in the future there will be more and more projects based on JMAP. For example, there is some chance that the developers from Open-Xchange will switch to the new protocol, creating an IMAP server for Linux systems. Refuse IMAP them very community members askformed around the company's tools.

Developers from the IETF and FastMail say more users see a need for a new open standard for messaging. The authors of JMAP hope that more companies will start implementing this protocol in the future.

Our additional resources and sources:

JMAP is an open protocol that will replace IMAP when exchanging emails. How to check cookies for GDPR compliance - a new open tool will help

JMAP is an open protocol that will replace IMAP when exchanging emails. How to save money with the API
JMAP is an open protocol that will replace IMAP when exchanging emails. DevOps in a cloud service using the example of 1cloud.ru
JMAP is an open protocol that will replace IMAP when exchanging emails. The evolution of cloud architecture 1cloud

JMAP is an open protocol that will replace IMAP when exchanging emails. Potential Attacks on HTTPS and How to Protect Against Them
JMAP is an open protocol that will replace IMAP when exchanging emails. How to protect a server on the Internet: 1cloud.ru experience
JMAP is an open protocol that will replace IMAP when exchanging emails. Short educational program: what is Continuous Integration

Source: habr.com

Add a comment