Commit 16bfdeba authored by Cédric Moreau's avatar Cédric Moreau

Accepting keyblocks (simple parsing)

parent c25e3845
......@@ -22,7 +22,7 @@ function KeyblockParser (onError) {
{prop: "membersCount", regexp: /MembersCount: (.*)/},
{prop: "membersRoot", regexp: /MembersRoot: (.*)/},
{prop: "membersChanges", regexp: /MembersChanges:\n([\s\S]*)KeysChanges/, parser: split("\n")},
{prop: "keysChanges", regexp: /KeysChanges:\n([\s\S]*)/, parser: extractKeyChanges}
{prop: "keysChanges", regexp: /KeysChanges:\n([\s\S]*)/, parser: extractKeyChanges}
];
var multilineFields = [];
GenericParser.call(this, captures, multilineFields, rawer.getKeyblock, onError);
......@@ -33,6 +33,8 @@ function KeyblockParser (onError) {
if (obj[field].length > 0)
obj[field].splice(obj[field].length - 1, 1);
});
if (!obj.keysChanges)
obj.keysChanges = [];
};
this._verify = function(obj){
......
......@@ -49,7 +49,6 @@ function KeychangeParser (onError) {
function extractBase64Lines(raw) {
var validLines = "";
var lines = raw.split(/\n/);
// console.log('raw = ', raw);
lines.forEach(function(line){
if (line.match(/^[A-Za-z0-9\/+=]{1,64}$/)) {
validLines += line + '\n';
......
......@@ -19,9 +19,7 @@ var KeyBlockSchema = new Schema({
membersCount: {"type": Number, "default": 0},
membersRoot: String,
membersChanges: Array,
publicKeys: Array,
memberships: Array,
membershipsSigs: Array,
keysChanges: Array,
signature: String,
hash: String,
created: { type: Date, default: Date.now },
......
......@@ -25,7 +25,7 @@ function KeyService (conn, conf, PublicKeyService) {
var Link = conn.model('Link');
var Key = conn.model('Key');
var MINIMUM_ZERO_START = 1;
var MINIMUM_ZERO_START = 0;
var LINK_QUANTITY_MIN = 1;
var MAX_STEPS = 1;
var MAX_LINK_VALIDITY = 3600*24*30; // 30 days
......@@ -136,11 +136,13 @@ function KeyService (conn, conf, PublicKeyService) {
},
function (next) {
// Check document's coherence
checkCoherence(currentBlock, block, next);
},
function (next) {
// checkCoherence(currentBlock, block, next);
// },
// function (next) {
// Save block data + compute links obsolescence
saveBlockData(block, next);
console.log('OK');
next(null, block);
// saveBlockData(block, next);
}
], done);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment