git ssb

0+

Dominic / ssb-validate



Commit ba6ff211efff89c71d83c323c851ba1732b15a1f

reverse order of state argument in appendNew and throw errors where appropiate

Dominic Tarr committed on 9/22/2017, 9:04:16 PM
Parent: a7051e65b56caff3ad3d3a29c4bf59526525e225

Files changed

index.jschanged
index.jsView
@@ -99,10 +99,12 @@
9999 return fstate
100100 }
101101
102102 exports.append = function (state, msg) {
103- if(state.error = exports.checkInvalid(flatState(state.feeds[msg.author]), msg))
104- return state
103 + var err
104 + var _state = flatState(state.feeds[msg.author])
105 + if(err = exports.checkInvalid(_state, msg))
106 + throw err
105107
106108 else if(state.feeds[msg.author]) {
107109 var a = state.feeds[msg.author]
108110 a.id = exports.id(msg)
@@ -152,9 +154,9 @@
152154 return '%'+ssbKeys.hash(JSON.stringify(msg, null, 2))
153155 }
154156
155157 exports.appendNew = function (state, hmac_key, keys, content, timestamp) {
156- var msg = exports.create(keys, hmac_key, state.feeds[keys.id], content, timestamp)
158 + var msg = exports.create(state.feeds[keys.id], keys, hmac_key, content, timestamp)
157159 state = exports.append(state, msg)
158160 return state
159161 }
160162
@@ -176,4 +178,7 @@
176178 */
177179
178180
179181
182 +
183 +
184 +

Built with git-ssb-web