Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
604ac23d
Commit
604ac23d
authored
8 years ago
by
Martin Schoeler
Browse files
Options
Downloads
Patches
Plain Diff
remove shared secret package
and update history
parent
ba79fc53
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
HISTORY.md
+1
-0
1 addition, 0 deletions
HISTORY.md
packages/rocketchat-sharedsecret/package.js
+0
-17
0 additions, 17 deletions
packages/rocketchat-sharedsecret/package.js
packages/rocketchat-sharedsecret/sharedsecret.js
+0
-87
0 additions, 87 deletions
packages/rocketchat-sharedsecret/sharedsecret.js
with
1 addition
and
104 deletions
HISTORY.md
+
1
−
0
View file @
604ac23d
...
...
@@ -7,6 +7,7 @@
-
[NEW] Option to enable
`Two Factor Authentication`
in user's account preference
-
[FIX] Incoming integrations would break when trying to use the
`Store`
feature.
-
[FIX] Outgoing webhooks which have an error and they're retrying would still retry even if the integration was disabled. (#4835)
-
[FIX] Removed Deprecated Package rocketchat:sharedsecret.
## 0.54.2 - 2017-Mar-24
...
...
This diff is collapsed.
Click to expand it.
packages/rocketchat-sharedsecret/package.js
deleted
100644 → 0
+
0
−
17
View file @
ba79fc53
Package
.
describe
({
name
:
'
rocketchat:sharedsecret
'
,
version
:
'
0.0.1
'
,
summary
:
'
RocketChat libraries
'
,
git
:
''
});
Package
.
onUse
(
function
(
api
)
{
api
.
use
([
'
ecmascript
'
,
'
rocketchat:lib
'
]);
api
.
use
([
'
jparker:crypto-aes
'
],
[
'
server
'
,
'
client
'
]);
api
.
addFiles
(
'
sharedsecret.js
'
,
[
'
server
'
,
'
client
'
]);
});
This diff is collapsed.
Click to expand it.
packages/rocketchat-sharedsecret/sharedsecret.js
deleted
100644 → 0
+
0
−
87
View file @
ba79fc53
const
SharedSecret
=
[];
function
EncryptMessage
(
message
)
{
const
currentUser
=
Meteor
.
user
().
_id
;
if
(
message
)
{
const
currentRoomId
=
message
.
rid
;
if
(
SharedSecret
&&
SharedSecret
[
currentUser
]
&&
SharedSecret
[
currentUser
][
currentRoomId
])
{
const
currentSecret
=
SharedSecret
[
currentUser
][
currentRoomId
];
const
encrypted
=
CryptoJS
.
AES
.
encrypt
(
message
.
msg
,
currentSecret
);
message
.
msg
=
encrypted
.
toString
();
if
(
message
.
urls
)
{
const
messageUrls
=
message
.
urls
;
messageUrls
.
forEach
((
i
)
=>
{
const
urls
=
messageUrls
[
i
];
urls
.
url
=
CryptoJS
.
AES
.
encrypt
(
urls
.
url
,
currentSecret
).
toString
();
});
}
message
.
encrypted
=
true
;
}
}
return
message
;
}
function
HandleSlashCommand
(
command
,
params
,
item
)
{
if
(
command
===
'
setsecretkey
'
)
{
const
currentUser
=
Meteor
.
user
().
_id
;
const
currentRoomId
=
item
.
rid
;
let
secret
=
params
;
if
(
secret
===
'
off
'
)
{
secret
=
null
;
}
if
(
SharedSecret
&&
SharedSecret
[
currentUser
])
{
SharedSecret
[
currentUser
][
currentRoomId
]
=
secret
;
}
else
{
SharedSecret
[
currentUser
]
=
[];
SharedSecret
[
currentUser
][
currentRoomId
]
=
secret
;
}
}
}
function
DecryptMessage
(
message
)
{
if
(
message
&&
message
.
encrypted
)
{
const
currentRoomId
=
message
.
rid
;
const
currentSecret
=
localStorage
.
getItem
(
`rocket.chat.sharedSecretKey.
${
currentRoomId
}
`
);
if
(
currentSecret
)
{
const
decrypted
=
CryptoJS
.
AES
.
decrypt
(
message
.
msg
,
currentSecret
).
toString
(
CryptoJS
.
enc
.
Utf8
);
if
(
decrypted
===
''
)
{
message
.
msg
=
'
~ encrypted message ~
'
;
message
.
html
=
'
~ encrypted message ~
'
;
}
else
{
const
lockImage
=
'
images/lock8.png
'
;
message
.
msg
=
`<img src=
${
lockImage
}
style='width:8px;height:9px;'></img>
${
decrypted
}
`
;
message
.
html
=
`<img src=
${
lockImage
}
style='width:8px;height:9px;'></img>
${
decrypted
}
`
;
}
if
(
message
.
urls
)
{
const
messageUrls
=
message
.
urls
;
messageUrls
.
forEach
((
urls
)
=>
{
urls
.
url
=
CryptoJS
.
AES
.
decrypt
(
urls
.
url
,
currentSecret
).
toString
(
CryptoJS
.
enc
.
Utf8
);
});
}
}
else
{
message
.
msg
=
'
~ encrypted message ~
'
;
message
.
html
=
'
~ encrypted message ~
'
;
}
}
return
message
;
}
function
HandleSlashCommandClient
(
command
,
params
,
item
)
{
if
(
command
===
'
setsecretkey
'
)
{
let
secret
=
params
;
if
(
secret
===
'
off
'
)
{
secret
=
null
;
}
const
currentRoomId
=
item
.
rid
;
localStorage
.
setItem
(
`rocket.chat.sharedSecretKey.
${
currentRoomId
}
`
,
secret
);
}
}
if
(
Meteor
.
isServer
)
{
RocketChat
.
callbacks
.
add
(
'
beforeSaveMessage
'
,
EncryptMessage
,
9999
,
'
sharedsecret-encrypt-message
'
);
RocketChat
.
slashCommands
.
add
(
'
setsecretkey
'
,
HandleSlashCommand
);
}
if
(
Meteor
.
isClient
)
{
RocketChat
.
callbacks
.
add
(
'
renderMessage
'
,
DecryptMessage
,
-
9999
,
'
sharedsecret-decrypt-message
'
);
RocketChat
.
slashCommands
.
add
(
'
setsecretkey
'
,
HandleSlashCommandClient
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment