Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
4f8b5a40
Commit
4f8b5a40
authored
Aug 27, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use built-in crypto instead of CryptoJS
parent
11cc41d3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
src/converse-vcard.js
src/converse-vcard.js
+11
-8
No files found.
src/converse-vcard.js
View file @
4f8b5a40
...
...
@@ -5,10 +5,10 @@
// Licensed under the Mozilla Public License (MPLv2)
(
function
(
root
,
factory
)
{
define
([
"
converse-core
"
,
"
crypto
"
,
"
templates/vcard.html
"
],
factory
);
}(
this
,
function
(
converse
,
CryptoJS
,
tpl_vcard
)
{
define
([
"
converse-core
"
,
"
templates/vcard.html
"
],
factory
);
}(
this
,
function
(
converse
,
tpl_vcard
)
{
"
use strict
"
;
const
{
Backbone
,
Promise
,
Strophe
,
SHA1
,
_
,
$iq
,
$build
,
b64_sha1
,
moment
,
sizzle
}
=
converse
.
env
;
const
{
Backbone
,
Promise
,
Strophe
,
_
,
$iq
,
$build
,
b64_sha1
,
moment
,
sizzle
}
=
converse
.
env
;
const
u
=
converse
.
env
.
utils
;
...
...
@@ -74,11 +74,14 @@
};
}
if
(
result
.
image
)
{
const
word_array_from_b64
=
CryptoJS
.
enc
.
Base64
.
parse
(
result
[
'
image
'
]);
result
[
'
image_hash
'
]
=
CryptoJS
.
SHA1
(
word_array_from_b64
).
toString
()
}
if
(
callback
)
{
callback
(
result
);
const
buffer
=
u
.
base64ToArrayBuffer
(
result
[
'
image
'
]);
crypto
.
subtle
.
digest
(
'
SHA-1
'
,
buffer
)
.
then
(
ab
=>
{
result
[
'
image_hash
'
]
=
u
.
arrayBufferToHex
(
ab
);
if
(
callback
)
callback
(
result
);
});
}
else
{
if
(
callback
)
callback
(
result
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment