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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
typescript
duniter
Commits
a62606d7
Commit
a62606d7
authored
9 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
Fix
#388
An identity could appear revoked whereas is has not been written in the blockchain yet
parent
e1601c04
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/service/IdentityService.js
+4
-3
4 additions, 3 deletions
app/service/IdentityService.js
test/integration/revocation-test.js
+37
-0
37 additions, 0 deletions
test/integration/revocation-test.js
test/integration/tools/user.js
+2
-2
2 additions, 2 deletions
test/integration/tools/user.js
with
43 additions
and
5 deletions
app/service/IdentityService.js
+
4
−
3
View file @
a62606d7
...
...
@@ -176,9 +176,10 @@ function IdentityService () {
}
}
else
{
// Create
revoc
.
revoked
=
true
;
yield
dal
.
savePendingIdentity
(
revoc
);
// Create identity given by the revocation
const
idty
=
new
Identity
(
revoc
);
idty
.
revocation_sig
=
revoc
.
signature
;
yield
dal
.
savePendingIdentity
(
idty
);
return
jsonResultTrue
();
}
}));
...
...
This diff is collapsed.
Click to expand it.
test/integration/revocation-test.js
+
37
−
0
View file @
a62606d7
...
...
@@ -34,9 +34,22 @@ const s1 = ucoin({
}
},
commonConf
));
const
s2
=
ucoin
({
memory
:
MEMORY_MODE
,
name
:
'
bb12
'
},
_
.
extend
({
port
:
'
9965
'
,
pair
:
{
pub
:
'
HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd
'
,
sec
:
'
51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP
'
}
},
commonConf
));
const
cat
=
user
(
'
cat
'
,
{
pub
:
'
HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd
'
,
sec
:
'
51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP
'
},
{
server
:
s1
});
const
tic
=
user
(
'
tic
'
,
{
pub
:
'
DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV
'
,
sec
:
'
468Q1XtTq7h84NorZdWBZFJrGkB18CbmbHr9tkp9snt5GiERP7ySs3wM8myLccbAAGejgMRC9rqnXuW3iAfZACm7
'
},
{
server
:
s1
});
const
toc
=
user
(
'
toc
'
,
{
pub
:
'
DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo
'
,
sec
:
'
64EYRvdPpTfLGGmaX5nijLXRqWXaVz8r1Z1GtaahXwVSJGQRn7tqkxLb288zwSYzELMEG5ZhXSBYSxsTsz1m9y8F
'
},
{
server
:
s1
});
const
tacOnS1
=
user
(
'
tac
'
,
{
pub
:
'
2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc
'
,
sec
:
'
2HuRLWgKgED1bVio1tdpeXrf7zuUszv1yPHDsDj7kcMC4rVSN9RC58ogjtKNfTbH1eFz7rn38U1PywNs3m6Q7UxE
'
},
{
server
:
s1
});
const
tacOnS2
=
user
(
'
tac
'
,
{
pub
:
'
2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc
'
,
sec
:
'
2HuRLWgKgED1bVio1tdpeXrf7zuUszv1yPHDsDj7kcMC4rVSN9RC58ogjtKNfTbH1eFz7rn38U1PywNs3m6Q7UxE
'
},
{
server
:
s2
});
const
commitS1
=
commit
(
s1
);
...
...
@@ -46,6 +59,7 @@ describe("Revocation", function() {
return
co
(
function
*
()
{
yield
s1
.
initWithDAL
().
then
(
bma
).
then
((
bmapi
)
=>
bmapi
.
openConnections
());
yield
s2
.
initWithDAL
().
then
(
bma
).
then
((
bmapi
)
=>
bmapi
.
openConnections
());
yield
cat
.
selfCert
();
yield
tic
.
selfCert
();
yield
toc
.
selfCert
();
...
...
@@ -92,6 +106,29 @@ describe("Revocation", function() {
});
}));
it
(
'
sending a revocation for tac should add an identity
'
,
()
=>
co
(
function
*
()
{
yield
tacOnS1
.
selfCert
();
const
idty
=
yield
tacOnS1
.
lookup
(
tacOnS1
.
pub
);
yield
tacOnS2
.
revoke
(
idty
);
// On S1 server, tac is known as normal identity
yield
expectAnswer
(
rp
(
'
http://127.0.0.1:9964/wot/lookup/tac
'
,
{
json
:
true
}),
function
(
res
)
{
res
.
should
.
have
.
property
(
'
results
'
).
length
(
1
);
res
.
results
[
0
].
should
.
have
.
property
(
'
uids
'
).
length
(
1
);
res
.
results
[
0
].
uids
[
0
].
should
.
have
.
property
(
'
uid
'
).
equal
(
'
tac
'
);
res
.
results
[
0
].
uids
[
0
].
should
.
have
.
property
(
'
revoked
'
).
equal
(
false
);
res
.
results
[
0
].
uids
[
0
].
should
.
have
.
property
(
'
revocation_sig
'
).
equal
(
null
);
});
// On S2 server, tac is known as identity with revocation pending (not written! so `revoked` field is false)
yield
expectAnswer
(
rp
(
'
http://127.0.0.1:9965/wot/lookup/tac
'
,
{
json
:
true
}),
function
(
res
)
{
res
.
should
.
have
.
property
(
'
results
'
).
length
(
1
);
res
.
results
[
0
].
should
.
have
.
property
(
'
uids
'
).
length
(
1
);
res
.
results
[
0
].
uids
[
0
].
should
.
have
.
property
(
'
uid
'
).
equal
(
'
tac
'
);
res
.
results
[
0
].
uids
[
0
].
should
.
have
.
property
(
'
revoked
'
).
equal
(
false
);
res
.
results
[
0
].
uids
[
0
].
should
.
have
.
property
(
'
revocation_sig
'
).
not
.
equal
(
null
);
res
.
results
[
0
].
uids
[
0
].
should
.
have
.
property
(
'
revocation_sig
'
).
not
.
equal
(
''
);
});
}));
it
(
'
if we commit a revocation, cat should be revoked
'
,
()
=>
co
(
function
*
()
{
yield
commitS1
();
return
expectAnswer
(
rp
(
'
http://127.0.0.1:9964/wot/lookup/cat
'
,
{
json
:
true
}),
function
(
res
)
{
...
...
This diff is collapsed.
Click to expand it.
test/integration/tools/user.js
+
2
−
2
View file @
a62606d7
...
...
@@ -96,8 +96,8 @@ function User (uid, options, node) {
return
yield
that
.
sendMembership
(
"
OUT
"
);
});
this
.
revoke
=
()
=>
co
(
function
*
()
{
let
res
=
yield
that
.
lookup
(
pub
);
this
.
revoke
=
(
givenLookupIdty
)
=>
co
(
function
*
()
{
let
res
=
givenLookupIdty
||
(
yield
that
.
lookup
(
pub
)
)
;
let
idty
=
Identity
.
statics
.
fromJSON
({
uid
:
res
.
results
[
0
].
uids
[
0
].
uid
,
buid
:
res
.
results
[
0
].
uids
[
0
].
meta
.
timestamp
,
...
...
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