Skip to content

Commit

Permalink
First delete OSCORE object on client when writing to it
Browse files Browse the repository at this point in the history
Signed-off-by: Rikard Höglund <rikard.hoglund@ri.se>
  • Loading branch information
rikard-sics committed Jan 20, 2021
1 parent 465f82c commit 8034e0f
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,26 @@ var configsFromRestToUI = function(configs){
//convert config from UI to rest API format:
var configFromUIToRest = function(config){
var newConfig = {servers:{}, security:{}, oscore:{}};
var writingOscore = false;
for (var i = 0; i < config.bs.length; i++) {
var bs = config.bs[i];
newConfig.security[i] = bs.security;
newConfig.oscore[i] = bs.oscore;
writingOscore |= (bs.oscore != null);
}
for (var j = 0; j < config.dm.length; j++) {
var dm = config.dm[j];
newConfig.security[i+j] = dm.security;
delete dm.security;
newConfig.oscore[i+j] = dm.oscore;
writingOscore |= (dm.oscore != null);
delete dm.oscore;
newConfig.servers[j] = dm;
}
newConfig.toDelete = ["/0", "/1"]
if(writingOscore) {
newConfig.toDelete.push("/21");
}
return newConfig;
};

Expand Down

0 comments on commit 8034e0f

Please sign in to comment.