mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +08:00
1d79b6617b
I did my best to clean up the JavaScript so it would pass through jsHint more cleanly. There still are issues but there are a lot fewer now. This helped to make the JS code more consistent.
44 lines
1.1 KiB
JavaScript
Executable File
44 lines
1.1 KiB
JavaScript
Executable File
/*
|
|
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
|
|
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
|
|
*
|
|
* Copyright (c) 2005-2010, Nitobi Software Inc.
|
|
* Copyright (c) 2010-2011, IBM Corporation
|
|
*/
|
|
|
|
// TODO: Needs to be commented
|
|
|
|
if (!PhoneGap.hasResource("crypto")) {
|
|
PhoneGap.addResource("crypto");
|
|
|
|
/**
|
|
* @constructor
|
|
*/
|
|
var Crypto = function() {
|
|
};
|
|
|
|
Crypto.prototype.encrypt = function(seed, string, callback) {
|
|
this.encryptWin = callback;
|
|
PhoneGap.exec(null, null, "Crypto", "encrypt", [seed, string]);
|
|
};
|
|
|
|
Crypto.prototype.decrypt = function(seed, string, callback) {
|
|
this.decryptWin = callback;
|
|
PhoneGap.exec(null, null, "Crypto", "decrypt", [seed, string]);
|
|
};
|
|
|
|
Crypto.prototype.gotCryptedString = function(string) {
|
|
this.encryptWin(string);
|
|
};
|
|
|
|
Crypto.prototype.getPlainString = function(string) {
|
|
this.decryptWin(string);
|
|
};
|
|
|
|
PhoneGap.addConstructor(function() {
|
|
if (typeof navigator.Crypto === "undefined") {
|
|
navigator.Crypto = new Crypto();
|
|
}
|
|
});
|
|
}
|