File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,19 @@ function findIndexes(form) {
227
227
}
228
228
}
229
229
230
+ function makeStamp ( ) {
231
+ let timeStamp = ( new Date ( ) ) . toISOString ( ) ;
232
+ let uuid = crypto . randomUUID ( ) ;
233
+ let resultBeginning = `${ timeStamp } ${ uuid } ` ;
234
+ return resultBeginning ;
235
+ // TODO: Add hash. JavaScript has such a function
236
+ // in the browser, but it's only available in secure contexts and
237
+ // returns a promise, so it's not clear we should use it.
238
+ // let digestHex = digestMessage(resultBeginning);
239
+ // let digestEnding = digestHex.slice(-8);
240
+ // return `${resultBeginning} ${digestEnding}`;
241
+ }
242
+
230
243
/**
231
244
* Check the document's user input "attempt" to see if matches "correct".
232
245
* Then set "grade" in document depending on that answer.
@@ -254,9 +267,7 @@ function runCheck() {
254
267
// This makes it easy to detect someone simply copying a final result.
255
268
correctStamp = document . getElementById ( 'correctStamp' ) ;
256
269
if ( correctStamp ) {
257
- let timeStamp = ( new Date ( ) ) . toISOString ( ) ;
258
- let uuid = crypto . randomUUID ( ) ;
259
- correctStamp . innerHTML = `${ timeStamp } ${ uuid } ` ;
270
+ correctStamp . innerHTML = makeStamp ( ) ;
260
271
}
261
272
262
273
// Use a timeout so the underlying page will *re-render* before the
You can’t perform that action at this time.
0 commit comments