2f593328
Geoffrey PREUD'HOMME
Linting
|
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
function ($http) {
a = {
encrypter: false,
whenOk: function (cb) {
if (this.encrypter) {
cb();
} else {
this.prepare(cb);
}
},
prepare: function (cb) {
$http.get('/com/ci_com_pub.pem').success(function (key) {
this.encrypter = new JSEncrypt();
this.encrypter.setPublicKey(key);
cb();
});
},
preload: function (cb) {
this.whenOk(cb);
},
encrypt: function (string, cb) {
this.whenOk(function () {
cb(this.encrypter.encrypt(string));
});
}
};
return a;
}
|