changes to ie11 prototype
This commit is contained in:
parent
fff8308259
commit
f2fedae6aa
1 changed files with 103 additions and 52 deletions
|
@ -37,62 +37,113 @@
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="../lib/olm/olm_legacy.js"></script>
|
<script type="text/javascript" src="../lib/olm/olm_legacy.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
const ssssKeyAccountData =
|
// sample data from account with recovery key
|
||||||
{
|
const ssssKeyAccountData = {
|
||||||
"type": "m.secret_storage.key.HB6AKfUD4avkZfPfyjcJ6iJPWDp4f9WM",
|
"type": "m.secret_storage.key.le4jDjlxrIMZDSKu1EudJL5Tc4U5qI0d",
|
||||||
"content": {
|
"content": {
|
||||||
"algorithm": "m.secret_storage.v1.aes-hmac-sha2",
|
"algorithm": "m.secret_storage.v1.aes-hmac-sha2",
|
||||||
"passphrase": {
|
"iv": "YPhwwArIUTwasbROMFd1PQ==",
|
||||||
"algorithm": "m.pbkdf2",
|
"mac": "khWXeBzKtZi8SX6I7m/9yPoLB1yv1u9l+NNi6WF4+ek="
|
||||||
"iterations": 500000,
|
}
|
||||||
"salt": "tfY5mgvQBr3Gd5Dy1IBiKf7fLquL4Y9O"
|
};
|
||||||
},
|
const megolmBackupKeyAccountData = {
|
||||||
"iv": "xitm4hxsqagkbyEmXj0tUw==",
|
"type": "m.megolm_backup.v1",
|
||||||
"mac": "nagOYz7FKrdlFEKM9ij78th0O2p7YVGgl+p0LHr4EBE="
|
"content": {
|
||||||
}
|
"encrypted": {
|
||||||
};
|
"le4jDjlxrIMZDSKu1EudJL5Tc4U5qI0d": {
|
||||||
|
"iv": "PiqYdySj9s4RsaLc1oDF1w==",
|
||||||
|
"ciphertext": "62fjUs1xkF3BvqVEvAEoDH9jcYiotkcJHG/VNtzSrPBlrmOYQyPA93L2rKo=",
|
||||||
|
"mac": "vtq+kEg5XaRdw08aPiQi7+w9qUiDCQKo/jKNTvrN4ho="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const megolmBackupKeyAccountData = {
|
const backupInfo = {
|
||||||
"type": "m.megolm_backup.v1",
|
"algorithm": "m.megolm_backup.v1.curve25519-aes-sha2",
|
||||||
"content": {
|
"auth_data": {
|
||||||
"encrypted": {
|
"public_key": "tY/jSdfy2q1pS8Ux+LP8xr/RMn9NDElwofH+E5sFG38",
|
||||||
"HB6AKfUD4avkZfPfyjcJ6iJPWDp4f9WM": {
|
"signatures": {
|
||||||
"iv": "HpzOY5DxYFJCxw5Vi6BBOQ==",
|
"@bruno-test4s2:matrix.org": {
|
||||||
"ciphertext": "u1TJjaaGKVDGExg9hu2fIUZ0gjToMcMReyhn4nsXgnhm7Dvz6E/4p+nSF3w=",
|
"ed25519:KTLGZUJCYZ": "YPuzpLo4OZL5+HQTkbDnUKpIuCmL50Q7RnMs9cRfKqyS+CMPm0RBU1ttPO6XOZ+TjZ4VThXU50LUkmpJiKM+Aw",
|
||||||
"mac": "08ckDbQK9wB2jiE4n4sfp2sw83q/0C2/gEz2LuHMEPg="
|
"ed25519:l17fdsfeS7qUKIYzgx3LxIcHnjPM00+Ge5dTk7Msy04": "epDo+d9foXXcnXChZaEOCKNYzofOMBXQF3FCMDJ52hxvxh9K1w+2zOOAwWEKOts88gubgIsdRQedkuhuIm2LCg"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
const backupInfo = {
|
"count": 1,
|
||||||
"algorithm": "m.megolm_backup.v1.curve25519-aes-sha2",
|
"etag": "1",
|
||||||
"auth_data": {
|
"version": "1"
|
||||||
"public_key": "Vw2cwhbxFg/GQ2rr4VRIQ+Oh74lP7IxY6oN4R9q992k",
|
};
|
||||||
"signatures": {
|
|
||||||
"@bruno-test4s:matrix.org": {
|
const sessionResponse = {
|
||||||
"ed25519:XAIKJXBCNZ": "AFBp1T2x8hyPSi2hCHg6IzNy67RxULj3/7LYZgVT3Ruz49v5h1+jAScTxZj5jrItxo2LCzSORH+yABHjPIqOBQ",
|
"first_message_index": 0,
|
||||||
"ed25519:lukepZkTmPcJS6wCl12B0tIURIO8YbMd5QJLf8UOugI": "a1ZJa+1+p9Gm5Po1B619ZDy4xidHmLt82vXVPH7vWTjny1r3JI2iM4fB2qh8vEiASNlFyVrFx//gQrz9Y1IJBA"
|
"forwarded_count": 0,
|
||||||
}
|
"is_verified": true,
|
||||||
}
|
"session_data": {
|
||||||
},
|
"ciphertext": "+a8OCF0v5U5GYTNAMwgNEqSItxy4hea073zlWCp+ocr4mUQDuUZyOo+DGHDPPvSOnhJA2waSV05wna/Jmig7NAzuJJy8eEd0dHmGiA16eUMFiUz0HYFseDXs0dDGF38shz1C6CXYRjTOS3S7JWLVzeeYy632BMGvGjWMvAuOpm4NgV9fLB5J6nYVb/wvU3Mf8mw/eT5k8AUJA/CAD6zM7T9skEJhuFoi5kdPfBoozUbScA5xcPVmE6aY08zZ6QpiZ7lsyWoIRDbRxaBxL82T2CnpcngE/SAHF+eJ9ZWK3txolYLT/KAfKlAVLV7yWXkYL7oxrW8DI/5ZQFXUqzqqqfAB7Qz2AIvCdUVqhDGwuDr5noCMlKYEwyYR0VC2i4ZyXdtLdOjKBS2eTqDcwdv2gcaOnbJJcIEuGMKVg89/rKqpWncY/+NOBTQhuts05+Wi+9wU+OlGlNFvhkOgp1BaP0Q7T4pkxgj4OSbf3t1UfthltJSX8TS9ZGd3DVDI8swQuMBvF9H+7kAeO2IWTMSe57MYvlk0aw/gPFdI06lcOvH2nAr9C2HNsuYhyO4XGZOAg8HHzkjLlzNU+zJk1MfRIXRoVgbIh1hApcK9HhyTBzg",
|
||||||
"count": 1,
|
"ephemeral": "z0JE6swJZbrmRYOWGvEI6zhIzoJ57lhzp1uujVS2jUs",
|
||||||
"etag": "1",
|
"mac": "+AAASqA+4U8"
|
||||||
"version": "1"
|
}
|
||||||
};
|
};
|
||||||
const sessionResponse = {
|
const keyId = "le4jDjlxrIMZDSKu1EudJL5Tc4U5qI0d";
|
||||||
"first_message_index": 0,
|
// sample data with account with recovery passphrase
|
||||||
"forwarded_count": 0,
|
// const ssssKeyAccountData =
|
||||||
"is_verified": true,
|
// {
|
||||||
"session_data": {
|
// "type": "m.secret_storage.key.HB6AKfUD4avkZfPfyjcJ6iJPWDp4f9WM",
|
||||||
"ciphertext": "1NoC8/GZWeGjneuoFDcqpbMYOJ8bjDFiw2O4/YOKC59x9RqSejLyM8qLL5FzlV+uW7anPVED8t9m+p2t1kKa15LxlcdzXjLPCv1QGYlhotbUhN8eRUobQuLqsD5Dl/QqNxv+Xl65tEaQhUeF30NmSesw6GHvP93vB3mTN8Yz9QyaQtvgoI/Q6c4d+yGmFVE2dlhXdOs7Hrylrg8UyM1QI+qpNJ3L9ETcqiXCG/FJIdM87LmNnHPX65TWK5xsu1JKWCI2BY1KFVDyxm40FyHHypUPYoT9RqPnygHtYoTiZzyaVxqUu2vg08Bv0t1VH2SNDGs5aZYQN5S1JNAHrXE+cWSg0rfVb160Z4FJC/89wO8fw/uXqJehqMVuC9BSU/zsKcZ797U92qDnIb6QQuMYKRgh9JrEugqJN9ocL7F8W9fW2oFfUYRyvOZRSf387hGrapEGBKx7Owb7UoXvWyb4C5hc5SFNvej+yg98+Fi4hzlGH26DqzJdLcxU5P/MWfZc222QqPFuFspe6f0Ts5jnJhjCQhXWoM4G6mtvGbOm2ESSJULj8U4JSDz8GsxrmojR/pBpywBvuy/mx//htnacnTRqYJz+PZVtV63rfaZlEtU",
|
// "content": {
|
||||||
"ephemeral": "wXBeLoazggBmFS0eiVY9H/qq5o1yt2/NIKWcq384EHc",
|
// "algorithm": "m.secret_storage.v1.aes-hmac-sha2",
|
||||||
"mac": "w3IfO5vL9Bc"
|
// "passphrase": {
|
||||||
}
|
// "algorithm": "m.pbkdf2",
|
||||||
};
|
// "iterations": 500000,
|
||||||
const keyId = "HB6AKfUD4avkZfPfyjcJ6iJPWDp4f9WM";
|
// "salt": "tfY5mgvQBr3Gd5Dy1IBiKf7fLquL4Y9O"
|
||||||
|
// },
|
||||||
|
// "iv": "xitm4hxsqagkbyEmXj0tUw==",
|
||||||
|
// "mac": "nagOYz7FKrdlFEKM9ij78th0O2p7YVGgl+p0LHr4EBE="
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
// const megolmBackupKeyAccountData = {
|
||||||
|
// "type": "m.megolm_backup.v1",
|
||||||
|
// "content": {
|
||||||
|
// "encrypted": {
|
||||||
|
// "HB6AKfUD4avkZfPfyjcJ6iJPWDp4f9WM": {
|
||||||
|
// "iv": "HpzOY5DxYFJCxw5Vi6BBOQ==",
|
||||||
|
// "ciphertext": "u1TJjaaGKVDGExg9hu2fIUZ0gjToMcMReyhn4nsXgnhm7Dvz6E/4p+nSF3w=",
|
||||||
|
// "mac": "08ckDbQK9wB2jiE4n4sfp2sw83q/0C2/gEz2LuHMEPg="
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// const backupInfo = {
|
||||||
|
// "algorithm": "m.megolm_backup.v1.curve25519-aes-sha2",
|
||||||
|
// "auth_data": {
|
||||||
|
// "public_key": "Vw2cwhbxFg/GQ2rr4VRIQ+Oh74lP7IxY6oN4R9q992k",
|
||||||
|
// "signatures": {
|
||||||
|
// "@bruno-test4s:matrix.org": {
|
||||||
|
// "ed25519:XAIKJXBCNZ": "AFBp1T2x8hyPSi2hCHg6IzNy67RxULj3/7LYZgVT3Ruz49v5h1+jAScTxZj5jrItxo2LCzSORH+yABHjPIqOBQ",
|
||||||
|
// "ed25519:lukepZkTmPcJS6wCl12B0tIURIO8YbMd5QJLf8UOugI": "a1ZJa+1+p9Gm5Po1B619ZDy4xidHmLt82vXVPH7vWTjny1r3JI2iM4fB2qh8vEiASNlFyVrFx//gQrz9Y1IJBA"
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// "count": 1,
|
||||||
|
// "etag": "1",
|
||||||
|
// "version": "1"
|
||||||
|
// };
|
||||||
|
// const sessionResponse = {
|
||||||
|
// "first_message_index": 0,
|
||||||
|
// "forwarded_count": 0,
|
||||||
|
// "is_verified": true,
|
||||||
|
// "session_data": {
|
||||||
|
// "ciphertext": "1NoC8/GZWeGjneuoFDcqpbMYOJ8bjDFiw2O4/YOKC59x9RqSejLyM8qLL5FzlV+uW7anPVED8t9m+p2t1kKa15LxlcdzXjLPCv1QGYlhotbUhN8eRUobQuLqsD5Dl/QqNxv+Xl65tEaQhUeF30NmSesw6GHvP93vB3mTN8Yz9QyaQtvgoI/Q6c4d+yGmFVE2dlhXdOs7Hrylrg8UyM1QI+qpNJ3L9ETcqiXCG/FJIdM87LmNnHPX65TWK5xsu1JKWCI2BY1KFVDyxm40FyHHypUPYoT9RqPnygHtYoTiZzyaVxqUu2vg08Bv0t1VH2SNDGs5aZYQN5S1JNAHrXE+cWSg0rfVb160Z4FJC/89wO8fw/uXqJehqMVuC9BSU/zsKcZ797U92qDnIb6QQuMYKRgh9JrEugqJN9ocL7F8W9fW2oFfUYRyvOZRSf387hGrapEGBKx7Owb7UoXvWyb4C5hc5SFNvej+yg98+Fi4hzlGH26DqzJdLcxU5P/MWfZc222QqPFuFspe6f0Ts5jnJhjCQhXWoM4G6mtvGbOm2ESSJULj8U4JSDz8GsxrmojR/pBpywBvuy/mx//htnacnTRqYJz+PZVtV63rfaZlEtU",
|
||||||
|
// "ephemeral": "wXBeLoazggBmFS0eiVY9H/qq5o1yt2/NIKWcq384EHc",
|
||||||
|
// "mac": "w3IfO5vL9Bc"
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
//const keyId = "HB6AKfUD4avkZfPfyjcJ6iJPWDp4f9WM";
|
||||||
const cryptoDriver = new bundle.CryptoDriver((window.crypto || window.msCrypto).subtle);
|
const cryptoDriver = new bundle.CryptoDriver((window.crypto || window.msCrypto).subtle);
|
||||||
window.Olm.init().then(function() {
|
window.Olm.init().then(function() {
|
||||||
bundle.deriveSSSSKey(cryptoDriver, prompt("passphrase"), ssssKeyAccountData).then(function(ssssKey) {
|
bundle.deserializeSSSSKey("EsUH dBfj L7XF Kdej TNmK 2CdP R7NQ KnQH zA1o 8kDg piuJ QEZh", ssssKeyAccountData).then(function(ssssKey) {
|
||||||
|
//bundle.deriveSSSSKey(cryptoDriver, prompt("passphrase"), ssssKeyAccountData).then(function(ssssKey) {
|
||||||
// const ssssKey = new Uint8Array(32);
|
// const ssssKey = new Uint8Array(32);
|
||||||
// const bytes = [123, 47, 138, 15, 190, 69, 224, 204, 88, 246, 203, 65, 243, 234, 91, 17, 250, 107, 104, 51, 211, 252, 81, 67, 80, 191, 105, 208, 127, 87, 107, 231];
|
// const bytes = [123, 47, 138, 15, 190, 69, 224, 204, 88, 246, 203, 65, 243, 234, 91, 17, 250, 107, 104, 51, 211, 252, 81, 67, 80, 191, 105, 208, 127, 87, 107, 231];
|
||||||
// for (var i = bytes.length - 1; i >= 0; i--) {
|
// for (var i = bytes.length - 1; i >= 0; i--) {
|
||||||
|
|
Reference in a new issue