API Reference

Detailed specifications for the core methods exposed by the StickCode library.

async .init(licenseInput)

Initializes the crypt-engine asynchronously, evaluates structural integrity, and validates the hardware node fingerprint against the licensing cloud endpoint.

Arguments:
  • licenseInput (String | Object): A valid JSON object or a parsed equivalent string containing the signed license data (payload and signature).
// Example usage
await StickCode.init({
  payload: "eyJs...In0=",
  signature: "MEQCID..."
});

.encrypt(text, option)

Compresses the input text string using architectural Brotli specifications and returns a raw, hardened binary allocation (Buffer).

Arguments:
  • text (String): The raw data target intended for storage or networking.
  • option (Boolean / Optional):
    • Omitted (Default): Deploys full secure mode, scrambling the data via an advanced 256-bit GCM cipher layout with dynamic polymorph metrics.
    • true (Optimized Mode): Bypasses encryption entirely, routing the buffer strictly through Brotli compression and semantic color mapping to avoid data bloat on hashed components.
// 1. Standard Secure Processing (AES-256-GCM Layout)
const secureBuffer = StickCode.encrypt("Sensitive Information");

// 2. Storage Optimized Processing (Compression Only)
const compressedBuffer = StickCode.encrypt("AlreadySecureHash", true);

.decrypt(buffer)

Parses internal byte-markers out of the provided buffer allocations, automatically unpacking encryption envelopes and unrolling compression states to return original string states.

Arguments:
  • buffer (Buffer): The binary buffer output generated from a matching .encrypt() transaction.
💡 Robust Fallback: If decoding targets a non-encrypted raw asset or an alternate compressed state, the engine unrolls transparently to standard string streams rather than halting executions.
// Decodes both Secure and Optimized binary assets automatically
const originalText = StickCode.decrypt(encryptedBuffer);

.resetDevices()

Purges the local caching registry file (.device_registry) from the project directory. This triggers a full re-verification cycle on the subsequent .init() invocation.

⚠️ Note: This method only flushes the local token cache for testing or re-licensing purposes. It does not release or unregister the device slot from the remote licensing server database.
// Clear local cache token
StickCode.resetDevices();