Steganografia Kodek Online Dokumentacja Web API SDK

Zautomatyzuj ukrywanie sekretnych danych w obrazkach i zdjęciach z użyciem pakietów Web API SDK Steganografia Kodek Online (Python, JavaScript, Rust, C#, Go, Java, PHP, PowerShell i Ruby).

Opis

Możesz skorzystać ze wszystkich funkcji Steganografia Kodek Online poprzez nasz interfejs Web API. Interfejs Web API bazuje na zapytaniu POST i zwraca wynik zakodowany jako JSON.

Instalacja

Dla szybszego wdrożenia możesz zainstalować pakiety SDK poprzez popularne repozytoria bibliotek (PyPI, npm, crates.io, NuGet, pkg.go.dev, Maven, Packagist, PowerShell Gallery, RubyGems). Kody źródłowe są także dostępne na GitHubie:

Repozytorium Język Instalacja Pakiet Źródła
Repozytorium PyPI dla Pythona Python pip install steganography-online-codec PyPI GitHub
Język programowania JavaScript JavaScript

Run

npm i steganography-online-codec

lub dodaj do sekcji dependencies w pliku konfiguracyjnym package.json wpis:

"dependencies": {
"steganography-online-codec": "latest"
},

npm GitHub
Repozytorium Crates.io dla Rust Rust

Uruchom:

cargo add steganography-online-codec

lub dodaj w pliku Cargo.toml w sekcji [dependencies] wpis:

steganography-online-codec = "1"
Crates GitHub
Repozytorium NuGet C#

Uruchom:

dotnet add package SteganographyOnlineCodec

lub dodaj w pliku .csproj:

<PackageReference
Include="SteganographyOnlineCodec"
Version="1.0.1" />
NuGet GitHub
Pakiety modułów Go Go

Uruchom:

go get github.com/PELock/Steganography-Online-Codec-Go

lub dodaj poniższy wpis do pliku go.mod

require github.com/PELock/Steganography-Online-Codec-Go v1.0.2
Go GitHub
Centralne Repozytorium Maven Java Dodaj tę zależność do pliku pom.xml
<dependency>
  <groupId>com.pelock</groupId>
  <artifactId>steganography-online-codec</artifactId>
  <version>1.0.2</version>
</dependency>
Maven GitHub
Repozytorium Packagist dla Composera PHP

Uruchom:

php composer.phar require --prefer-dist pelock/steganography-online-codec "*"

lub dodaj do sekcji require w pliku konfiguracyjnym composer.json wpis:

"pelock/steganography-online-codec": "*"
Packagist GitHub
PowerShell Gallery PowerShell

Uruchom:

Install-Module -Name SteganographyOnlineCodec

lub:

Install-PSResource -Name SteganographyOnlineCodec

PowerShell Gallery GitHub
Repozytorium RubyGems Ruby

Uruchom:

gem install steganography-online-codec

lub dodaj poniższy wpis do pliku Gemfile

gem "steganography-online-codec"
RubyGems GitHub

Przykłady użycia

Ukrywanie zaszyfrowanej wiadomości w pliku obrazka

#!/usr/bin/env python

###############################################################################
#
# Steganography Online Codec WebApi interface usage example.
#
# This example shows how to hide an encrypted secret message in an image file.
#
# Version      : v1.00
# Language     : Python
# Author       : Bartosz Wójcik
# Project      : https://www.pelock.com/products/steganography-online-codec
# Homepage     : https://www.pelock.com
#
###############################################################################

#
# include Steganography Online Codec module
#
from steganography_online_codec import *

#
# create Steganography Online Codec class instance (we are using our activation key)
#
mySteganographyOnlineCodec = SteganographyOnlineCodec("YOUR-WEB-API-KEY")

#
# encode a hidden message (encrypted with your password) within an image file
#
result = mySteganographyOnlineCodec.encode("input_file.jpg", "Secret message", "Pa$$word", "output_file_with_hidden_secret_message.png")

#
# result[] array holds the encoding results as well as other information
#
if result and "error" in result:
    if result["error"] == Errors.SUCCESS:
        print(f'Secret message encoded and saved to the output PNG file.')
    else:
        print(f'Error code {result["error"]}')
else:
    print("Something unexpected happen while trying to encode the message.")
"use strict";

/******************************************************************************
 *
 * Steganography Online Codec WebApi interface usage example.
 *
 * In this example shows how to hide an encrypted secret message in an image file.
 *
 * Version      : v1.00
 * Language     : JavaScript
 * Author       : Bartosz Wójcik (original example)
 * Project      : https://www.pelock.com/products/steganography-online-codec
 * Homepage     : https://www.pelock.com
 *
 * @link https://www.pelock.com/products/steganography-online-codec
 * @copyright Copyright (c) 2020-2025 PELock LLC
 * @license Apache-2.0
 *
/*****************************************************************************/

// include Steganography Online Codec module
import { SteganographyOnlineCodec, Errors } from 'steganography-online-codec';
// or if tested locally use:
//import { SteganographyOnlineCodec, Errors } from '../src/SteganographyOnlineCodec.mjs';

// create Steganography Online Codec class instance (we are using our activation key)
const mySteganographyOnlineCodec = new SteganographyOnlineCodec('YOUR-WEB-API-KEY');

// encode a hidden message (encrypted with your password) within an image file
(async () => {

	const inputFile = 'input_file.jpg';
	const secretMessage = 'Secret message';
	const password = 'Pa$$word';
	const outputFile = 'output_file_with_hidden_secret_message.png';

	try {
		const result = await mySteganographyOnlineCodec.encode(inputFile, secretMessage, password, outputFile);

		// result object holds the encoding results as well as other information
		console.log('Secret message encoded and saved to the output PNG file.');
	} catch (err) {
		console.error('Encoding failed:', err.error_message || err.message || String(err));
	}
})();
// Example: hide an encrypted secret message in an image via the Web API.

use steganography_online_codec::SteganographyOnlineCodec;

#[tokio::main]
async fn main() {
    let my_steganography_online_codec =
        SteganographyOnlineCodec::new(Some("YOUR-WEB-API-KEY".to_string()));

    let input_file = "input_file.jpg";
    let secret_message = "Secret message";
    let password = "Pa$$word";
    let output_file = "output_file_with_hidden_secret_message.png";

    match my_steganography_online_codec
        .encode(input_file, secret_message, password, output_file)
        .await
    {
        Ok(_result) => {
            println!("Secret messaged encoded and saved to the output PNG file.");
        }
        Err(err) => {
            eprintln!("Encoding failed: {}", err.error_message());
        }
    }
}
/******************************************************************************
 *
 * Steganography Online Codec WebApi interface usage example.
 *
 * In this example shows how to hide an encrypted secret message in an image file.
 *
 * Version      : v1.00
 * Language     : C#
 * Author       : Bartosz Wójcik (original example)
 * Project      : https://www.pelock.com/products/steganography-online-codec
 * Homepage     : https://www.pelock.com
 *
 * @copyright Copyright (c) 2020-2026 PELock LLC
 * @license Apache-2.0
 *
 ******************************************************************************/

using PELock;
// NuGet PackageReference Include="SteganographyOnlineCodec"
// or locally: dotnet add reference ..\src\SteganographyOnlineCodec\SteganographyOnlineCodec.csproj

// create Steganography Online Codec class instance (activation key placeholder)
using var codec = new SteganographyOnlineCodec("YOUR-WEB-API-KEY");

// encode a hidden message (encrypted with your password) within an image file
const string InputFile = "input_file.jpg";
const string SecretMessage = "Secret message";
const string Password = "Pa$$word";
const string OutputFile = "output_file_with_hidden_secret_message.png";

try
{
	await codec.EncodeAsync(InputFile, SecretMessage, Password, OutputFile).ConfigureAwait(false);

	// EncodeResult exposes license telemetry when available.
	Console.WriteLine("Secret messaged encoded and saved to the output PNG file.");
}
catch (SteganographyApiException err)
{
	Console.Error.WriteLine("Encoding failed: " + (!string.IsNullOrEmpty(err.Message)
		? err.Message
		: $"Error code {err.Error}"));
}
/******************************************************************************
 * Steganography Online Codec WebApi interface usage example.
 *
 * This example shows how to hide an encrypted secret message in an image file.
 *
 * Version        : v1.0.2
 * Language       : Go
 * Author         : Bartosz Wójcik
 * Web page       : https://www.pelock.com
 *
 *****************************************************************************/

package main

import (
	"context"
	"fmt"
	"os"

	steganographyonlinecodec "github.com/PELock/Steganography-Online-Codec-Go"
)

func main() {
	client := steganographyonlinecodec.New("YOUR-WEB-API-KEY")
	result, err := client.Encode(context.Background(), "input_file.jpg", "Secret message", "Pa$$word", "output_file_with_hidden_secret_message.png")
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	if result.Error == steganographyonlinecodec.ErrorSuccess {
		fmt.Println("Secret message encoded and saved to the output PNG file.")
		return
	}
	fmt.Printf("Error code %d\n", result.Error)
}
/******************************************************************************
 * Steganography Online Codec WebApi interface usage example.
 *
 * This example shows how to hide an encrypted secret message in an image file.
 *
 * Version        : v1.0.2
 * Language       : Java
 * Author         : Bartosz Wójcik
 * Web page       : https://www.pelock.com
 *
 *****************************************************************************/

import com.fasterxml.jackson.databind.JsonNode;
import com.pelock.steganography.Errors;
import com.pelock.steganography.SteganographyOnlineCodec;

public class SteganographySimpleExample {

  public static void main(String[] args) throws Exception {
    SteganographyOnlineCodec client = new SteganographyOnlineCodec("YOUR-WEB-API-KEY");
    JsonNode result =
        client.encode(
            "input_file.jpg",
            "Secret message",
            "Pa$$word",
            "output_file_with_hidden_secret_message.png");

    if (result != null && result.has("error")) {
      if (result.get("error").asInt() == Errors.SUCCESS) {
        System.out.println("Secret message encoded and saved to the output PNG file.");
      } else {
        System.out.println("Error code " + result.get("error").asInt());
      }
    } else {
      System.out.println("Something unexpected happened while trying to encode the message.");
    }
  }
}
<?php

declare(strict_types=1);

use PELock\SteganographyOnlineCodec\Errors;
use PELock\SteganographyOnlineCodec\SteganographyOnlineCodec;

require __DIR__ . "/vendor/autoload.php";

$client = new SteganographyOnlineCodec("YOUR-WEB-API-KEY");
$result = $client->encode("input_file.jpg", "Secret message", "Pa$$word", "output_file_with_hidden_secret_message.png");

if ($result && array_key_exists("error", $result)) {
    if ($result["error"] === Errors::SUCCESS) {
        echo "Secret message encoded and saved to the output PNG file.\n";
    } else {
        echo "Error code {$result["error"]}\n";
    }
} else {
    echo "Something unexpected happened while trying to encode the message.\n";
}
################################################################################
#
# Steganography Online Codec WebApi interface usage example.
#
# Encode a secret message into an image.
#
# Version        : v1.0.0
# Language       : PowerShell
# Author         : Bartosz Wójcik
# Web page       : https://www.pelock.com
#
################################################################################

using module SteganographyOnlineCodec

$client = New-SteganographyOnlineCodec -ApiKey 'YOUR-WEB-API-KEY'
$result = $client.Encode('input_file.jpg', 'Secret message', 'Pa$$word', 'output_file_with_hidden_secret_message.png')

if ($result -and $result.ContainsKey('error')) {
    if ($result.error -eq [SteganographyErrors]::SUCCESS) {
        Write-Host 'Secret message encoded and saved to the output PNG file.'
    }
    else {
        Write-Host ("Error code {0}" -f $result.error)
    }
}
else {
    Write-Host 'Something unexpected happened while trying to encode the message.'
}
# frozen_string_literal: true

###############################################################################
#
# Steganography Online Codec — hide an encrypted message
#
# Version        : v1.0.2
# Language       : Ruby
# Author         : Bartosz Wójcik
# Web page       : https://www.pelock.com
#
###############################################################################

require "steganography-online-codec"

client = SteganographyOnlineCodec.new("YOUR-WEB-API-KEY")
result = client.encode("input_file.jpg", "Secret message", "Pa$$word", "output_file_with_hidden_secret_message.png")

if result && result["error"] == SteganographyOnlineCodec::Errors::SUCCESS
  puts "Secret message encoded and saved to the output PNG file."
elsif result
  warn "Error code: #{result["error"]}"
else
  warn "Something unexpected happened while trying to encode the message."
end

Wydobycie ukrytej, sekretnej wiadomości z zakodowanego obrazka

#!/usr/bin/env python

###############################################################################
#
# Steganography Online Codec WebApi interface usage example.
#
# In this example, we will see how to extract a previously encrypted & hidden
# secret message from an image file.
#
# Version      : v1.00
# Language     : Python
# Author       : Bartosz Wójcik
# Project      : https://www.pelock.com/products/steganography-online-codec
# Homepage     : https://www.pelock.com
#
###############################################################################

#
# include Steganography Online Codec module
#
from steganography_online_codec import *

#
# if you don't want to use Python module, you can import directly from the file
#
#from pelock.steganography_online_codec import *


#
# create Steganography Online Codec class instance (we are using our activation key)
#
mySteganographyOnlineCodec = SteganographyOnlineCodec("YOUR-WEB-API-KEY")

#
# extract a hidden message from the previously encoded image file
#

# full version image size limit is set to 10 MB (demo 50 kB max)
# supported image format is PNG and only PNG!
input_file_path = "output_file_with_hidden_secret_message.png"

# full version password length is 128 characters max (demo 8 chars max)
password = "Pa$$word"

# extract a hidden message from the image (PNG files only)
result = mySteganographyOnlineCodec.decode(input_file_path, password)

#
# result[] Dict holds the decoding results as well as other information
#
if result and "error" in result:

    print(f'You are running in {"full" if result["license"]["activationStatus"] is True else "demo"} version')

    if result["error"] == Errors.SUCCESS:
        print(f'Secret message is "{result["message"]}"')
        print(f'Remaining number of usage credits - {result["license"]["usagesCount"]}')
    elif result["error"] == Errors.INVALID_INPUT:
        print(f'Invalid input file {input_file_path} or file doesn''t exist')
    elif result["error"] == Errors.IMAGE_TOO_BIG:
        print(f'Image file is too big, current limit is set to {mySteganographyOnlineCodec.convert_size(result["limits"]["maxFileSize"])}')
    elif result["error"] == Errors.LIMIT_MESSAGE:
        print(f'Extracted message is too long, current limit is set to {result["limits"]["maxMessageLen"]}')
    elif result["error"] == Errors.LIMIT_PASSWORD:
        print(f'Password is too long, current limit is set to {result["limits"]["maxPasswordLen"]}')
    elif result["error"] == Errors.INVALID_PASSWORD:
        print(f'Invalid password')
    else:
        print(f'An unknown error occurred, error code: {result["error"]}')
else:
    print("Something unexpected happen while trying to extract the secret message.")
"use strict";

/******************************************************************************
 *
 * Steganography Online Codec WebApi interface usage example.
 *
 * In this example, we will see how to extract a previously encrypted & hidden
 * secret message from an image file.
 *
 * Version      : v1.00
 * Language     : JavaScript
 * Author       : Bartosz Wójcik
 * Project      : https://www.pelock.com/products/steganography-online-codec
 * Homepage     : https://www.pelock.com
 *
 * @link https://www.pelock.com/products/steganography-online-codec
 * @copyright Copyright (c) 2020-2025 PELock LLC
 * @license Apache-2.0
 *
 /*****************************************************************************/

// include Steganography Online Codec module
import { SteganographyOnlineCodec, Errors } from 'steganography-online-codec';
// or if tested locally use:
//import { SteganographyOnlineCodec, Errors } from '../src/SteganographyOnlineCodec.mjs';

// create Steganography Online Codec class instance (we are using our activation key)
const mySteganographyOnlineCodec = new SteganographyOnlineCodec('YOUR-WEB-API-KEY');

// extract a hidden message from the previously encoded image file
(async () => {
	// full version image size limit is set to 10 MB (demo 50 kB max)
	// supported image format is PNG and only PNG!
	const inputFilePath = 'output_file_with_hidden_secret_message.png';

	// full version password length is 128 characters max (demo 8 chars max)
	const password = 'Pa$$word';

	try {
		// extract a hidden message from the image (PNG files only)
		const result = await mySteganographyOnlineCodec.decode(inputFilePath, password);

		// result object holds the decoding results as well as other information
		console.log(`You are running in ${result.license?.activationStatus ? 'full' : 'demo'} version`);

		console.log(`Secret message is "${result.message}"`);

		if (result.license && result.license.usagesCount !== undefined) {
			console.log(`Remaining number of usage credits - ${result.license.usagesCount}`);
		}
	} catch (err) {
		switch (err.error) {
			case Errors.INVALID_INPUT:
				console.log(`Invalid input file ${inputFilePath} or file doesn't exist`);
				break;
			case Errors.IMAGE_TOO_BIG:
				console.log(`Image file is too big, current limit is set to ${err.raw?.limits?.maxFileSize ?? 'unknown'}`);
				break;
			case Errors.LIMIT_MESSAGE:
				console.log(`Extracted message is too long, current limit is set to ${err.raw?.limits?.maxMessageLen ?? 'unknown'}`);
				break;
			case Errors.LIMIT_PASSWORD:
				console.log(`Password is too long, current limit is set to ${err.raw?.limits?.maxPasswordLen ?? 'unknown'}`);
				break;
			case Errors.INVALID_PASSWORD:
				console.log('Invalid password');
				break;
			default:
				console.log(`An error occurred: ${err.error_message ?? String(err)}`);
		}
	}
})();
// Example: decode (extract) a hidden message from a PNG.

use steganography_online_codec::{errors, SteganographyOnlineCodec};

#[tokio::main]
async fn main() {
    let my_steganography_online_codec =
        SteganographyOnlineCodec::new(Some("YOUR-WEB-API-KEY".to_string()));

    // full version image size limit is set to 10 MB (demo 50 kB max)
    // supported image format is PNG and only PNG!
    let input_file_path = "output_file_with_hidden_secret_message.png";

    // full version password length is 128 characters max (demo 8 chars max)
    let password = "Pa$$word";

    match my_steganography_online_codec
        .decode(input_file_path, password)
        .await
    {
        Ok(result) => {
            let full = result
                .license
                .as_ref()
                .and_then(|l| l.activation_status)
                .unwrap_or(false);
            println!(
                "You are running in {} version",
                if full { "full" } else { "demo" }
            );

            let msg = result.message.as_deref().unwrap_or("");
            println!("Secret message is \"{msg}\"");

            if let Some(ref lic) = result.license {
                if let Some(c) = lic.usages_count {
                    println!("Remaining number of usage credits - {c}");
                }
            }
        }
        Err(err) => match err.code() {
            errors::INVALID_INPUT => {
                println!(
                    "Invalid input file {} or file doesn't exist",
                    input_file_path
                );
            }
            errors::IMAGE_TOO_BIG => {
                let lim = err
                    .raw()
                    .and_then(|j| j.get("limits"))
                    .and_then(|l| l.get("maxFileSize"))
                    .map(|v| v.to_string())
                    .unwrap_or_else(|| "unknown".to_string());
                println!("Image file is too big, current limit is set to {lim}");
            }
            errors::LIMIT_MESSAGE => {
                let lim = err
                    .raw()
                    .and_then(|j| j.get("limits"))
                    .and_then(|l| l.get("maxMessageLen"))
                    .map(|v| v.to_string())
                    .unwrap_or_else(|| "unknown".to_string());
                println!(
                    "Extracted message is too long, current limit is set to {lim}"
                );
            }
            errors::LIMIT_PASSWORD => {
                let lim = err
                    .raw()
                    .and_then(|j| j.get("limits"))
                    .and_then(|l| l.get("maxPasswordLen"))
                    .map(|v| v.to_string())
                    .unwrap_or_else(|| "unknown".to_string());
                println!("Password is too long, current limit is set to {lim}");
            }
            errors::INVALID_PASSWORD => {
                println!("Invalid password");
            }
            _ => {
                println!("An error occurred: {}", err.error_message());
            }
        },
    }
}
/******************************************************************************
 *
 * Steganography Online Codec WebApi interface usage example.
 *
 * In this example, we will see how to extract a previously encrypted & hidden
 * secret message from an image file.
 *
 * Version      : v1.00
 * Language     : C#
 * Author       : Bartosz Wójcik
 * Project      : https://www.pelock.com/products/steganography-online-codec
 * Homepage     : https://www.pelock.com
 *
 * @copyright Copyright (c) 2020-2026 PELock LLC
 * @license Apache-2.0
 *
 ******************************************************************************/

using System.Text.Json;
using PELock;

// NuGet PackageReference Include="SteganographyOnlineCodec"
// or locally: dotnet add reference ..\src\SteganographyOnlineCodec\SteganographyOnlineCodec.csproj

// create Steganography Online Codec class instance (activation key placeholder)
using var codec = new SteganographyOnlineCodec("YOUR-WEB-API-KEY");

// extract a hidden message from the previously encoded image file
// full version image size limit is set to 10 MB (demo 50 kB max)
// supported image format is PNG and only PNG!
string inputFilePath = "output_file_with_hidden_secret_message.png";

// full version password length is 128 characters max (demo 8 chars max)
const string Password = "Pa$$word";

try
{
	// extract a hidden message from the image (PNG files only)
	DecodeResult result =
		await codec.DecodeAsync(inputFilePath, Password).ConfigureAwait(false);

	string runningVersion = result.License?.ActivationStatus == true ? "full" : "demo";

	Console.WriteLine($"You are running in {runningVersion} version");

	Console.WriteLine($"Secret message is \"{result.Message}\"");

	if (result.License?.UsagesCount.HasValue ?? false)
		Console.WriteLine($"Remaining number of usage credits - {result.License!.UsagesCount}");
}
catch (SteganographyApiException err)
{
	switch (err.Error)
	{
	case Errors.InvalidInput:
		Console.WriteLine($"Invalid input file {inputFilePath} or file doesn't exist");
		break;
	case Errors.ImageTooBig:
		Console.WriteLine($"Image file is too big, current limit is set to {ReadLimitDecode(err.Raw, "maxFileSize")}");
		break;
	case Errors.LimitMessage:
		Console.WriteLine($"Extracted message is too long, current limit is set to {ReadLimitDecode(err.Raw, "maxMessageLen")}");
		break;
	case Errors.LimitPassword:
		Console.WriteLine($"Password is too long, current limit is set to {ReadLimitDecode(err.Raw, "maxPasswordLen")}");
		break;
	case Errors.InvalidPassword:
		Console.WriteLine("Invalid password");
		break;
	default:
		Console.WriteLine($"An error occurred: {(string.IsNullOrEmpty(err.Message) ? $"API error code {err.Error}" : err.Message)}");
		break;
	}
}

static string ReadLimitDecode(JsonElement? payload, string key)
{
	if (payload.HasValue &&
		payload.Value.TryGetProperty("limits", out JsonElement limits) &&
		limits.TryGetProperty(key, out JsonElement probe) &&
		probe.ValueKind == JsonValueKind.Number &&
		probe.TryGetInt64(out long value))
	{
		return value.ToString();
	}

	return "unknown";
}

/******************************************************************************
 * Steganography Online Codec WebApi interface usage example.
 *
 * This example shows how to extract a previously encrypted secret message.
 *
 * Version        : v1.0.2
 * Language       : Go
 * Author         : Bartosz Wójcik
 * Web page       : https://www.pelock.com
 *
 *****************************************************************************/

package main

import (
	"context"
	"fmt"
	"os"

	steganographyonlinecodec "github.com/PELock/Steganography-Online-Codec-Go"
)

func main() {
	client := steganographyonlinecodec.New("YOUR-WEB-API-KEY")
	result, err := client.Decode(context.Background(), "output_file_with_hidden_secret_message.png", "Pa$$word")
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	if result.Error != steganographyonlinecodec.ErrorSuccess {
		fmt.Printf("Error code %d\n", result.Error)
		os.Exit(1)
	}
	fmt.Println(result.Message)
}
/******************************************************************************
 * Steganography Online Codec WebApi interface usage example.
 *
 * This example shows how to extract a previously encrypted secret message.
 *
 * Version        : v1.0.2
 * Language       : Java
 * Author         : Bartosz Wójcik
 * Web page       : https://www.pelock.com
 *
 *****************************************************************************/

import com.fasterxml.jackson.databind.JsonNode;
import com.pelock.steganography.Errors;
import com.pelock.steganography.SteganographyOnlineCodec;

public class SteganographyExtractExample {

  public static void main(String[] args) throws Exception {
    SteganographyOnlineCodec client = new SteganographyOnlineCodec("YOUR-WEB-API-KEY");
    JsonNode result = client.decode("output_file_with_hidden_secret_message.png", "Pa$$word");

    if (result != null && result.has("error")) {
      if (result.get("error").asInt() == Errors.SUCCESS) {
        System.out.println("Secret message is \"" + result.path("message").asText() + "\"");
      } else {
        System.out.println("Error code " + result.get("error").asInt());
      }
    } else {
      System.out.println("Something unexpected happened while trying to extract the secret message.");
    }
  }
}
<?php

declare(strict_types=1);

use PELock\SteganographyOnlineCodec\Errors;
use PELock\SteganographyOnlineCodec\SteganographyOnlineCodec;

require __DIR__ . "/vendor/autoload.php";

$client = new SteganographyOnlineCodec("YOUR-WEB-API-KEY");
$result = $client->decode("output_file_with_hidden_secret_message.png", "Pa$$word");

if ($result && array_key_exists("error", $result)) {
    if ($result["error"] === Errors::SUCCESS) {
        echo "Secret message is \"{$result["message"]}\"\n";
    } else {
        echo "Error code {$result["error"]}\n";
    }
} else {
    echo "Something unexpected happened while trying to extract the secret message.\n";
}
################################################################################
#
# Steganography Online Codec WebApi interface usage example.
#
# Decode a secret message from an image.
#
# Version        : v1.0.0
# Language       : PowerShell
# Author         : Bartosz Wójcik
# Web page       : https://www.pelock.com
#
################################################################################

using module SteganographyOnlineCodec

$client = New-SteganographyOnlineCodec -ApiKey 'YOUR-WEB-API-KEY'
$result = $client.Decode('output_file_with_hidden_secret_message.png', 'Pa$$word')

if ($result -and $result.ContainsKey('error')) {
    if ($result.error -eq [SteganographyErrors]::SUCCESS) {
        Write-Host ("Secret message is `"{0}`"" -f $result.message)
    }
    else {
        Write-Host ("Error code {0}" -f $result.error)
    }
}
else {
    Write-Host 'Something unexpected happened while trying to extract the secret message.'
}
# frozen_string_literal: true

###############################################################################
#
# Steganography Online Codec — extract a hidden message
#
# Version        : v1.0.2
# Language       : Ruby
# Author         : Bartosz Wójcik
# Web page       : https://www.pelock.com
#
###############################################################################

require "steganography-online-codec"

client = SteganographyOnlineCodec.new("YOUR-WEB-API-KEY")
result = client.decode("output_file_with_hidden_secret_message.png", "Pa$$word")

if result && result["error"] == SteganographyOnlineCodec::Errors::SUCCESS
  puts "Secret message is \"#{result["message"]}\""
elsif result
  warn "Error code: #{result["error"]}"
else
  warn "Something unexpected happened while trying to extract the secret message."
end

Ukrycie sekretnej wiadomości w zdjęciu (rozszerzona obsługa błędów)

#!/usr/bin/env python

###############################################################################
#
# Steganography Online Codec WebApi interface usage example.
#
# In this example, we will see how to hide an encrypted message in an
# image file using our codec.
#
# Version      : v1.00
# Language     : Python
# Author       : Bartosz Wójcik
# Project      : https://www.pelock.com/products/steganography-online-codec
# Homepage     : https://www.pelock.com
#
###############################################################################

#
# include Steganography Online Codec module
#
from steganography_online_codec import *

#
# if you don't want to use Python module, you can import directly from the file
#
#from pelock.steganography_online_codec import *

#
# create Steganography Online Codec class instance (we are using our activation key)
#
mySteganographyOnlineCodec = SteganographyOnlineCodec("YOUR-WEB-API-KEY")

#
# encode a hidden message within the source image file
#

# full version image size limit is set to 10 MB (demo 50 kB max)
# supported image formats are PNG, JPG, GIF, BMP, WBMP, GD2, AVIF, WEBP (mail me for more)
input_file_path = "input_file.webp"

# full version message size is unlimited (demo 16 chars max)
secret_message = "Secret message"

# full version password length is 128 characters max (demo 8 chars max)
password = "Pa$$word"

# where to save encoded image with the secret message
output_file_path = "output_file_with_hidden_secret_message.png"

# encode a hidden message (encrypted with your password) within an image file
result = mySteganographyOnlineCodec.encode(input_file_path, secret_message, password, output_file_path)

#
# result[] array holds the encoding results as well as other information
#
if result and "error" in result:

    print(f'You are running in {"full" if result["license"]["activationStatus"] is True else "demo"} version')

    if result["error"] == Errors.SUCCESS:
        print(f'Secret message encoded and saved to {output_file_path}')
        print(f'Remaining number of usage credits - {result["license"]["usagesCount"]}')
    elif result["error"] == Errors.INVALID_INPUT:
        print(f'Invalid input file {input_file_path} or file doesn''t exist')
    elif result["error"] == Errors.MESSAGE_TOO_LONG:
        print(f'Message is too long for the provided image file, use larger file')
    elif result["error"] == Errors.IMAGE_TOO_BIG:
        print(f'Image file is too big, current limit is set to {mySteganographyOnlineCodec.convert_size(result["limits"]["maxFileSize"])}')
    elif result["error"] == Errors.LIMIT_MESSAGE:
        print(f'Message is too long, current limit is set to {result["limits"]["maxMessageLen"]}')
    elif result["error"] == Errors.LIMIT_PASSWORD:
        print(f'Password is too long, current limit is set to {result["limits"]["maxPasswordLen"]}')
    elif result["error"] == Errors.INVALID_PASSWORD:
        print(f'Invalid password')
    else:
        print(f'An unknown error occurred, error code: {result["error"]}')
else:
    print("Something unexpected happen while trying to encode the message.")
"use strict";

/******************************************************************************
 *
 * Steganography Online Codec WebApi interface usage example.
 *
 * In this example, we will see how to hide an encrypted message in an
 * image file using our codec.
 *
 * Version      : v1.00
 * Language     : JavaScript
 * Author       : Bartosz Wójcik
 * Project      : https://www.pelock.com/products/steganography-online-codec
 * Homepage     : https://www.pelock.com
 *
 * @link https://www.pelock.com/products/steganography-online-codec
 * @copyright Copyright (c) 2020-2025 PELock LLC
 * @license Apache-2.0
 *
 /*****************************************************************************/

// include Steganography Online Codec module
import { SteganographyOnlineCodec, Errors } from 'steganography-online-codec';
// or if tested locally use:
//import { SteganographyOnlineCodec, Errors } from '../src/SteganographyOnlineCodec.mjs';


// create Steganography Online Codec class instance (we are using our activation key)
const mySteganographyOnlineCodec = new SteganographyOnlineCodec('YOUR-WEB-API-KEY');

// encode a hidden message within the source image file
(async () => {
	// full version image size limit is set to 10 MB (demo 50 kB max)
	// supported image formats are PNG, JPG, GIF, BMP, WBMP, GD2, AVIF, WEBP (mail me for more)
	const inputFilePath = 'input_file.webp';

	// full version message size is unlimited (demo 16 chars max)
	const secretMessage = 'Secret message';

	// full version password length is 128 characters max (demo 8 chars max)
	const password = 'Pa$$word';

	// where to save encoded image with the secret message
	const outputFilePath = 'output_file_with_hidden_secret_message.png';

	try {
		// encode a hidden message (encrypted with your password) within an image file
		const result = await mySteganographyOnlineCodec.encode(inputFilePath, secretMessage, password, outputFilePath);

		// result object holds the encoding results as well as other information
		const versionType = result.license && result.license.activationStatus ? 'full' : 'demo';
		console.log(`You are running in ${versionType} version`);

		console.log(`Secret message encoded and saved to ${outputFilePath}`);
		if (result.license && result.license.usagesCount !== undefined) {
			console.log(`Remaining number of usage credits - ${result.license.usagesCount}`);
		}
	} catch (err) {
		const errorCode = err.error;

		switch (errorCode) {
			case Errors.INVALID_INPUT:
				console.log(`Invalid input file ${inputFilePath} or file doesn't exist`);
				break;
			case Errors.MESSAGE_TOO_LONG:
				console.log('Message is too long for the provided image file, use larger file');
				break;
			case Errors.IMAGE_TOO_BIG:
				console.log(`Image file is too big, current limit is set to ${err.raw?.limits?.maxFileSize ?? 'unknown'}`);
				break;
			case Errors.LIMIT_MESSAGE:
				console.log(`Message is too long, current limit is set to ${err.raw?.limits?.maxMessageLen ?? 'unknown'}`);
				break;
			case Errors.LIMIT_PASSWORD:
				console.log(`Password is too long, current limit is set to ${err.raw?.limits?.maxPasswordLen ?? 'unknown'}`);
				break;
			case Errors.INVALID_PASSWORD:
				console.log('Invalid password');
				break;
			default:
				console.log(`An error occurred: ${err.error_message ?? `Error code ${errorCode}`}`);
		}
	}
})();
// Example: encode with error-code handling (demo vs full limits).

use steganography_online_codec::{errors, SteganographyOnlineCodec};

#[tokio::main]
async fn main() {
    let my_steganography_online_codec =
        SteganographyOnlineCodec::new(Some("YOUR-WEB-API-KEY".to_string()));

    // full version image size limit is set to 10 MB (demo 50 kB max)
    // supported image formats are PNG, JPG, GIF, BMP, WBMP, GD2, AVIF, WEBP (mail me for more)
    let input_file_path = "input_file.webp";

    // full version message size is unlimited (demo 16 chars max)
    let secret_message = "Secret message";

    // full version password length is 128 characters max (demo 8 chars max)
    let password = "Pa$$word";

    // where to save encoded image with the secret message
    let output_file_path = "output_file_with_hidden_secret_message.png";

    match my_steganography_online_codec
        .encode(
            input_file_path,
            secret_message,
            password,
            output_file_path,
        )
        .await
    {
        Ok(result) => {
            let version_type = result
                .license
                .as_ref()
                .and_then(|l| l.activation_status)
                .unwrap_or(false);
            println!(
                "You are running in {} version",
                if version_type { "full" } else { "demo" }
            );

            println!(
                "Secret messaged encoded and saved to {}",
                output_file_path
            );
            if let Some(ref lic) = result.license {
                if let Some(c) = lic.usages_count {
                    println!("Remaining number of usage credits - {c}");
                }
            }
        }
        Err(err) => {
            let error_code = err.code();
            match error_code {
                errors::INVALID_INPUT => {
                    println!(
                        "Invalid input file {} or file doesn't exist",
                        input_file_path
                    );
                }
                errors::MESSAGE_TOO_LONG => {
                    println!(
                        "Message is too long for the provided image file, use larger file"
                    );
                }
                errors::IMAGE_TOO_BIG => {
                    let lim = err
                        .raw()
                        .and_then(|j| j.get("limits"))
                        .and_then(|l| l.get("maxFileSize"))
                        .map(|v| v.to_string())
                        .unwrap_or_else(|| "unknown".to_string());
                    println!("Image file is too big, current limit is set to {lim}");
                }
                errors::LIMIT_MESSAGE => {
                    let lim = err
                        .raw()
                        .and_then(|j| j.get("limits"))
                        .and_then(|l| l.get("maxMessageLen"))
                        .map(|v| v.to_string())
                        .unwrap_or_else(|| "unknown".to_string());
                    println!("Message is too long, current limit is set to {lim}");
                }
                errors::LIMIT_PASSWORD => {
                    let lim = err
                        .raw()
                        .and_then(|j| j.get("limits"))
                        .and_then(|l| l.get("maxPasswordLen"))
                        .map(|v| v.to_string())
                        .unwrap_or_else(|| "unknown".to_string());
                    println!("Password is too long, current limit is set to {lim}");
                }
                errors::INVALID_PASSWORD => {
                    println!("Invalid password");
                }
                _ => {
                    println!("An error occurred: {}", err.error_message());
                }
            }
        }
    }
}
/******************************************************************************
 *
 * Steganography Online Codec WebApi interface usage example.
 *
 * In this example, we will see how to hide an encrypted message in an
 * image file using our codec.
 *
 * Version      : v1.00
 * Language     : C#
 * Author       : Bartosz Wójcik
 * Project      : https://www.pelock.com/products/steganography-online-codec
 * Homepage     : https://www.pelock.com
 *
 * @copyright Copyright (c) 2020-2026 PELock LLC
 * @license Apache-2.0
 *
 ******************************************************************************/

using System.Text.Json;
using PELock;

// NuGet PackageReference Include="SteganographyOnlineCodec"
// or locally: dotnet add reference ..\src\SteganographyOnlineCodec\SteganographyOnlineCodec.csproj

// create Steganography Online Codec class instance (activation key placeholder)
using var codec = new SteganographyOnlineCodec("YOUR-WEB-API-KEY");

// encode a hidden message within the source image file
// full version image size limit is set to 10 MB (demo 50 kB max)
// supported image formats are PNG, JPG, GIF, BMP, WBMP, GD2, AVIF, WEBP (mail me for more)
string inputFilePath = "input_file.webp";

// full version message size is unlimited (demo 16 chars max)
const string SecretMessage = "Secret message";

// full version password length is 128 characters max (demo 8 chars max)
const string Password = "Pa$$word";

// where to save encoded image with the secret message
string outputFilePath = "output_file_with_hidden_secret_message.png";

try
{
	// encode a hidden message (encrypted with your password) within an image file
	EncodeResult result =
		await codec.EncodeAsync(inputFilePath, SecretMessage, Password, outputFilePath).ConfigureAwait(false);

	string versionType = result.License?.ActivationStatus == true ? "full" : "demo";
	Console.WriteLine($"You are running in {versionType} version");

	Console.WriteLine($"Secret messaged encoded and saved to {outputFilePath}");

	if (result.License?.UsagesCount.HasValue ?? false)
		Console.WriteLine($"Remaining number of usage credits - {result.License!.UsagesCount}");
}
catch (SteganographyApiException err)
{
	int errorCode = err.Error;

	switch (errorCode)
	{
	case Errors.InvalidInput:
		Console.WriteLine($"Invalid input file {inputFilePath} or file doesn't exist");
		break;
	case Errors.MessageTooLong:
		Console.WriteLine("Message is too long for the provided image file, use larger file");
		break;
	case Errors.ImageTooBig:
		Console.WriteLine($"Image file is too big, current limit is set to {ReadLimitLong(err.Raw, "maxFileSize")}");
		break;
	case Errors.LimitMessage:
		Console.WriteLine($"Message is too long, current limit is set to {ReadLimitLong(err.Raw, "maxMessageLen")}");
		break;
	case Errors.LimitPassword:
		Console.WriteLine($"Password is too long, current limit is set to {ReadLimitLong(err.Raw, "maxPasswordLen")}");
		break;
	case Errors.InvalidPassword:
		Console.WriteLine("Invalid password");
		break;
	default:
		Console.WriteLine($"An error occurred: {(!string.IsNullOrEmpty(err.Message) ? err.Message : $"Error code {errorCode}")}");
		break;
	}
}

static string ReadLimitLong(JsonElement? payload, string key)
{
	if (payload.HasValue &&
		payload.Value.TryGetProperty("limits", out JsonElement limits) &&
		limits.TryGetProperty(key, out JsonElement probe) &&
		probe.ValueKind == JsonValueKind.Number &&
		probe.TryGetInt64(out long value))
	{
		return value.ToString();
	}

	return "unknown";
}

/******************************************************************************
 * Steganography Online Codec WebApi interface usage example.
 *
 * Hide a secret message with extended error handling.
 *
 * Version        : v1.0.2
 * Language       : Go
 * Author         : Bartosz Wójcik
 * Web page       : https://www.pelock.com
 *
 *****************************************************************************/

package main

import (
	"context"
	"fmt"
	"os"

	steganographyonlinecodec "github.com/PELock/Steganography-Online-Codec-Go"
)

func main() {
	client := steganographyonlinecodec.New("YOUR-WEB-API-KEY")
	inputFile := "input_file.webp"
	result, err := client.Encode(context.Background(), inputFile, "Secret message", "Pa$$word", "output_file_with_hidden_secret_message.png")
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}

	switch result.Error {
	case steganographyonlinecodec.ErrorSuccess:
		fmt.Println("Secret message encoded and saved to the output PNG file.")
	case steganographyonlinecodec.ErrorInvalidInput:
		fmt.Printf("Invalid input file %s or file doesn't exist\n", inputFile)
	case steganographyonlinecodec.ErrorMessageTooLong:
		fmt.Println("Message is too long for the provided image file, use larger file")
	case steganographyonlinecodec.ErrorImageTooBig:
		fmt.Println("Image file is too big")
	case steganographyonlinecodec.ErrorLimitMessage:
		fmt.Println("Message is too long")
	case steganographyonlinecodec.ErrorLimitPassword:
		fmt.Println("Password is too long")
	case steganographyonlinecodec.ErrorInvalidPassword:
		fmt.Println("Invalid password")
	default:
		fmt.Printf("An unknown error occurred, error code: %d\n", result.Error)
	}
}
/******************************************************************************
 * Steganography Online Codec WebApi interface usage example.
 *
 * Hide a secret message with extended error handling.
 *
 * Version        : v1.0.2
 * Language       : Java
 * Author         : Bartosz Wójcik
 * Web page       : https://www.pelock.com
 *
 *****************************************************************************/

import com.fasterxml.jackson.databind.JsonNode;
import com.pelock.steganography.Errors;
import com.pelock.steganography.SteganographyOnlineCodec;

public class SteganographyExtendedExample {

  public static void main(String[] args) throws Exception {
    SteganographyOnlineCodec client = new SteganographyOnlineCodec("YOUR-WEB-API-KEY");
    String inputFilePath = "input_file.webp";
    String outputFilePath = "output_file_with_hidden_secret_message.png";
    JsonNode result = client.encode(inputFilePath, "Secret message", "Pa$$word", outputFilePath);

    if (result == null || !result.has("error")) {
      System.out.println("Something unexpected happened while trying to encode the message.");
      return;
    }

    boolean full = result.path("license").path("activationStatus").asBoolean(false);
    System.out.println("You are running in " + (full ? "full" : "demo") + " version");

    switch (result.get("error").asInt()) {
      case Errors.SUCCESS:
        System.out.println("Secret message encoded and saved to " + outputFilePath);
        System.out.println(
            "Remaining number of usage credits - " + result.path("license").path("usagesCount").asText());
        break;
      case Errors.INVALID_INPUT:
        System.out.println("Invalid input file " + inputFilePath + " or file doesn't exist");
        break;
      case Errors.MESSAGE_TOO_LONG:
        System.out.println("Message is too long for the provided image file, use larger file");
        break;
      case Errors.IMAGE_TOO_BIG:
        System.out.println(
            "Image file is too big, current limit is set to "
                + result.path("limits").path("maxFileSize").asText());
        break;
      case Errors.LIMIT_MESSAGE:
        System.out.println(
            "Message is too long, current limit is set to "
                + result.path("limits").path("maxMessageLen").asText());
        break;
      case Errors.LIMIT_PASSWORD:
        System.out.println(
            "Password is too long, current limit is set to "
                + result.path("limits").path("maxPasswordLen").asText());
        break;
      case Errors.INVALID_PASSWORD:
        System.out.println("Invalid password");
        break;
      default:
        System.out.println("An unknown error occurred, error code: " + result.get("error").asInt());
        break;
    }
  }
}
<?php

declare(strict_types=1);

use PELock\SteganographyOnlineCodec\Errors;
use PELock\SteganographyOnlineCodec\SteganographyOnlineCodec;

require __DIR__ . "/vendor/autoload.php";

$client = new SteganographyOnlineCodec("YOUR-WEB-API-KEY");

$inputFilePath = "input_file.webp";
$secretMessage = "Secret message";
$password = "Pa$$word";
$outputFilePath = "output_file_with_hidden_secret_message.png";

$result = $client->encode($inputFilePath, $secretMessage, $password, $outputFilePath);

if ($result && array_key_exists("error", $result)) {
    $full = ($result["license"]["activationStatus"] ?? false) === true;
    echo "You are running in " . ($full ? "full" : "demo") . " version\n";

    if ($result["error"] === Errors::SUCCESS) {
        echo "Secret message encoded and saved to {$outputFilePath}\n";
        echo "Remaining number of usage credits - {$result["license"]["usagesCount"]}\n";
    } elseif ($result["error"] === Errors::INVALID_INPUT) {
        echo "Invalid input file {$inputFilePath} or file doesn't exist\n";
    } elseif ($result["error"] === Errors::MESSAGE_TOO_LONG) {
        echo "Message is too long for the provided image file, use larger file\n";
    } elseif ($result["error"] === Errors::IMAGE_TOO_BIG) {
        echo "Image file is too big, current limit is set to {$result["limits"]["maxFileSize"]}\n";
    } elseif ($result["error"] === Errors::LIMIT_MESSAGE) {
        echo "Message is too long, current limit is set to {$result["limits"]["maxMessageLen"]}\n";
    } elseif ($result["error"] === Errors::LIMIT_PASSWORD) {
        echo "Password is too long, current limit is set to {$result["limits"]["maxPasswordLen"]}\n";
    } elseif ($result["error"] === Errors::INVALID_PASSWORD) {
        echo "Invalid password\n";
    } else {
        echo "An unknown error occurred, error code: {$result["error"]}\n";
    }
} else {
    echo "Something unexpected happened while trying to encode the message.\n";
}
################################################################################
#
# Steganography Online Codec WebApi interface usage example.
#
# Hide a secret message with extended error handling.
#
# Version        : v1.0.0
# Language       : PowerShell
# Author         : Bartosz Wójcik
# Web page       : https://www.pelock.com
#
################################################################################

using module SteganographyOnlineCodec

$client = New-SteganographyOnlineCodec -ApiKey 'YOUR-WEB-API-KEY'
$inputFilePath = 'input_file.webp'
$outputFilePath = 'output_file_with_hidden_secret_message.png'
$result = $client.Encode($inputFilePath, 'Secret message', 'Pa$$word', $outputFilePath)

if ($result -and $result.ContainsKey('error')) {
    $full = $false
    if ($result.ContainsKey('license') -and $result.license.activationStatus) {
        $full = $true
    }
    Write-Host ("You are running in {0} version" -f $(if ($full) { 'full' } else { 'demo' }))

    switch ($result.error) {
        ([SteganographyErrors]::SUCCESS) {
            Write-Host ("Secret message encoded and saved to {0}" -f $outputFilePath)
            if ($result.ContainsKey('license')) {
                Write-Host ("Remaining number of usage credits - {0}" -f $result.license.usagesCount)
            }
        }
        ([SteganographyErrors]::INVALID_INPUT) { Write-Host ("Invalid input file {0} or file doesn't exist" -f $inputFilePath) }
        ([SteganographyErrors]::MESSAGE_TOO_LONG) { Write-Host 'Message is too long for the provided image file, use larger file' }
        ([SteganographyErrors]::IMAGE_TOO_BIG) { Write-Host 'Image file is too big' }
        ([SteganographyErrors]::LIMIT_MESSAGE) { Write-Host 'Message is too long' }
        ([SteganographyErrors]::LIMIT_PASSWORD) { Write-Host 'Password is too long' }
        ([SteganographyErrors]::INVALID_PASSWORD) { Write-Host 'Invalid password' }
        default { Write-Host ("An unknown error occurred, error code: {0}" -f $result.error) }
    }
}
else {
    Write-Host 'Something unexpected happened while trying to encode the message.'
}
# frozen_string_literal: true

###############################################################################
#
# Steganography Online Codec — hide with extended error handling
#
# Version        : v1.0.2
# Language       : Ruby
# Author         : Bartosz Wójcik
# Web page       : https://www.pelock.com
#
###############################################################################

require "steganography-online-codec"

client = SteganographyOnlineCodec.new("YOUR-WEB-API-KEY")
input_file_path = "input_file.webp"
output_file_path = "output_file_with_hidden_secret_message.png"
result = client.encode(input_file_path, "Secret message", "Pa$$word", output_file_path)

if result && result.key?("error")
  full = result.dig("license", "activationStatus") == true
  puts "You are running in #{full ? "full" : "demo"} version"

  case result["error"]
  when SteganographyOnlineCodec::Errors::SUCCESS
    puts "Secret message encoded and saved to #{output_file_path}"
    puts "Remaining number of usage credits - #{result.dig("license", "usagesCount")}"
  when SteganographyOnlineCodec::Errors::INVALID_INPUT
    puts "Invalid input file #{input_file_path} or file doesn't exist"
  when SteganographyOnlineCodec::Errors::MESSAGE_TOO_LONG
    puts "Message is too long for the provided image file, use larger file"
  when SteganographyOnlineCodec::Errors::IMAGE_TOO_BIG
    puts "Image file is too big, current limit is set to #{result.dig("limits", "maxFileSize")}"
  when SteganographyOnlineCodec::Errors::LIMIT_MESSAGE
    puts "Message is too long, current limit is set to #{result.dig("limits", "maxMessageLen")}"
  when SteganographyOnlineCodec::Errors::LIMIT_PASSWORD
    puts "Password is too long, current limit is set to #{result.dig("limits", "maxPasswordLen")}"
  when SteganographyOnlineCodec::Errors::INVALID_PASSWORD
    puts "Invalid password"
  else
    puts "An unknown error occurred, error code: #{result["error"]}"
  end
else
  warn "Something unexpected happened while trying to encode the message."
end

Sprawdzenie danych licencyjnych

#!/usr/bin/env python

###############################################################################
#
# Steganography Online Codec WebApi interface usage example.
#
# In this example we will verify our activation key status.
#
# Version      : v1.00
# Language     : Python
# Author       : Bartosz Wójcik
# Project      : https://www.pelock.com/products/steganography-online-codec
# Homepage     : https://www.pelock.com
#
###############################################################################

#
# include Steganography Online Codec module
#
from steganography_online_codec import *

#
# if you don't want to use Python module, you can import directly from the file
#
#from pelock.steganography_online_codec import *

#
# create Steganography Online Codec class instance (we are using our activation key)
#
mySteganographyOnlineCodec = SteganographyOnlineCodec("YOUR-WEB-API-KEY")

#
# login to the service
#
result = mySteganographyOnlineCodec.login()

#
# result[] Dict holds the information about the license & current limits
#
if result:

    print(f'You are running in {"full" if result["license"]["activationStatus"] is True else "demo"} version')

    # information about the current license
    if result["license"]["activationStatus"] is True:
        print(f'Registered for - {result["license"]["userName"]}')
        print(f'License type - {"personal" if result["license"]["type"] == 0 else "company"}')
        print(f'Total number of purchased usage credits - {result["license"]["usagesTotal"]}')
        print(f'Remaining number of usage credits - {result["license"]["usagesCount"]}')

    # current limits (different for DEMO and FULL versions)
    print(f'Max. password length - {result["limits"]["maxPasswordLen"]}')
    print(f'Max. message length - {"unlimited" if result["limits"]["maxMessageLen"] == -1 else result["limits"]["maxMessageLen"]}')
    print(f'Max. input image file size - {mySteganographyOnlineCodec.convert_size(result["limits"]["maxFileSize"])}')
else:
    print("Something unexpected happen while trying to login to the service.")
"use strict";

/******************************************************************************
 *
 * Steganography Online Codec WebApi interface usage example.
 *
 * In this example we will verify our activation key status.
 *
 * Version      : v1.00
 * Language     : JavaScript
 * Author       : Bartosz Wójcik
 * Project      : https://www.pelock.com/products/steganography-online-codec
 * Homepage     : https://www.pelock.com
 *
 * @link https://www.pelock.com/products/steganography-online-codec
 * @copyright Copyright (c) 2020-2025 PELock LLC
 * @license Apache-2.0
 *
 /*****************************************************************************/

// include Steganography Online Codec module
import { SteganographyOnlineCodec, Errors } from 'steganography-online-codec';
// or if tested locally use:
//import { SteganographyOnlineCodec, Errors } from '../src/SteganographyOnlineCodec.mjs';

// create Steganography Online Codec class instance (we are using our activation key)
const mySteganographyOnlineCodec = new SteganographyOnlineCodec('YOUR-WEB-API-KEY');

// login to the service
(async () => {
	try {
		const result = await mySteganographyOnlineCodec.login();

		// result object holds the information about the license & current limits
		const versionType = result.license && result.license.activationStatus ? 'full' : 'demo';
		console.log(`You are running in ${versionType} version`);

		// information about the current license
		if (result.license && result.license.activationStatus) {
			console.log(`Registered for - ${result.license.userName}`);
			const licenseType = result.license.type === 0 ? 'personal' : 'company';
			console.log(`License type - ${licenseType}`);
			console.log(`Total number of purchased usage credits - ${result.license.usagesTotal}`);
			console.log(`Remaining number of usage credits - ${result.license.usagesCount}`);
		}

		// current limits (different for DEMO and FULL versions)
		if (result.limits) {
			console.log(`Max. password length - ${result.limits.maxPasswordLen}`);
			const msgLen = result.limits.maxMessageLen === -1 ? 'unlimited' : result.limits.maxMessageLen;
			console.log(`Max. message length - ${msgLen}`);
			console.log(`Max. input image file size - ${mySteganographyOnlineCodec.convert_size(result.limits.maxFileSize)}`);
		}
	} catch (err) {
		console.error(`Login failed: ${err.error_message || String(err)}`);
	}
})();
// Example: check license status and current API limits (`login`).

use steganography_online_codec::SteganographyOnlineCodec;

#[tokio::main]
async fn main() {
    let my_steganography_online_codec =
        SteganographyOnlineCodec::new(Some("YOUR-WEB-API-KEY".to_string()));

    match my_steganography_online_codec.login().await {
        Ok(result) => {
            let version_type = result
                .license
                .as_ref()
                .and_then(|l| l.activation_status)
                .unwrap_or(false);
            println!(
                "You are running in {} version",
                if version_type { "full" } else { "demo" }
            );

            if let Some(ref lic) = result.license {
                if lic.activation_status.unwrap_or(false) {
                    if let Some(ref name) = lic.user_name {
                        println!("Registered for - {name}");
                    }
                    let license_type = if lic.license_type == Some(0) {
                        "personal"
                    } else {
                        "company"
                    };
                    println!("License type - {license_type}");
                    if let Some(t) = lic.usages_total {
                        println!("Total number of purchased usage credits - {t}");
                    }
                    if let Some(c) = lic.usages_count {
                        println!("Remaining number of usage credits - {c}");
                    }
                }
            }

            if let Some(ref limits) = result.limits {
                if let Some(m) = limits.max_password_len {
                    println!("Max. password length - {m}");
                }
                if let Some(ml) = limits.max_message_len {
                    let msg_len = if ml == -1 {
                        "unlimited".to_string()
                    } else {
                        ml.to_string()
                    };
                    println!("Max. message length - {msg_len}");
                }
                if let Some(fs) = limits.max_file_size {
                    println!(
                        "Max. input image file size - {}",
                        SteganographyOnlineCodec::convert_size(fs)
                    );
                }
            }
        }
        Err(err) => {
            eprintln!("Login failed: {}", err.error_message());
        }
    }
}
/******************************************************************************
 *
 * Steganography Online Codec WebApi interface usage example.
 *
 * In this example we will verify our activation key status.
 *
 * Version      : v1.00
 * Language     : C#
 * Author       : Bartosz Wójcik
 * Project      : https://www.pelock.com/products/steganography-online-codec
 * Homepage     : https://www.pelock.com
 *
 * @copyright Copyright (c) 2020-2026 PELock LLC
 * @license Apache-2.0
 *
 ******************************************************************************/

using PELock;

// NuGet PackageReference Include="SteganographyOnlineCodec"
// or locally: dotnet add reference ..\src\SteganographyOnlineCodec\SteganographyOnlineCodec.csproj

// create Steganography Online Codec class instance (activation key placeholder)
using var codec = new SteganographyOnlineCodec("YOUR-WEB-API-KEY");

// login to the service
try
{
	LoginResult result =
		await codec.LoginAsync().ConfigureAwait(false);

	string versionType =
		result.License?.ActivationStatus == true ? "full" : "demo";

	Console.WriteLine($"You are running in {versionType} version");

	if (result.License?.ActivationStatus == true)
	{
		Console.WriteLine($"Registered for - {result.License!.UserName}");
		string licenseType = result.License.Type == 0 ? "personal" : "company";
		Console.WriteLine($"License type - {licenseType}");
		Console.WriteLine($"Total number of purchased usage credits - {result.License.UsagesTotal}");
		Console.WriteLine($"Remaining number of usage credits - {result.License.UsagesCount}");
	}

	if (result.Limits != null)
	{
		Console.WriteLine($"Max. password length - {result.Limits.MaxPasswordLen}");
		string msgLen = result.Limits.MaxMessageLen == -1 ? "unlimited" : result.Limits.MaxMessageLen.ToString();
		Console.WriteLine($"Max. message length - {msgLen}");
		Console.WriteLine($"Max. input image file size - {codec.ConvertSize(result.Limits.MaxFileSize)}");
	}
}
catch (SteganographyApiException err)
{
	Console.Error.WriteLine("Login failed: " + (!string.IsNullOrEmpty(err.Message) ? err.Message : $"Error code {err.Error}"));
}

/******************************************************************************
 * Steganography Online Codec WebApi interface usage example.
 *
 * Check activation key / demo status.
 *
 * Version        : v1.0.2
 * Language       : Go
 * Author         : Bartosz Wójcik
 * Web page       : https://www.pelock.com
 *
 *****************************************************************************/

package main

import (
	"context"
	"fmt"
	"os"

	steganographyonlinecodec "github.com/PELock/Steganography-Online-Codec-Go"
)

func main() {
	client := steganographyonlinecodec.New("YOUR-WEB-API-KEY")
	result, err := client.Login(context.Background())
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
	if result.Demo {
		fmt.Println("You are running in demo version")
	} else {
		fmt.Println("You are running in full version")
	}
	fmt.Printf("error=%d demo=%v\n", result.Error, result.Demo)
}
/******************************************************************************
 * Steganography Online Codec WebApi interface usage example.
 *
 * Check activation key / demo status.
 *
 * Version        : v1.0.2
 * Language       : Java
 * Author         : Bartosz Wójcik
 * Web page       : https://www.pelock.com
 *
 *****************************************************************************/

import com.fasterxml.jackson.databind.JsonNode;
import com.pelock.steganography.SteganographyOnlineCodec;

public class SteganographyIsDemo {

  public static void main(String[] args) throws Exception {
    SteganographyOnlineCodec client = new SteganographyOnlineCodec("YOUR-WEB-API-KEY");
    JsonNode result = client.login();

    if (result != null && result.has("license")) {
      boolean full = result.path("license").path("activationStatus").asBoolean(false);
      System.out.println("You are running in " + (full ? "full" : "demo") + " version");
      if (full) {
        System.out.println("Registered for - " + result.path("license").path("userName").asText());
        System.out.println(
            "Remaining number of usage credits - "
                + result.path("license").path("usagesCount").asText());
      }
      System.out.println("Max. password length - " + result.path("limits").path("maxPasswordLen").asText());
    } else {
      System.out.println("Something unexpected happened while trying to login to the service.");
    }
  }
}
<?php

declare(strict_types=1);

use PELock\SteganographyOnlineCodec\SteganographyOnlineCodec;

require __DIR__ . "/vendor/autoload.php";

$client = new SteganographyOnlineCodec("YOUR-WEB-API-KEY");
$result = $client->login();

if ($result) {
    $full = ($result["license"]["activationStatus"] ?? false) === true;
    echo "You are running in " . ($full ? "full" : "demo") . " version\n";
    if ($full) {
        echo "Registered for - {$result["license"]["userName"]}\n";
        echo "Remaining number of usage credits - {$result["license"]["usagesCount"]}\n";
    }
    echo "Max. password length - {$result["limits"]["maxPasswordLen"]}\n";
} else {
    echo "Something unexpected happened while trying to login to the service.\n";
}
################################################################################
#
# Steganography Online Codec WebApi interface usage example.
#
# Check activation key / demo status.
#
# Version        : v1.0.0
# Language       : PowerShell
# Author         : Bartosz Wójcik
# Web page       : https://www.pelock.com
#
################################################################################

using module SteganographyOnlineCodec

$client = New-SteganographyOnlineCodec -ApiKey 'YOUR-WEB-API-KEY'
$result = $client.Login()

if ($result) {
    $full = $false
    if ($result.ContainsKey('license') -and $result.license.activationStatus) {
        $full = $true
    }
    Write-Host ("You are running in {0} version" -f $(if ($full) { 'full' } else { 'demo' }))
    if ($full) {
        Write-Host ("Registered for - {0}" -f $result.license.userName)
        Write-Host ("Remaining number of usage credits - {0}" -f $result.license.usagesCount)
    }
    if ($result.ContainsKey('limits')) {
        Write-Host ("Max. password length - {0}" -f $result.limits.maxPasswordLen)
    }
}
else {
    Write-Host 'Something unexpected happened while trying to login to the service.'
}
# frozen_string_literal: true

###############################################################################
#
# Steganography Online Codec — login
#
# Version        : v1.0.2
# Language       : Ruby
# Author         : Bartosz Wójcik
# Web page       : https://www.pelock.com
#
###############################################################################

require "steganography-online-codec"

client = SteganographyOnlineCodec.new("YOUR-WEB-API-KEY")
result = client.login

if result
  full = result.dig("license", "activationStatus") == true
  puts "You are running in #{full ? "full" : "demo"} version"
  if full
    puts "Registered for - #{result.dig("license", "userName")}"
    puts "Remaining number of usage credits - #{result.dig("license", "usagesCount")}"
  end
  puts "Max. password length - #{result.dig("limits", "maxPasswordLen")}"
else
  warn "Something unexpected happened while trying to login to the service."
end

Zwracane wartości

result["error"] [out]
Kod błędu. Jeden z poniższych:
Nazwa Wartość Opis
WEBAPI_CONNECTION -1 Nie można połączyć się z interfejsem Web API (błąd sieci, zwracany jedynie przez bibliotekę SDK).
SUCCESS 0 Wszystko poszło ok.
UNKNOWN 1 Nieznany błąd.
MESSAGE_TOO_LONG 2 Wiadomość jest zbyt długa dla wybranego pliku obrazka (użyj większy plik obrazka).
IMAGE_TOO_BIG 3 Plik obrazka zbyt duży (limit 10 MB dla pełnej wersji, 50 kB dla wersji DEMO).
INVALID_INPUT 4 Plik obrazka jest nieprawidłowy.
INVALID_IMAGE_FORMAT 5 Format pliku obrazka nie jest obsługiwany.
IMAGE_MALFORMED 6 Plik obrazka jest uszkodzony lub nie można go odczytać albo zapisać do niego zakodowanej wiadomości.
INVALID_PASSWORD 7 Podane hasło jest nieprawidłowe (maksymalny rozmiar hasła to 128 znaków dla pełnej wersji i 8 znaków dla wersji DEMO).
LIMIT_MESSAGE 9 Wiadomość jest zbyt długa (nieograniczony rozmiar dla pełnej wersji, 16 znaków dla wersji DEMO).
LIMIT_PASSWORD 10 Podane hasło ma nieprawidłowy rozmiar (rozmiar to maksymalnie 128 znaków dla pełnej wersji, 8 dla wersji DEMO).
OUTPUT_FILE 99 Błąd podczas zapisywania wyjściowego pliku (zwracany jedynie przez bibliotekę SDK).
INVALID_LICENSE 100 Klucz licencji jest nieprawidłowy lub wygasł (brak kredytów użycia).
result["message"] [out, optional]
Zdekodowana sekretna wiadomość.
result["limits"]["maxFileSize"] [out, optional]
Maksymalny dozwolony rozmiar pliku.
result["limits"]["maxMessageLen"] [out, optional]
Maksymalny dozwolony rozmiar sekretnej wiadomości (domyślnie -1 dla nieograniczonego rozmiaru, który pozwoli wpasować się w rozmiar pliku wejściowego).
result["limits"]["maxPasswordLen"] [out, optional]
Maksymalny dozwolony rozmiar hasła.
result["license"]["activationStatus"] [out, optional]
Status aktywacji - true dla pełnej wersji false dla wersji demo.
result["license"]["userName"] [out, optional]
Nazwa zarejestrowanego użytkownika.
result["license"]["type"] [out, optional]
Rodzaj licencji - 0 for Licencji Osobistej, 1 dla Licencji Firmowej.
result["license"]["usagesTotal"] [out, optional]
Całkowita liczba zakupionych kredytów użycia.
result["license"]["usagesCount"] [out]
Pozostała liczba kredytów użycia (zawsze zwracana przy kodowaniu/dekodowaniu, dla wersji demo jest zawsze ustawiona na 1).

Wymagania

Moduł dla Python steganography-online-codec
JavaScript NPM Module steganography-online-codec
Crate Rust steganography-online-codec
Pakiet NuGet (C# / .NET) SteganographyOnlineCodec

Masz pytania?

Jeśli masz jakieś pytania dotyczące pakietów SDK dla Steganografia Kodek Online, masz jakieś uwagi, coś jest niejasne, napisz do mnie, chętnie odpowiem na każde Twoje pytanie.