package com.bridge.safe;

import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * This class echoes a string called from JavaScript.
 */
public class CDVsafe extends CordovaPlugin {

    @Override
    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
        if (action.equals("coolMethod")) {
            String message = args.getString(0);
            this.coolMethod(message, callbackContext);
            return true;
        }
        return false;
    }

    private void coolMethod(String message, CallbackContext callbackContext) {
        if (message != null && message.length() > 0) {
            callbackContext.success(message);
        } else {
            callbackContext.error("Expected one non-empty string argument.");
        }
    }
}

@@ -1,8 +1,59 @@
+/**%0A * @author Carlos Antonio%0A * @version 0.1.0%0A*/%0A
 package 
@@ -66,13 +66,8 @@
 idge
-.safe
 ;%0A%0Ai
@@ -316,12 +316,9 @@
 ass 
-CDVs
+S
 afe 
@@ -342,16 +342,131 @@
 ugin %7B%0A%0A
+  public static final String ENCRYPT_ACTION = %22encrypt%22;%0A  public static final String DECRYPT_ACTION = %22decrypt%22;%0A%0A
     @Ove
@@ -587,26 +587,24 @@
 ion %7B%0A      
-  
 if (action.e
@@ -613,29 +613,190 @@
 als(
-%22coolMethod%22)) %7B%0A    
+ENCRYPT_ACTION)) %7B%0A        String path = args.getString(0);%0A        this.encryptFile(path, callbackContext);%0A        return true;%0A      %7D%0A%0A      if (action.equals(DECRYPT_ACTION)) %7B%0A
     
@@ -806,23 +806,20 @@
  String 
-message
+path
  = args.
@@ -844,35 +844,29 @@
     
-    
 this.
-coolMethod(message
+decryptFile(path
 , ca
@@ -885,28 +885,24 @@
 t);%0A        
-   
- 
 return true;
@@ -908,22 +908,19 @@
 ;%0A      
-  %7D%0A  
+%7D%0A%0A
       re
@@ -959,26 +959,27 @@
 oid 
-coolMethod
+encryptFile
 (String 
 mess
@@ -974,23 +974,20 @@
 (String 
-message
+path
 , Callba
@@ -1025,21 +1025,16 @@
     
-  
 if (
-message
+path
  != 
@@ -1041,23 +1041,20 @@
 null && 
-message
+path
 .length(
@@ -1058,28 +1058,24 @@
 th() %3E 0) %7B%0A
-    
         call
@@ -1098,15 +1098,12 @@
 ess(
-message
+path
 );%0A 
@@ -1107,18 +1107,16 @@
 ;%0A      
- 
- 
 %7D else %7B
@@ -1116,20 +1116,16 @@
  else %7B%0A
-    
         
@@ -1150,54 +1150,239 @@
 ror(
-%22Expected one non-empty string argument.%22);%0A  
+2);%0A      %7D%0A    %7D%0A%0A    private void decryptFile(String path, CallbackContext callbackContext) %7B%0A      if (path != null && path.length() %3E 0) %7B%0A        callbackContext.success(path);%0A      %7D else %7B%0A        callbackContext.error(2);%0A
     

Encrypt method scaffold