Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion EXPLAINME.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Key features:

The Zig FFI provides:

* Telegram API bindings via unified-hexadeca-api
* Telegram API bindings via unified-api-adapter
* C-compatible interfaces for Ada
* Memory-safe FFI operations
* Error propagation across language boundary
Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Original Features (as designed by 2nixx):

Implementation Notes:
- Core logic: Ada/SPARK for safety and verification
- Telegram API bindings: Zig with unified-hexadeca-api
- Telegram API bindings: Zig with unified-api-adapter
- API layer abstractions: Idris2 for type safety

Copyright and Licensing:
Expand Down
4 changes: 2 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The original concept and feature set are acknowledged with gratitude.
This implementation uses:

* *Ada/SPARK* for the core application logic and session management
* *Zig* for FFI bindings to Telegram API via unified-hexadeca-api
* *Zig* for FFI bindings to Telegram API via unified-api-adapter
* *Idris2* for API layer abstractions where applicable

== License
Expand Down Expand Up @@ -362,7 +362,7 @@ trigger

== Dependencies

* *Telethon equivalent*: Implemented via Zig FFI with unified-hexadeca-api
* *Telethon equivalent*: Implemented via Zig FFI with unified-api-adapter
* *Colorama equivalent*: Terminal color support in Ada
* *Cryptography*: AES encryption via SPARK-verified implementations

Expand Down
2 changes: 1 addition & 1 deletion dev-notes/HANDOVER.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ This document tracks the current state of work on the hyperpolymath/trigger repo

=== 3. Code Rewrite (PREVIOUSLY COMPLETED)
* Rewrote code in Ada/SPARK as primary design
* Used Zig for FFI with unified-hexadeca-api
* Used Zig for FFI with unified-api-adapter
* Used Idris2 for API definitions
* No Python - pure Ada/SPARK + Zig FFI + Idris2 APIs

Expand Down
12 changes: 6 additions & 6 deletions docs/ARCHITECTURE.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Trigger follows a layered architecture with clear separation of concerns:
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
│ │ │ Zig │ │ Idris2 │ │ C Headers│ │ │
│ │ │ (unified│ │ (API │ │ (FFI │ │ │
│ │ │ hexadeca│ │ layer) │ │ bridge) │ │ │
│ │ │ unified-api-adapter│ │ layer) │ │ bridge) │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
Expand Down Expand Up @@ -100,7 +100,7 @@ Handles Telegram reporting operations:
* FloodWait handling
* Statistics collection

Uses Zig FFI via unified-hexadeca-api for actual Telegram API calls.
Uses Zig FFI via unified-api-adapter for actual Telegram API calls.

=== Utilities (src/trigger/utils/)

Expand All @@ -114,7 +114,7 @@ Provides cross-cutting functionality:

Provides foreign function interfaces:

* `zig/telegram.zig`: Telegram API bindings using unified-hexadeca-api
* `zig/telegram.zig`: Telegram API bindings using unified-api-adapter
* `idris2/TelegramAPI.idr`: High-level, type-safe API abstractions

The Zig code provides the actual Telegram client functionality, while the
Expand Down Expand Up @@ -173,7 +173,7 @@ Rationale:
1. User selects "Add Account" from menu
2. Main application prompts for phone, API ID, API hash
3. Session Manager calls Zig FFI to create TelegramClient
4. Zig code uses unified-hexadeca-api to create session
4. Zig code uses unified-api-adapter to create session
5. Session data saved to file (optionally encrypted)
6. Account added to manager's account list

Expand Down Expand Up @@ -248,7 +248,7 @@ trigger/

* Zig runtime (for FFI)
* Idris2 runtime (if used)
* unified-hexadeca-api (Zig library)
* unified-api-adapter (Zig library)

=== External Services

Expand Down Expand Up @@ -411,7 +411,7 @@ The containerisation includes the following security measures:
== Future Enhancements

* Full SPARK verification of critical components
* Complete Zig FFI implementation with unified-hexadeca-api
* Complete Zig FFI implementation with unified-api-adapter
* Idris2 API layer with full functionality
* Proper JSON parsing/serialization
* Session encryption using SPARK-verified crypto
Expand Down
4 changes: 2 additions & 2 deletions docs/IMPLEMENTATION-STATUS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,12 @@ The following order is recommended for completing the remaining work:
4. **Lower Priority (P3)**
- Port proven-tests-and-benches patterns to Ada
- Complete Idris2 FFI implementation
- Complete Zig FFI implementation with actual unified-hexadeca-api
- Complete Zig FFI implementation with actual unified-api-adapter

== Blockers and Dependencies

=== External Dependencies
1. **unified-hexadeca-api**: Required for full Zig FFI implementation
1. **unified-api-adapter**: Required for full Zig FFI implementation
2. **Guix in Wolfi**: May require custom image or build-time installation
3. **SELinux in container**: Requires container runtime support
4. **Firewalld in container**: Requires systemd or alternative init
Expand Down
4 changes: 2 additions & 2 deletions docs/MULTI-PLATFORM-ARCHITECTURE.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

This document describes the architecture for expanding the Trigger application
to support multiple social media platforms beyond Telegram. The design maintains
the existing standards: Ada/SPARK core, Zig FFI with unified-hexadeca-api, and
the existing standards: Ada/SPARK core, Zig FFI with unified-api-adapter, and
Idris2 API layer.

== Architecture Principles
Expand All @@ -41,7 +41,7 @@ All ABIs (Application Binary Interfaces) are defined in Idris2, providing:

=== Memory Safety

All FFI implementations are in pure Zig, using unified-hexadeca-api for:
All FFI implementations are in pure Zig, using unified-api-adapter for:

- Explicit memory management
- Bounds checking
Expand Down
2 changes: 1 addition & 1 deletion ffi/idris2/DiscordAPI.idr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-- ↑ uses
-- ffi/zig/discord/discord.zig (Zig FFI)
-- ↑ uses
-- unified-hexadeca-api (Discord client via serenity or similar)
-- unified-api-adapter (Discord client via serenity or similar)
--
-- Original concept by 2nixx (T.me/NetworkCriminals)
-- Discord API by hyperpolymath
Expand Down
2 changes: 1 addition & 1 deletion ffi/idris2/SocialMediaAPI.idr
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,4 @@ toSocialError msg = PlatformError Telegram msg -- Default, override per platfor
-- must implement the SocialPlatform interface and use their respective
-- Zig FFI bindings.
--
-- The Zig FFI layer uses unified-hexadeca-api for consistency across platforms.
-- The Zig FFI layer uses unified-api-adapter for consistency across platforms.
2 changes: 1 addition & 1 deletion ffi/idris2/TelegramAPI.idr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-- ↑ uses
-- ffi/zig/telegram/telegram.zig (Zig FFI)
-- ↑ uses
-- unified-hexadeca-api (Telegram client)
-- unified-api-adapter (Telegram client)
--
-- Original concept by 2nixx (T.me/NetworkCriminals)
-- Idris2 API by hyperpolymath
Expand Down
2 changes: 1 addition & 1 deletion ffi/idris2/TwitterAPI.idr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-- ↑ uses
-- ffi/zig/twitter/twitter.zig (Zig FFI)
-- ↑ uses
-- unified-hexadeca-api (Twitter API v2 client)
-- unified-api-adapter (Twitter API v2 client)
--
-- Original concept by 2nixx (T.me/NetworkCriminals)
-- Twitter/X API by hyperpolymath
Expand Down
8 changes: 4 additions & 4 deletions ffi/zig/discord/discord.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Discord API Bindings for Trigger
//
// Uses unified-hexadeca-api for Discord client functionality
// Uses unified-api-adapter for Discord client functionality
// via serenity (Rust) or discord-rs bindings through C ABI
//
// Original concept by 2nixx (T.me/NetworkCriminals)
Expand All @@ -14,8 +14,8 @@

const std = @import("std");

// Import unified-hexadeca-api for common utilities
// const hexadeca = @import("path:unified-hexadeca-api");
// Import unified-api-adapter for common utilities
// const unifiedApiAdapter = @import("path:unified-api-adapter");

// =============================================================================
// DISCORD-SPECIFIC CONSTANTS
Expand Down Expand Up @@ -429,7 +429,7 @@ pub export fn discord_client_get_guild(
// - or discord-rs via C bindings
// - or a custom HTTP client using zig-http
//
// The unified-hexadeca-api would provide common utilities for:
// The unified-api-adapter would provide common utilities for:
// - HTTP client functionality
// - JSON serialization/deserialization
// - OAuth2 token management
Expand Down
2 changes: 1 addition & 1 deletion ffi/zig/telegram/mod.zig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// telegram/mod.zig - Telegram module for unified-hexadeca-api
// telegram/mod.zig - Telegram module for unified-api-adapter
//
// This module exports the Telegram API bindings for use in Trigger.
//
Expand Down
14 changes: 7 additions & 7 deletions ffi/zig/telegram/telegram.zig
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
// Telegram API Bindings for Trigger
//
// Uses unified-hexadeca-api for Telegram client functionality
// Uses unified-api-adapter for Telegram client functionality
//
// Original concept by 2nixx (T.me/NetworkCriminals)
// Zig bindings by hyperpolymath

const std = @import("std");
const hexadeca = @import("path:unified-hexadeca-api"); // Would reference actual path
const unifiedApiAdapter = @import("path:unified-api-adapter"); // Would reference actual path

// Telegram client wrapper
pub const TelegramClient = struct {
client: *hexadeca.TelegramClient,
client: *unifiedApiAdapter.TelegramClient,
api_id: i32,
api_hash: []const u8,
session_name: []const u8,

// Initialize a new Telegram client
pub fn init(allocator: std.mem.Allocator, api_id: i32, api_hash: []const u8, session_name: []const u8) !TelegramClient {
var self = TelegramClient{
.client = try hexadeca.telegramClientInit(allocator, api_id, api_hash),
.client = try unifiedApiAdapter.telegramClientInit(allocator, api_id, api_hash),
.api_id = api_id,
.api_hash = api_hash,
.session_name = session_name,
Expand All @@ -28,7 +28,7 @@ pub const TelegramClient = struct {

// Deinitialize client
pub fn deinit(self: *TelegramClient) void {
hexadeca.telegramClientDestroy(self.client);
unifiedApiAdapter.telegramClientDestroy(self.client);
}

// Start session with phone number
Expand Down Expand Up @@ -57,7 +57,7 @@ pub const TelegramClient = struct {
}

// Get messages from a chat
pub fn getMessages(self: *TelegramClient, peer: []const u8, limit: i32) ![]hexadeca.Message {
pub fn getMessages(self: *TelegramClient, peer: []const u8, limit: i32) ![]unifiedApiAdapter.Message {
return try self.client.getMessages(peer, limit);
}

Expand Down Expand Up @@ -136,4 +136,4 @@ pub export fn telegram_client_is_authorized(client_ptr: [*c]*anyopaque) callconv
}

// Note: In a real implementation, this would properly integrate with
// the unified-hexadeca-api which provides Telegram TDLib or MTProto bindings
// the unified-api-adapter which provides Telegram TDLib or MTProto bindings
8 changes: 4 additions & 4 deletions ffi/zig/twitter/twitter.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Twitter/X API Bindings for Trigger

Check failure on line 1 in ffi/zig/twitter/twitter.zig

View workflow job for this annotation

GitHub Actions / Hypatia neurosymbolic scan

[hypatia] Zig @aligncast performs unchecked alignment cast (6 occurrences, CWE-704)

Check failure on line 1 in ffi/zig/twitter/twitter.zig

View workflow job for this annotation

GitHub Actions / Hypatia neurosymbolic scan

[hypatia] Zig @ptrCast performs unchecked pointer type conversion (9 occurrences, CWE-704)
//
// Uses unified-hexadeca-api for Twitter/X client functionality
// Uses unified-api-adapter for Twitter/X client functionality
// via Twitter API v2
//
// Original concept by 2nixx (T.me/NetworkCriminals)
Expand All @@ -14,8 +14,8 @@

const std = @import("std");

// Import unified-hexadeca-api for common utilities
// const hexadeca = @import("path:unified-hexadeca-api");
// Import unified-api-adapter for common utilities
// const unifiedApiAdapter = @import("path:unified-api-adapter");

// =============================================================================
// TWITTER-SPECIFIC CONSTANTS
Expand Down Expand Up @@ -430,7 +430,7 @@
// - zig-http for HTTP requests (https://github.com/kristoff-it/zig-http)
// - zig-json for JSON parsing (https://github.com/kristoff-it/zig-json)
//
// The unified-hexadeca-api would provide common utilities for:
// The unified-api-adapter would provide common utilities for:
// - OAuth 2.0 Bearer token management
// - HTTP client with retries
// - JSON serialization/deserialization
Expand Down
2 changes: 1 addition & 1 deletion src/trigger/cli/man_page.adb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ package body Trigger.CLI.Man_Page is
" Supported platforms: Telegram, Discord, Twitter/X" & ASCII.LF &
"" & ASCII.LF &
" This implementation uses Ada/SPARK for the core application, Zig for FFI" & ASCII.LF &
" bindings, and Idris2 for API layer abstractions following the unified-hexadeca-api." & ASCII.LF &
" bindings, and Idris2 for API layer abstractions following the unified-api-adapter." & ASCII.LF &
"" & ASCII.LF &
"ORIGINAL ATTRIBUTION" & ASCII.LF &
" This project implements functionality originally designed in Ripper by" & ASCII.LF &
Expand Down
4 changes: 2 additions & 2 deletions src/trigger/cli/version_info.adb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ package body Trigger.CLI.Version_Info is
"Multi-platform social media reporting utility" & ASCII.LF &
"Supported platforms: Telegram, Discord, Twitter/X" & ASCII.LF &
"" & ASCII.LF &
"Architecture: Ada/SPARK core, Idris2 ABI, Zig FFI (unified-hexadeca-api)" & ASCII.LF &
"Architecture: Ada/SPARK core, Idris2 ABI, Zig FFI (unified-api-adapter)" & ASCII.LF &
"" & ASCII.LF &
"Original concept: " & Trigger.Original_Concept &
" by " & Trigger.Original_Author & ASCII.LF &
Expand Down Expand Up @@ -72,7 +72,7 @@ package body Trigger.CLI.Version_Info is
Trigger.Original_Concept & " by " & Trigger.Original_Author & "." & ASCII.LF &
"The original concept and feature set are acknowledged with gratitude." & ASCII.LF &
"This implementation is a complete rewrite in Ada/SPARK with Zig FFI bindings" & ASCII.LF &
"following the unified-hexadeca-api, and Idris2 for API abstractions." & ASCII.LF &
"following the unified-api-adapter, and Idris2 for API abstractions." & ASCII.LF &
"It does not contain any code from the original project.";
end Get_License_Text;

Expand Down
2 changes: 1 addition & 1 deletion src/trigger/ffi/trigger-ffi-discord.ads
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- Trigger - Discord FFI Bindings Specification
--
-- Ada bindings for Discord API via Zig FFI (unified-hexadeca-api)
-- Ada bindings for Discord API via Zig FFI (unified-api-adapter)
--
-- This package provides the interface for calling Discord functions
-- implemented in Zig through C-exported symbols.
Expand Down
2 changes: 1 addition & 1 deletion src/trigger/ffi/trigger-ffi-telegram.ads
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- Trigger - Telegram FFI Bindings Specification
--
-- Ada bindings for Telegram API via Zig FFI (unified-hexadeca-api)
-- Ada bindings for Telegram API via Zig FFI (unified-api-adapter)
--
-- This package provides the interface for calling Telegram functions
-- implemented in Zig through C-exported symbols.
Expand Down
2 changes: 1 addition & 1 deletion src/trigger/ffi/trigger-ffi-twitter.ads
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- Trigger - Twitter/X FFI Bindings Specification
--
-- Ada bindings for Twitter/X API via Zig FFI (unified-hexadeca-api)
-- Ada bindings for Twitter/X API via Zig FFI (unified-api-adapter)
--
-- This package provides the interface for calling Twitter/X functions
-- implemented in Zig through C-exported symbols.
Expand Down
2 changes: 1 addition & 1 deletion src/trigger/trigger.adb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
--
-- This is the main entry point for the Trigger application.
-- It provides both a comprehensive CLI and an ADI TUI (Advanced Dialog Interface).
-- Architecture: Ada/SPARK core, Idris2 ABI, Zig FFI (unified-hexadeca-api)
-- Architecture: Ada/SPARK core, Idris2 ABI, Zig FFI (unified-api-adapter)

with Ada.Text_IO;
with Ada.Strings.Unbounded;
Expand Down
2 changes: 1 addition & 1 deletion trigger.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
-- This project implements a multi-platform social media reporting utility
-- with support for Telegram, Discord, and Twitter/X.
-- Features: multi-account management, persistent sessions, rate limit handling,
-- platform abstraction via Idris2 ABI and Zig FFI (unified-hexadeca-api).
-- platform abstraction via Idris2 ABI and Zig FFI (unified-api-adapter).
--
-- Original concept by 2nixx (T.me/NetworkCriminals)
-- Rewritten in Ada/SPARK for safety and verification
Expand Down
Loading