diff --git a/README.md b/README.md
index 22b3c8f..0d85b5b 100644
--- a/README.md
+++ b/README.md
@@ -51,14 +51,14 @@ Join our [GitHub Community Discussion](https://github.com/Blackplums/how2validat
Stay updated with the latest versions and downloads:
@@ -123,16 +123,15 @@ docker pull ghcr.io/blackplums/how2validate:main
```javascript
import { validate } from '@how2validate/how2validate';
-// Validate secrets programmatically
-const validationResult = validate(
- provider = "NPM",
- service = "NPM Access Token",
- secret = "<>",
- response = false,
- report = false,
- isBrowser = true
-);
-console.log(validationResult);
+# Validate secrets programmatically
+var validation_result = await validate(
+ provider="NPM",
+ service="NPM Access Token",
+ secret="<>",
+ response=False,
+ report="useremail@domain.com"
+)
+print(validation_result)
```
@@ -149,7 +148,7 @@ validation_result = validate(
service="NPM Access Token",
secret="<>",
response=False,
- report=False,
+ report="useremail@domain.com"
)
print(validation_result)
```
@@ -165,20 +164,20 @@ To see all available commands, use:
```bash
how2validate --help
-usage: How2Validate Tool
+usage: How2Validate Tool [options]
Validate various types of secrets for different services.
options:
- -h, --help show this help message and exit
- -secretscope Explore the secret universe. Your next target awaits.
- -provider PROVIDER Specify your provider. Unleash your validation arsenal.
- -service SERVICE Specify your target service. Validate your secrets with precision.
- -secret SECRET Unveil your secrets to verify their authenticity.
- -r, --response Monitor the status. View if your secret Active or InActive.
- -report Get detailed reports. Receive validated secrets via email [Alpha Feature].
- -v, --version Expose the version.
- --update Hack the tool to the latest version.
+ -h, --help show this help message and exit
+ -secretscope Explore the secret universe. Your next target awaits.
+ -p, --provider Specify your provider. Unleash your validation arsenal.
+ -s, --service Specify your target service. Validate your secrets with precision.
+ -sec, --secret Unveil your secrets to verify their authenticity.
+ -r, --response Monitor the status. View if your secret is Active or InActive.
+ -R, --report Get detailed reports. Receive validated secrets via email [Alpha Feature].
+ -v, --version Expose the version.
+ --update Hack the tool to the latest version.
Ensuring the authenticity of your secrets.
```
@@ -188,13 +187,21 @@ Ensuring the authenticity of your secrets.
#### Validate a Secret
```bash
-how2validate -provider NPM -service "NPM Access Token" -secret "<>"
+how2validate --provider NPM --service "NPM Access Token" --secret "<>"
+
+-- OR --
+
+how2validate -p NPM -s "NPM Access Token" -sec "<>"
```
#### Validate with Response Status
```bash
-how2validate -provider NPM -service "NPM Access Token" -secret "<>" -r
+how2validate --provider NPM --service "NPM Access Token" --secret "<>" --response
+
+-- OR --
+
+how2validate -p NPM -s "NPM Access Token" -sec "<>" -r
```
@@ -204,7 +211,7 @@ Detailed documentation of the **How2Validate API** for both JavaScript and Pytho
### JavaScript API
-`validate(provider, service, secret, response, report, isBrowser)`
+`validate(provider, service, secret, response, report)`
Validates a secret against the specified provider and service.
@@ -213,8 +220,7 @@ Validates a secret against the specified provider and service.
- `service` (string): The specific service or token type.
- `secret` (string): The secret to validate.
- `response` (boolean): If `true`, returns the full response.
- - `report` (boolean): If `true`, sends a detailed report via email (Alpha Feature).
- - `isBrowser` (boolean): Indicates if the validation is performed in a browser environment.
+ - `report` (string): Email Id to send a detailed report (Alpha Feature).
- **Returns:**
- `validationResult` (object): An object containing the validation status and details.
@@ -224,7 +230,7 @@ Validates a secret against the specified provider and service.
```javascript
import { validate } from '@how2validate/how2validate';
-const result = validate("NPM", "NPM Access Token", "<>", false, false, true);
+const result = validate("NPM", "NPM Access Token", "<>", true/false, "useremail@domain.com");
console.log(result);
```
@@ -239,7 +245,7 @@ Validates a secret against the specified provider and service.
- `service` (string): The specific service or token type.
- `secret` (string): The secret to validate.
- `response` (boolean): If `true`, returns the full response.
- - `report` (boolean): If `true`, sends a detailed report via email (Alpha Feature).
+ - `report` (string): Email Id to send a detailed report (Alpha Feature).
- **Returns:**
- `validation_result` (object): An object containing the validation status and details.
@@ -254,8 +260,8 @@ result = validate(
provider="NPM",
service="NPM Access Token",
secret="<>",
- response=False,
- report=False
+ response=True/False,
+ report="useremail@domain.com"
)
print(result)
```
diff --git a/src/js/README.md b/src/js/README.md
index 0dddf26..481b0c2 100644
--- a/src/js/README.md
+++ b/src/js/README.md
@@ -27,20 +27,20 @@ To see all available commands, use:
```npm
how2validate --help
-usage: How2Validate Tool
+usage: How2Validate Tool [options]
Validate various types of secrets for different services.
options:
- -h, --help show this help message and exit
- -secretscope Explore the secret universe. Your next target awaits.
- -provider PROVIDER Specify your provider. Unleash your validation arsenal.
- -service SERVICE Specify your target service. Validate your secrets with precision.
- -secret SECRET Unveil your secrets to verify their authenticity.
- -r, --response Monitor the status. View if your secret Active or InActive.
- -report Get detailed reports. Receive validated secrets via email [Alpha Feature].
- -v, --version Expose the version.
- --update Hack the tool to the latest version.
+ -h, --help show this help message and exit
+ -secretscope Explore the secret universe. Your next target awaits.
+ -p, --provider Specify your provider. Unleash your validation arsenal.
+ -s, --service Specify your target service. Validate your secrets with precision.
+ -sec, --secret Unveil your secrets to verify their authenticity.
+ -r, --response Monitor the status. View if your secret is Active or InActive.
+ -R, --report Get detailed reports. Receive validated secrets via email [Alpha Feature].
+ -v, --version Expose the version.
+ --update Hack the tool to the latest version.
Ensuring the authenticity of your secrets.
```
@@ -64,7 +64,7 @@ npx jsr add @how2validate/how2validate
import { validate } from '@how2validate/how2validate';
# Validate secrets programmatically
-var validation_result = validate(provider,service, secret, response, report, isBrowser)
+var validation_result = validate(provider,service, secret, response, report)
print(validation_result)
```
@@ -131,13 +131,12 @@ import { validate } from "jsr:@how2validate/how2validate";
import { validate } from '@how2validate/how2validate';
# Validate secrets programmatically
-var validation_result = validate(
+var validation_result = await validate(
provider="NPM",
service="NPM Access Token",
secret="<>",
response=False,
- report=False,
- isBrowser=True
+ report="useremail@domain.com"
)
print(validation_result)
diff --git a/src/js/config.json b/src/js/config.json
index 06d7c41..fa7c5c0 100644
--- a/src/js/config.json
+++ b/src/js/config.json
@@ -1,7 +1,7 @@
{
"DEFAULT": {
"package_name": "@how2validate/how2validate",
- "version": "0.0.1-beta.26"
+ "version": "0.0.1-beta.27"
},
"SECRET": {
"secret_active": "Active",
diff --git a/src/js/how2validate/handler/validator_handler.ts b/src/js/how2validate/handler/validator_handler.ts
index 368a7fa..5cc763f 100644
--- a/src/js/how2validate/handler/validator_handler.ts
+++ b/src/js/how2validate/handler/validator_handler.ts
@@ -16,7 +16,7 @@ import { ValidationResult } from "../utility/interface/validationResult.js"; //
* @param {string} secret - The secret (e.g., API key, token) to validate.
* @param {boolean} response - Indicates whether to include response data in the output.
* @param {string} [report] - Optional email address for sending validation reports.
- * @param {boolean} [isBrowser=false] - Indicates if the validation is occurring in a browser environment.
+ * @param {boolean} [isBrowser=true] - Indicates if the validation is occurring in a browser environment.
* @returns {Promise} A promise that resolves to a validation result object.
*/
type ValidatorFunction = (
@@ -25,7 +25,7 @@ type ValidatorFunction = (
secret: string,
response: boolean,
report: string,
- isBrowser?: boolean
+ isBrowser: boolean
) => Promise;
@@ -51,7 +51,7 @@ const serviceHandlers: Record = {
* @param {string} secret - The secret (e.g., API key, token) to validate.
* @param {boolean} response - A boolean indicating whether to include response data in the output.
* @param {string} [report] - An optional email address for sending validation reports.
- * @param {boolean} [isBrowser=false] - Indicates if the validation is occurring in a browser environment.
+ * @param {boolean} [isBrowser=true] - Indicates if the validation is occurring in a browser environment.
* @returns {Promise} A promise that resolves to the validation result or an error message.
*
* @example
@@ -64,7 +64,7 @@ export async function validatorHandleService(
secret: string,
response: boolean,
report: string,
- isBrowser: boolean = false
+ isBrowser: boolean = true
): Promise {
// Retrieve the handler function based on the provided service name
const handler = serviceHandlers[service];
diff --git a/src/js/how2validate/index.ts b/src/js/how2validate/index.ts
index 36af7c0..0119dec 100755
--- a/src/js/how2validate/index.ts
+++ b/src/js/how2validate/index.ts
@@ -119,7 +119,7 @@ export function getService(provider: string): object {
* @param {string} secret - The secret that needs to be validated.
* @param {boolean} response - Whether to get a response status for the secret.
* @param {string} report - Whether to generate a report for the validation.
- * @param {boolean} [isBrowser=false] - Whether the validation is being run in a browser environment.
+ * @param {boolean} [isBrowser=true] - Whether the validation is being run in a browser environment.
* @returns {Promise} - A promise that resolves when validation is complete.
* @throws Will throw an error if validation fails.
*/
@@ -129,7 +129,7 @@ export async function validate(
secret: string,
response: boolean,
report: string,
- isBrowser:boolean = false
+ isBrowser:boolean = true
): Promise {
const result = await validatorHandleService(
formatString(provider),
@@ -225,7 +225,8 @@ async function main(): Promise {
options.service,
options.secret,
options.response,
- options.report
+ options.report,
+ false
); // Call validate function
console.info("Validation completed successfully.");
} catch (error) {
diff --git a/src/js/how2validate/utility/tool_utility.ts b/src/js/how2validate/utility/tool_utility.ts
index d59e3c2..6bb6e99 100644
--- a/src/js/how2validate/utility/tool_utility.ts
+++ b/src/js/how2validate/utility/tool_utility.ts
@@ -543,7 +543,7 @@ export function handleActiveStatus(
// Log the result if not in the browser environment
if (!isBrowser) {
- console.info(`${res.message} ${responseFlag ? res.response : ""}`);
+ console.info(`${res.message}${responseFlag ? `\nHere is the additional response data:\n${JSON.stringify(activeResponseData, null, 4)}` : ""}`);
}
return activeResponseData;
@@ -567,7 +567,7 @@ export function handleInactiveStatus(
responseFlag: boolean,
data?: any,
report?: string,
- isBrowser: boolean = false
+ isBrowser: boolean = true
): ValidationResult{
const appName = "How2Validate";
const timestamp = getCurrentTimestamp();
@@ -595,7 +595,7 @@ export function handleInactiveStatus(
};
if (!isBrowser) {
- console.info(`${res.message} ${responseFlag ? res.response : ""}`);
+ console.info(`${res.message}${responseFlag ? `\nHere is the additional response data:\n${JSON.stringify(inactiveResponseData, null, 4)}` : ""}`);
}
return inactiveResponseData;
@@ -618,7 +618,7 @@ export function handleErrors(
responseFlag: boolean,
report: string,
error: unknown,
- isBrowser: boolean = false
+ isBrowser: boolean = true
): ValidationResult {
const appName = "How2Validate";
const timestamp = getCurrentTimestamp();
@@ -648,11 +648,14 @@ export function handleErrors(
provider: provider,
services: service
},
+ error:{
+ message: res.response,
+ },
timestamp,
};
if (!isBrowser) {
- console.info(`${res.message} ${responseFlag ? res.response : ""}`);
+ console.info(`${res.message}${responseFlag ? `\nHere is the additional response data:\n${JSON.stringify(errResponseData, null, 4)}` : ""}`);
}
return errResponseData;
diff --git a/src/js/how2validate/validators/npm/npm_access_token.ts b/src/js/how2validate/validators/npm/npm_access_token.ts
index 8fc6452..3743912 100644
--- a/src/js/how2validate/validators/npm/npm_access_token.ts
+++ b/src/js/how2validate/validators/npm/npm_access_token.ts
@@ -39,7 +39,7 @@ import axios from "axios"; // Axios for making API requests
* @param {string} secret - The NPM authentication token or secret to validate.
* @param {boolean} responseFlag - A flag to indicate whether detailed response data should be returned.
* @param {string} [report] - An optional email address to which a validation report should be sent.
- * @param {boolean} [isBrowser=false] - Indicates if the function is called from a browser environment (default is false).
+ * @param {boolean} [isBrowser=true] - Indicates if the function is called from a browser environment (default is false).
*
* @returns {Promise} - A promise that resolves to a `ValidationResult` object containing the validation result.
*
@@ -55,7 +55,7 @@ export async function validateNpmAccessToken(
secret: string,
responseFlag: boolean,
report: string,
- isBrowser: boolean = false
+ isBrowser: boolean = true
): Promise {
// Initialize the response structure
const validation_response = {} as SecretStatusMessage;
diff --git a/src/js/how2validate/validators/snyk/snyk_auth_key.ts b/src/js/how2validate/validators/snyk/snyk_auth_key.ts
index 358693d..3182229 100644
--- a/src/js/how2validate/validators/snyk/snyk_auth_key.ts
+++ b/src/js/how2validate/validators/snyk/snyk_auth_key.ts
@@ -39,7 +39,7 @@ import axios from "axios"; // Axios for making API requests
* @param {string} secret - The Snyk authentication token or secret to validate.
* @param {boolean} responseFlag - A flag to indicate whether detailed response data should be returned.
* @param {string} [report] - An optional email address to which a validation report should be sent.
- * @param {boolean} [isBrowser=false] - Indicates if the function is called from a browser environment (default is false).
+ * @param {boolean} [isBrowser=true] - Indicates if the function is called from a browser environment (default is false).
*
* @returns {Promise} - A promise that resolves to a `ValidationResult` object containing the validation result.
*
@@ -55,7 +55,7 @@ export async function validateSnykAuthKey(
secret: string,
responseFlag: boolean,
report: string,
- isBrowser: boolean = false
+ isBrowser: boolean = true
): Promise {
// Initialize the response structure
const validation_response = {} as SecretStatusMessage;
diff --git a/src/js/how2validate/validators/sonarcloud/sonarcloud_token.ts b/src/js/how2validate/validators/sonarcloud/sonarcloud_token.ts
index 14dbd08..395fa1b 100644
--- a/src/js/how2validate/validators/sonarcloud/sonarcloud_token.ts
+++ b/src/js/how2validate/validators/sonarcloud/sonarcloud_token.ts
@@ -39,7 +39,7 @@ import axios from "axios"; // Axios for making API requests
* @param {string} secret - The Sonarcloud authentication token or secret to validate.
* @param {boolean} responseFlag - A flag to indicate whether detailed response data should be returned.
* @param {string} [report] - An optional email address to which a validation report should be sent.
- * @param {boolean} [isBrowser=false] - Indicates if the function is called from a browser environment (default is false).
+ * @param {boolean} [isBrowser=true] - Indicates if the function is called from a browser environment (default is false).
*
* @returns {Promise} - A promise that resolves to a `ValidationResult` object containing the validation result.
*
@@ -55,7 +55,7 @@ export async function validateSonarcloudToken(
secret: string,
responseFlag: boolean,
report: string,
- isBrowser: boolean = false
+ isBrowser: boolean = true
): Promise {
// Initialize the response structure
const validation_response = {} as SecretStatusMessage;
diff --git a/src/js/jsr.json b/src/js/jsr.json
index d6dc637..8de564f 100644
--- a/src/js/jsr.json
+++ b/src/js/jsr.json
@@ -1,6 +1,6 @@
{
"name": "@how2validate/how2validate",
- "version": "0.0.2-beta.44",
+ "version": "0.0.2-beta.45",
"license": "MIT",
"exports": "./how2validate/index.ts",
"publish": {
diff --git a/src/js/package.json b/src/js/package.json
index 5cbde8a..72c77d0 100644
--- a/src/js/package.json
+++ b/src/js/package.json
@@ -1,7 +1,7 @@
{
"name": "how2validate",
"appName": "How2Validate",
- "version": "0.0.1-beta.26",
+ "version": "0.0.1-beta.27",
"description": "A CLI tool to validate secrets for different services.",
"main": "dist/how2validate/index.js",
"type": "module",
diff --git a/src/python/README.md b/src/python/README.md
index facd376..068e4b4 100644
--- a/src/python/README.md
+++ b/src/python/README.md
@@ -77,7 +77,7 @@ validation_result = validate(
service="NPM Access Token",
secret="<>",
response=False,
- report="useremail@domain.com",
+ report="useremail@domain.com"
)
print(validation_result)