...
|
...
|
@@ -14,11 +14,16 @@ class Rsa { |
|
|
decrypt(cipherText, Type) {
|
|
|
let plainText = cryptico.decrypt(cipherText, this.mattsRSAkey).plaintext;
|
|
|
|
|
|
if (Type && Type.name === 'Object') {
|
|
|
if (this.getType(Type) === 'Object') {
|
|
|
return JSON.parse(decodeURIComponent(plainText));
|
|
|
}
|
|
|
return plainText;
|
|
|
}
|
|
|
getType(fn) {
|
|
|
let match = fn && fn.toString().match(/^\s*function (\w+)/);
|
|
|
|
|
|
return match && match[1];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export default new Rsa(); |
...
|
...
|
|