பெயர் சேவையக நெறிமுறை

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.

ஒரு பெயரைக் கேட்பது

இது ஒரு பெயர் சேவையகத்தால் வழங்கப்படும் முக்கிய சேவை ஆகும். இது ஒரு பயனர்பெயருக்கு பொருத்தமான ஜாமி ஐடி பெற உதவுகிறது.

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 string பண்பு உள்ளதுஃ 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 string பண்பு உள்ளதுஃ 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 string பண்பு உள்ளதுஃ error. இந்த பண்பு ஒரு பிழை செய்தியுடன் நிரம்பியுள்ளது, இது பிழையை விளக்குகிறது (அது எதிர்காலத்தில் கிளையண்டில் காண்பிக்கப்படலாம்).

குறிப்புச் செயல்பாட்டைப் பற்றி, திருப்பித் தரப்பட்ட ஆவணம் பின்வருமாறுஃ

{
    "error":"address not registred"
}

பெயரை பதிவு செய்தல்

இந்த நெறிமுறையின் இந்த பகுதி ஒரு புதிய பெயர் / முகவரி ஜோடியை பதிவு செய்யப் பயன்படுகிறது. இது முக்கிய பொது பதிவேட்டில் பயன்படுத்தப்படுகிறது, ஆனால் தனிப்பயன் செயல்படுத்தலில் விருப்பமாக இருக்கலாம்.

Request register

foobar என்ற பெயரை பதிவு செய்ய கோரிக்கை என்பது POST கோரிக்கை ஆகும். /name/foobar என்ற URI என அழைக்கப்படுகிறது. தலைப்பு பண்பு Content-type ` என அமைக்கப்பட வேண்டும்.

கோரிக்கையின் உடல் இரண்டு வரிசையில் உள்ள JSON ஆவணமாகும்: addr மற்றும் owner. addr. addr. 0x மற்றும் owner என முனையம் கொண்ட 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 பூலியன் பண்பு 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 இது ஒரு பூலியன் மற்றும் 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 ஆகியவற்றிற்கான ஒரு பூலியன் தொகுப்பாகும்.

foobar பதிவு செய்தால், அது ஏற்கனவே பதிவு செய்யப்பட்டு விட்டால், பின்வரும் பதிலைக் கொண்டு வரும்ஃ

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