2010-02-25 08:19:01 +08:00
|
|
|
|
2010-09-07 02:13:09 +08:00
|
|
|
var Crypto = function() {
|
|
|
|
};
|
2010-02-25 08:19:01 +08:00
|
|
|
|
2010-09-07 02:13:09 +08:00
|
|
|
Crypto.prototype.encrypt = function(seed, string, callback) {
|
|
|
|
this.encryptWin = callback;
|
2010-09-11 04:13:53 +08:00
|
|
|
PhoneGap.execAsync(null, null, "Crypto", "encrypt", [seed, string]);
|
2010-09-07 02:13:09 +08:00
|
|
|
};
|
2010-02-25 08:19:01 +08:00
|
|
|
|
2010-09-07 02:13:09 +08:00
|
|
|
Crypto.prototype.decrypt = function(seed, string, callback) {
|
|
|
|
this.decryptWin = callback;
|
2010-09-11 04:13:53 +08:00
|
|
|
PhoneGap.execAsync(null, null, "Crypto", "decrypt", [seed, string]);
|
2010-09-07 02:13:09 +08:00
|
|
|
};
|
2010-02-25 08:19:01 +08:00
|
|
|
|
2010-09-07 02:13:09 +08:00
|
|
|
Crypto.prototype.gotCryptedString = function(string) {
|
|
|
|
this.encryptWin(string);
|
|
|
|
};
|
|
|
|
|
|
|
|
Crypto.prototype.getPlainString = function(string) {
|
|
|
|
this.decryptWin(string);
|
|
|
|
};
|
2010-02-25 08:19:01 +08:00
|
|
|
|
|
|
|
PhoneGap.addConstructor(function() {
|
2010-09-07 02:13:09 +08:00
|
|
|
if (typeof navigator.Crypto == "undefined") navigator.Crypto = new Crypto();
|
2010-02-25 08:19:01 +08:00
|
|
|
});
|
|
|
|
|