Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
typescript
duniter
Commits
7af562d9
Commit
7af562d9
authored
9 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
Fix
#236
better know identity informations
parent
9e496e0d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/controllers/wot.js
+31
-3
31 additions, 3 deletions
app/controllers/wot.js
app/lib/streams/bma.js
+1
-1
1 addition, 1 deletion
app/lib/streams/bma.js
doc/HTTP_API.md
+28
-0
28 additions, 0 deletions
doc/HTTP_API.md
with
60 additions
and
4 deletions
app/controllers/wot.js
+
31
−
3
View file @
7af562d9
"
use strict
"
;
var
co
=
require
(
'
co
'
);
var
util
=
require
(
'
util
'
);
var
async
=
require
(
'
async
'
);
var
_
=
require
(
'
underscore
'
);
var
Q
=
require
(
'
q
'
);
var
stream
=
require
(
'
stream
'
);
var
unix2dos
=
require
(
'
../lib/unix2dos
'
);
var
moment
=
require
(
'
moment
'
);
var
dos2unix
=
require
(
'
../lib/dos2unix
'
);
var
http2raw
=
require
(
'
../lib/streams/parsers/http2raw
'
);
var
jsoner
=
require
(
'
../lib/streams/jsoner
'
);
...
...
@@ -122,6 +120,7 @@ function WOTBinding (server) {
if
(
certifier
)
{
cert
.
uid
=
certifier
.
uid
;
cert
.
isMember
=
certifier
.
member
;
cert
.
sigDate
=
moment
(
certifier
.
time
).
unix
();
cert
.
wasMember
=
true
;
// As we checked if(certified)
if
(
!
cert
.
cert_time
)
{
// TODO: would be more efficient to save medianTime on certification reception
...
...
@@ -138,6 +137,7 @@ function WOTBinding (server) {
var
json
=
{
pubkey
:
idty
.
pubkey
,
uid
:
idty
.
uid
,
sigDate
:
moment
(
idty
.
time
).
unix
(),
isMember
:
idty
.
member
,
certifications
:
[]
};
...
...
@@ -148,6 +148,7 @@ function WOTBinding (server) {
isMember
:
cert
.
isMember
,
wasMember
:
cert
.
wasMember
,
cert_time
:
cert
.
cert_time
,
sigDate
:
cert
.
sigDate
,
written
:
cert
.
linked
?
{
number
:
cert
.
written_block
,
hash
:
cert
.
written_hash
...
...
@@ -231,6 +232,7 @@ function WOTBinding (server) {
if
(
certified
)
{
cert
.
uid
=
certified
.
uid
;
cert
.
isMember
=
certified
.
member
;
cert
.
sigDate
=
moment
(
certified
.
time
).
unix
();
cert
.
wasMember
=
true
;
// As we checked if(certified)
if
(
!
cert
.
cert_time
)
{
// TODO: would be more efficient to save medianTime on certification reception
...
...
@@ -247,6 +249,7 @@ function WOTBinding (server) {
var
json
=
{
pubkey
:
idty
.
pubkey
,
uid
:
idty
.
uid
,
sigDate
:
moment
(
idty
.
time
).
unix
(),
isMember
:
idty
.
member
,
certifications
:
[]
};
...
...
@@ -257,6 +260,7 @@ function WOTBinding (server) {
isMember
:
cert
.
isMember
,
wasMember
:
cert
.
wasMember
,
cert_time
:
cert
.
cert_time
,
sigDate
:
cert
.
sigDate
,
written
:
cert
.
linked
?
{
number
:
cert
.
written_block
,
hash
:
cert
.
written_hash
...
...
@@ -275,6 +279,30 @@ function WOTBinding (server) {
});
};
this
.
identityOf
=
function
(
req
,
res
)
{
res
.
type
(
'
application/json
'
);
return
co
(
function
*
()
{
try
{
let
search
=
yield
ParametersService
.
getSearchP
(
req
);
let
idty
=
yield
IdentityService
.
findMemberWithoutMemberships
(
search
);
if
(
!
idty
)
{
throw
'
Identity not found
'
;
}
if
(
!
idty
.
member
)
{
throw
'
Not a member
'
;
}
var
json
=
{
pubkey
:
idty
.
pubkey
,
uid
:
idty
.
uid
,
sigDate
:
moment
(
idty
.
time
).
unix
()
};
res
.
send
(
200
,
JSON
.
stringify
(
json
,
null
,
"
"
));
}
catch
(
e
)
{
res
.
send
(
400
,
e
);
}
});
};
this
.
add
=
function
(
req
,
res
)
{
res
.
type
(
'
application/json
'
);
var
onError
=
http400
(
res
);
...
...
This diff is collapsed.
Click to expand it.
app/lib/streams/bma.js
+
1
−
1
View file @
7af562d9
var
http
=
require
(
'
http
'
);
var
express
=
require
(
'
express
'
);
var
async
=
require
(
'
async
'
);
var
log4js
=
require
(
'
log4js
'
);
var
co
=
require
(
'
co
'
);
var
Q
=
require
(
'
q
'
);
...
...
@@ -93,6 +92,7 @@ module.exports = function(server, interfaces, httpLogs) {
answerForGet
(
'
/wot/requirements/:pubkey
'
,
wot
.
requirements
);
answerForGet
(
'
/wot/certifiers-of/:search
'
,
wot
.
certifiersOf
);
answerForGet
(
'
/wot/certified-by/:search
'
,
wot
.
certifiedBy
);
answerForGet
(
'
/wot/identity-of/:search
'
,
wot
.
identityOf
);
var
transactions
=
require
(
'
../../controllers/transactions
'
)(
server
);
var
dividend
=
require
(
'
../../controllers/uds
'
)(
server
);
...
...
This diff is collapsed.
Click to expand it.
doc/HTTP_API.md
+
28
−
0
View file @
7af562d9
...
...
@@ -465,6 +465,7 @@ Each certification also has:
"pubkey"
:
"HsLShAtzXTVxeUtQd7yi5Z5Zh4zNvbu8sTEZ53nfKcqY"
,
"uid"
:
"user identifier"
,
"isMember"
:
true
,
sigDate:
1421787461
,
"certifications"
:
[
{
"pubkey"
:
"9WYHTavL1pmhunFCzUwiiq4pXwvgGG5ysjZnjz9H8yB"
,
...
...
@@ -473,6 +474,7 @@ Each certification also has:
"block"
:
88
,
"medianTime"
:
1509991044
},
sigDate:
1421787461
,
"written"
:
{
"number"
:
872768
,
"hash"
:
"D30978C9D6C5A348A8188603F039423D90E50DC5"
...
...
@@ -511,6 +513,7 @@ Each certification also has:
"pubkey"
:
"HsLShAtzXTVxeUtQd7yi5Z5Zh4zNvbu8sTEZ53nfKcqY"
,
"uid"
:
"user identifier"
,
"isMember"
:
true
,
sigDate:
1421787461
,
"certifications"
:
[
{
"pubkey"
:
"9WYHTavL1pmhunFCzUwiiq4pXwvgGG5ysjZnjz9H8yB"
,
...
...
@@ -519,6 +522,7 @@ Each certification also has:
"block"
:
88
,
"medianTime"
:
1509991044
},
sigDate:
1421787461
,
"written"
:
{
"number"
:
872768
,
"hash"
:
"D30978C9D6C5A348A8188603F039423D90E50DC5"
...
...
@@ -531,6 +535,30 @@ Each certification also has:
}
```
#### `wot/identity-of/[search]`
**Goal**
GET identity data written for a member.
**Parameters**
Name | Value | Method
---- | ----- | ------
`search`
| Public key or uid of a
*member*
we want see the attached identity. | URL
**Returns**
Identity data written in the blockchain.
```
json
{
"pubkey"
:
"HsLShAtzXTVxeUtQd7yi5Z5Zh4zNvbu8sTEZ53nfKcqY"
,
"uid"
:
"user identifier"
,
"sigDate"
:
1390739944
}
```
### currency/*
#### `currency/parameters`
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment