이름 서버 프로토콜
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
로 설정되어야 합니다.
요청의 몸체는 2 문자열 속성 (addr
및 owner
) 을 가진 JSON 문서입니다. addr
에는 Jami ID가 0x
와 앞장서고, owner
가 등록해야 할 이름입니다.
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 속성 success
를 true
로 설정한 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
는 false
로 설정되어 있으며 error
는 오류를 설명하는 오류 메시지로 채워집니다 (그리고 향후 클라이언트에서 표시될 수 있습니다).
사용자 이름의 무효 포맷을 위해, 신체는 다음과 같습니다:
{
"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"
}
몇 가지 링크
jami-nameservice
:ns.jami.net
에서 사용하는 참고 NodeJS 구현 및 Ethereum 노드를 쿼리하는