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
964b8ebb
Commit
964b8ebb
authored
10 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
Now able to accept empty keyblocks
parent
b4822868
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/lib/streams/parsers/doc/keyblock.js
+1
-0
1 addition, 0 deletions
app/lib/streams/parsers/doc/keyblock.js
app/service/KeychainService.js
+26
-1
26 additions, 1 deletion
app/service/KeychainService.js
with
27 additions
and
1 deletion
app/lib/streams/parsers/doc/keyblock.js
+
1
−
0
View file @
964b8ebb
...
...
@@ -114,6 +114,7 @@ function extractKeyChanges(raw) {
var
keychanges
=
[];
var
currentKC
;
var
lines
=
raw
.
split
(
/
\n
/
);
lines
=
lines
.
slice
(
0
,
lines
.
length
-
1
);
var
nbKeys
=
0
;
lines
.
forEach
(
function
(
line
){
if
(
line
.
match
(
/^#####----
(
F|N|U|L|B
)
:
[
A-Z0-9
]{40}
----#####$/
))
{
...
...
This diff is collapsed.
Click to expand it.
app/service/KeychainService.js
+
26
−
1
View file @
964b8ebb
...
...
@@ -175,7 +175,7 @@ function KeyService (conn, conf, PublicKeyService) {
checkPulseBlockKeychanges
(
block
,
done
);
}
else
if
(
current
)
{
done
(
'
Post-root blocks are not m
an
a
ge
d yet
'
);
checkNormalBlockKeych
ange
s
(
block
,
done
);
}
else
{
checkRootBlockKeychanges
(
block
,
function
(
err
)
{
...
...
@@ -217,6 +217,29 @@ function KeyService (conn, conf, PublicKeyService) {
});
}
function
checkNormalBlockKeychanges
(
block
,
done
)
{
var
newLinks
=
{};
async
.
forEach
(
block
.
keysChanges
,
function
(
kc
,
callback
){
if
(
kc
.
type
!=
'
U
'
)
{
callback
(
'
Only UPDATE block are managed for now
'
);
return
;
}
async
.
waterfall
([
function
(
next
){
// Check keychange (certifications verification notably)
checkKeychange
(
block
,
kc
,
next
);
},
function
(
next
){
// Memorize new links from signatures
newLinks
[
kc
.
fingerprint
]
=
kc
.
certifiers
;
next
();
},
],
callback
);
},
function
(
err
)
{
done
(
err
,
newLinks
);
});
}
function
checkKeychange
(
block
,
kc
,
done
)
{
try
{
...
...
@@ -933,6 +956,8 @@ function KeyService (conn, conf, PublicKeyService) {
block
.
version
=
1
;
block
.
currency
=
current
.
currency
;
block
.
number
=
current
.
number
+
1
;
block
.
previousHash
=
current
.
hash
;
block
.
previousIssuer
=
current
.
issuer
;
// Members merkle
var
stayers
=
members
.
slice
();
// copy
var
leavers
=
leaving
.
slice
();
// copy
...
...
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