zerosec
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -1,7 +0,10 @@ | ||
import { ObfuscationPayload, ObfuscationResult, ObfuscationNode } from './interfaces'; | ||
import { ObfuscationPayload, ObfuscationResult, ObfuscationNode, ApiKeyInfo, Obfuscation } from './interfaces'; | ||
export default class ZeroSecAPI { | ||
private api; | ||
private apiKey; | ||
constructor(apiKey: string); | ||
obfuscate(payload: ObfuscationPayload): Promise<ObfuscationResult>; | ||
getApiKeyInfo(): Promise<ApiKeyInfo>; | ||
getObfuscations(): Promise<Obfuscation[]>; | ||
} | ||
export { ObfuscationNode, ObfuscationResult, ObfuscationPayload }; | ||
export { ObfuscationNode, ObfuscationResult, ObfuscationPayload, ApiKeyInfo, Obfuscation }; |
@@ -20,2 +20,3 @@ "use strict"; | ||
throw new Error('API key is required'); | ||
this.apiKey = apiKey; | ||
this.api = axios_1.default.create({ | ||
@@ -36,3 +37,19 @@ baseURL: 'https://api.zero.sex/v1', | ||
} | ||
getApiKeyInfo() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { data, status } = yield this.api.get(`/key/${this.apiKey}/info`); | ||
if (status !== 200) | ||
throw new Error(data.error); | ||
return data; | ||
}); | ||
} | ||
getObfuscations() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { data, status } = yield this.api.get(`/key/${this.apiKey}/obfuscations`); | ||
if (status !== 200) | ||
throw new Error(data.error); | ||
return data; | ||
}); | ||
} | ||
} | ||
exports.default = ZeroSecAPI; |
@@ -37,2 +37,4 @@ /** | ||
platformLock?: "lua" | "roblox" | "csgo" | "fivem"; | ||
/** The watermark for the obfuscated file */ | ||
watermark?: string; | ||
/** Enables prevention of tampering with the script. Requires support for `loadstring` or `load` in the environment. */ | ||
@@ -49,2 +51,44 @@ antiTamper?: boolean; | ||
} | ||
export { ObfuscationNode, ObfuscationResult, ObfuscationPayload }; | ||
/** | ||
* Represents the result of an api-key info request. | ||
*/ | ||
interface ApiKeyInfo { | ||
/** The ID of the API key. */ | ||
id: number; | ||
/** The API key. */ | ||
apiKey: string; | ||
/** The author of the API key. */ | ||
author: string; | ||
/** The amount of authentications made with the API key. */ | ||
authentications: number; | ||
/** Whether the API key is enabled or not. This can be changed by admins. */ | ||
enabled: boolean; | ||
/** The date at which the API key expires. */ | ||
expiresAt: string; | ||
/** The date at which the API key was created. */ | ||
createdAt: string; | ||
/** The date at which the API key was last updated. */ | ||
updatedAt: string; | ||
/** Whether the API key is active or not based on the expiration date. */ | ||
active: boolean; | ||
} | ||
/** | ||
* Represents the result of an obfuscation request. | ||
*/ | ||
interface Obfuscation { | ||
/** The ID of the obfuscation. */ | ||
id: number; | ||
/** The fingerprint of the obfuscation. */ | ||
fingerprint: string; | ||
/** The API key used for the obfuscation. */ | ||
apiKey: string; | ||
/** The size of the obfuscated file. */ | ||
fileSize: number; | ||
/** The IP address of the server that requested the obfuscation. */ | ||
ip: string; | ||
/** Whether the obfuscation was successful or not. */ | ||
success: boolean; | ||
/** The date at which the obfuscation was requested. */ | ||
createdAt: string; | ||
} | ||
export { ObfuscationNode, ObfuscationResult, ObfuscationPayload, ApiKeyInfo, Obfuscation }; |
{ | ||
"name": "zerosec", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "ZeroSec API binding as npm package for NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
18259
318