mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-19 11:02:58 +00:00
Fix for Safari support using webkit prefix
This commit is contained in:
parent
2a8e4842c3
commit
64b12776b8
@ -43,7 +43,7 @@ $(function() {
|
||||
|
||||
if (!roomId) return;
|
||||
|
||||
if ((!window.crypto && !window.msCrypto) || !window.crypto.subtle) {
|
||||
if (!window.crypto || (!window.crypto.subtle && !window.crypto.webkitSubtle)) {
|
||||
$('#no-crypto').modal({
|
||||
backdrop: 'static',
|
||||
show: false,
|
||||
@ -54,6 +54,7 @@ $(function() {
|
||||
}
|
||||
|
||||
var crypto = window.crypto;
|
||||
var cryptoSubtle = window.crypto.subtle || window.crypto.webkitSubtle;
|
||||
|
||||
let socket = io(roomId);
|
||||
$('#roomIdKey').text(roomId.replace('/', ''));
|
||||
@ -579,25 +580,25 @@ $(function() {
|
||||
}
|
||||
|
||||
function createKey(password) {
|
||||
return crypto.subtle.digest({
|
||||
return cryptoSubtle.digest({
|
||||
name: "SHA-256"
|
||||
}, convertStringToArrayBufferView(password))
|
||||
.then(function(result) {
|
||||
return window.crypto.subtle.importKey("raw", result, {
|
||||
return cryptoSubtle.importKey("raw", result, {
|
||||
name: "AES-CBC"
|
||||
}, false, ["encrypt", "decrypt"]);
|
||||
});
|
||||
}
|
||||
|
||||
function encryptData(data, key, vector) {
|
||||
return crypto.subtle.encrypt({
|
||||
return cryptoSubtle.encrypt({
|
||||
name: "AES-CBC",
|
||||
iv: vector
|
||||
}, key, convertStringToArrayBufferView(data));
|
||||
}
|
||||
|
||||
function decryptData(data, key, vector) {
|
||||
return crypto.subtle.decrypt({
|
||||
return cryptoSubtle.decrypt({
|
||||
name: "AES-CBC",
|
||||
iv: vector
|
||||
}, key, data);
|
||||
|
@ -188,7 +188,7 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Your browser does not support the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Crypto" target="_blank">Crypto Web API</a>.</p>
|
||||
<p>Try using the lastest version of Chrome or Firefox.</p>
|
||||
<p>Try using the lastest version of Chrome, Firefox or Safari.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user