名前 サーバープロトコル

The protocol used by Jami to query and register a name is based on an HTTP REST API answering requests with JSON documents and regular HTTP status codes.

The public name server is hosted at ns.jami.net. Another implementation could use any other database or directory service making the name server protocol reusable.

If you run your own name server, looking up a username in the form of username@example.com will look up the name username with the name server at example.com (there is no need to add @ns.jami.net to use the default name server).

名前格式化に関する規則

ユーザー名は,その形式に関するいくつかの規則を確認するために,Regexによってチェックされます.

  • 長さは3から32文字の間のものでなければならない.

  • Those characters must be alphanumerical with dashes - being also accepted.

名前を探している

これは名前サーバーが提供する主なサービスです. ユーザー名に対応するJami IDを取得できます.

Request name

A request for the name foobar is a GET request with /name/foobar* as the URI.

Response name (Success)

If the name is found, a response with status code 200 OK must be sent to the client with a Content-type field set as application/json.

The body is a JSON documents with 2 string attributes : name and addr. name is equal to the one requested and addr is a hexadecimal representation of the Jami ID prefixed with 0x.

JSON の答えは

{
    "name":"foobar",
    "addr":"0x29347542eb07159f316577e1ae16243d152f6b7b"
}

Response name (Not found)

If the name is not found, a response with status code 404 Not Found must be sent to the client with a Content-type field set as application/json.

文字体は JSON ドキュメントで,1 文字列属性である: error. この属性はエラーを説明するエラーメッセージで埋め込まれています (将来クライアントで表示される可能性があります).

参照実施について,返却された文書は:

{
    "error":"name not registred"
}

アドレスを検索する

このサービスは逆の検索です. 名前サーバーに登録されている場合はアドレスを尋ねてユーザー名が返されます.

Request address

A request for the ID jami:29347542eb07159f316577e1ae16243d152f6b7b is a GET request with /addr/29347542eb07159f316577e1ae16243d152f6b7b as the URI.

Response address (Success)

If the address corresponds to a username, a response with status code 200 OK must be sent to the client with a Content-type field set as application/json.

文字体は JSON ドキュメントで 1 文字列属性である: name. このフィールドの値は,このアドレスに登録された名前です

JSON の答えは

{
    "name":"foobar"
}

Response address (Not found)

If the address is not found, a response with status code 404 Not Found must be sent to the client with a Content-type field set as application/json.

文字体は JSON ドキュメントで,1 文字列属性である: error. この属性はエラーを説明するエラーメッセージで埋め込まれています (将来クライアントで表示される可能性があります).

参照実施について,返却された文書は:

{
    "error":"address not registred"
}

名前登録

このプロトコルのこの部分は新しい名前/アドレスペアを登録するために使用されます. 主な公共登録書で使用されますが,カスタム実装ではオプションかもしれません.

Request register

foobarという名前を登録する要請は, URIとして /name/*foobar*を入力した POSTの要請である.ヘッダー属性 Content-typeは, application/jsonに設定しなければならない.

ヽaddrowner. addrは,登録される名前である0x` と前記された Jami ID を含む.

foobarの例は,次のとおりです.

{
    "addr":"0x29347542eb07159f316577e1ae16243d152f6b7b",
    "owner":"foobar"
}

Response register (Success)

If the name/address pair is successfully registered, a response with status code 200 OK must be sent to the client with a Content-type field set as application/json.

体は 1 の boolean successtrue に設定した JSON ドキュメントを含んでいます.

例として

{
    "success":true
}

名前や住所を問い合わせるさらなる試みは成功する.

Response register (Bad request)

If the registration cannot be achieved because of an error in the request (formatting, missing attribute, etc.), a response with status code 400 Bad Request must be sent to the client with a Content-type field set as application/json.

体は2つの属性を持つ JSON 文書である: successが boolean と errorが文字列である. successは, falseerrorに設定され,エラーを説明するエラーメッセージが記入されている (将来クライアントで表示される可能性があります).

ユーザ名の不正なフォーマットの場合,そのボディは:

{
    "success": false,
    "error": "invalid name"
}

Response register (Forbidden)

If the registration cannot be achieved because the name is already taken, a response with status code 403 Forbidden must be sent to the client with a Content-type field set as application/json.

体は3つの属性を持つ JSON ドキュメントである: success これは元々のリクエストから複製された文字列である false, name, addr の boolean setです.

foobarを登録すると,すでに登録されている場合,次の反応が起こるでしょう.

{
    "success": false,
    "name":"foobar",
    "addr":"0x29347542eb07159fdeadbeefae16243d152f6b7b"
}