<html>
<head>
<script>
function base64DecodeToArrayBuffer(encoded) {
// atob() decodes base64 strings into binary string.
var decoded = atob(encoded);
var buffer = new ArrayBuffer(decoded.length);
var view = new Uint8Array(buffer);
for (var i = 0; i < decoded.length; i++) {
view[i] = decoded.charCodeAt(i);
}
return buffer;
}
window.onload = function() {
if (typeof chrome.setSyncEncryptionKeys == "undefined") {
console.log("chrome.setSyncEncryptionKeys() not defined");
document.title = "UNDEFINED";
} else {
const params = new URLSearchParams(location.search);
chrome.setSyncEncryptionKeys(() => { window.close(); },
params.get("gaia"),
[base64DecodeToArrayBuffer(params.get("key"))],
parseInt(params.get("key_version")));
}
}
</script>
</head>
</html>