పేరు సర్వర్ ప్రోటోకాల్
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).
పేరు ఫార్మాటింగ్ నియమాలు
వినియోగదారు పేర్లను ఒక రెజిఎక్స్ తనిఖీ చేస్తుంది, దీని ద్వారా వాటి ఆకృతి గురించి కొన్ని నియమాలు నిర్ధారించబడతాయిః
పొడవు 3 నుంచి 32 అక్షరాల మధ్య ఉండాలి
Those characters must be alphanumerical with dashes
-being also accepted.
ఒక పేరును అడుగుతూ
ఇది పేరు సర్వర్ అందించే ప్రధాన సేవ. ఇది ఒక వినియోగదారు పేరుకు అనుగుణంగా ఉన్న జామి 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 సమాధానం ఇలా ఉంటుందిః
{
"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 పేరును నమోదు చేయడానికి ఒక అభ్యర్థన POST ఉంది. దీనిలో /name/foobar URI గా ఉంటుంది. శీర్షిక లక్షణం Content-type ను application/json గా సెట్ చేయాలి.
అభ్యర్థన యొక్క శరీరం 2 స్ట్రింగ్ లక్షణాలతో ఒక JSON పత్రం: addr మరియు owner. addr. addr. 0x తో ముందే ఉన్న Jami ID ని కలిగి ఉంది మరియు 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 బూలియన్ అట్రిబ్యూట్ success తో JSON డాక్యుమెంట్ ఉంది.
ఉదాహరణగాః
{
"success":true
}
పేరు లేదా చిరునామాను ప్రశ్నించడానికి తదుపరి ప్రయత్నాలు విజయవంతం కావాలి.
Response register (Bad request)
If the registration is unable to 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"
}
కొన్ని లింకులు
jami-nameservice:ns.jami.netఉపయోగించే మరియు Ethereum నోడ్ ప్రశ్నలు నోడ్JS అమలు సూచన.