Skip to content

Commit

Permalink
anonyflow init
Browse files Browse the repository at this point in the history
  • Loading branch information
jcortes committed Mar 6, 2024
1 parent 7e00712 commit 3e9bdd1
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import anonyflow from "../../anonyflow.app.mjs";
import { axios } from "@pipedream/platform";

export default {
key: "anonyflow-protect-sensitive-data",
name: "Protect Sensitive Data",
description: "Encrypts sensitive data using AnonyFlow encryption service with a unique private key managed by AnonyFlow. [See the documentation](https://anonyflow.com/api)",
version: "0.0.{{ts}}",
type: "action",
props: {
anonyflow,
sensitiveData: {
propDefinition: [
anonyflow,
"sensitiveData",
],
},
},
async run({ $ }) {
const encryptedResponse = await this.anonyflow.encryptData({
sensitiveData: this.sensitiveData,
});
$.export("$summary", "Sensitive data encrypted successfully");
return encryptedResponse;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import anonyflow from "../../anonyflow.app.mjs";
import { axios } from "@pipedream/platform";

export default {
key: "anonyflow-unprotect-sensitive-data",
name: "Unprotect Sensitive Data",
description: "Decrypts protected data using AnonyFlow decryption service with a unique private key, managed by AnonyFlow. [See the documentation](https://anonyflow.com/api)",
version: "0.0.{{ts}}",
type: "action",
props: {
anonyflow,
encryptedData: {
propDefinition: [
anonyflow,
"encryptedData",
],
},
},
async run({ $ }) {
const response = await this.anonyflow.decryptData({
encryptedData: this.encryptedData,
});

$.export("$summary", "Successfully decrypted the data");
return response;
},
};
54 changes: 51 additions & 3 deletions components/anonyflow/anonyflow.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,59 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "anonyflow",
propDefinitions: {},
propDefinitions: {
encryptedData: {
type: "string",
label: "Encrypted Data",
description: "The data to be decrypted",
},
sensitiveData: {
type: "string",
label: "Sensitive Data",
description: "The sensitive data to be encrypted",
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
},
_baseUrl() {
return "https://api.anonyflow.com";
},
async _makeRequest(opts = {}) {
const {
$ = this, method = "POST", path, data, headers, ...otherOpts
} = opts;
return axios($, {
...otherOpts,
method,
url: this._baseUrl() + path,
headers: {
...headers,
"Content-Type": "application/json",
"Authorization": `Bearer ${this.$auth.oauth_access_token}`,
},
data,
});
},
async encryptData({ sensitiveData }) {
return this._makeRequest({
path: "/anony-value",
data: {
value: sensitiveData,
},
});
},
async decryptData({ encryptedData }) {
return this._makeRequest({
path: "/deanony-value",
data: {
value: encryptedData,
},
});
},
},
};
version: "0.0.{{ts}}",
};
2 changes: 1 addition & 1 deletion components/anonyflow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"publishConfig": {
"access": "public"
}
}
}

0 comments on commit 3e9bdd1

Please sign in to comment.