Skip to content

Commit

Permalink
Add functionality to rotate keysets
Browse files Browse the repository at this point in the history
  • Loading branch information
cYKatherine committed Aug 5, 2024
1 parent 413f065 commit ef3020c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions webroot/adm/oncall/participant-summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ <h5>Participant Related Keysets</h5>
d. Keysets belonging to the leaked site itself<br></div>
<pre class="errorDiv" id="relatedKeysetsErrorOutput"></pre>
<pre id="relatedKeysetsStandardOutput"></pre>

<div class="col">
<a href="#" class="btn btn-primary" id="doRotateKeysets">Rotate Keysets</a>
<div id="output">
<pre id="errorOutput"></pre>
<pre id="standardOutput"></pre>
</div>
</div>
</div>
</div>
</div>
Expand Down
12 changes: 12 additions & 0 deletions webroot/js/participantSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,16 @@ $(document).ready(() => {
doApiCallWithCallback('GET', url, (r) => { loadRelatedKeysetsCallback(r, site.id, site.clientTypes) }, (err) => { participantSummaryErrorHandler(err, '#relatedKeysetsErrorOutput') });
$('.section').show();
});

$('#doRotateKeysets').on('click', () => {
var keysets = $('#relatedKeysetsStandardOutput').text();
console.log(keysets);
const ja = JSON.parse(keysets);
ja.forEach((keyset) => {
var url = `/api/key/rotate_keyset_key?min_age_seconds=3600&keyset_id=${keyset.keyset_id}`;
// if ($('#force').is(':checked')) url = url + '&force=true';

doApiCall('POST', url, '#standardOutput', '#errorOutput');
});
});
});

0 comments on commit ef3020c

Please sign in to comment.