Home / Documentation / XARF Libraries

Official and community XARF libraries for multiple programming languages

XARF Libraries

Official and community-maintained libraries for implementing XARF in your applications.


Official Libraries

Python

xarf-python

Beta

Full-featured Python library with validation, conversion, and schema support.

📦 pip install git+https://github.com/xarf/xarf-python.git (alpha — not yet on PyPI) 📚 Documentation ⭐ GitHub
Features:
  • Complete XARF 4.0 support
  • JSON Schema validation
  • Format conversion (ARF, IODEF, CSV)
  • Evidence hashing and verification
  • Type hints and dataclasses
  • Async/await support

JavaScript/Node.js

xarf-javascript

Alpha

JavaScript/TypeScript library for browser and Node.js environments.

📦 npm: npm install @xarf/xarf 📚 Documentation ⭐ GitHub
Features:
  • TypeScript definitions
  • Browser and Node.js compatible
  • Streaming validation
  • Zero dependencies

Go

xarf-go

Coming Soon

High-performance Go library for enterprise applications.

📦 Not yet publicly available 📚 Documentation 💬 Express interest
Planned features:
  • Native struct mapping
  • Concurrent processing
  • Minimal allocations
  • Protocol buffer support

Quick Start

Choose your language and get started in minutes:

# Install (alpha — not yet on PyPI)
pip install git+https://github.com/xarf/xarf-python.git

# Create a report
from xarf import XARFReport
from datetime import datetime

report = XARFReport(
    xarf_version="4.0.0",
    report_id="550e8400-e29b-41d4-a716-446655440000",
    timestamp=datetime.utcnow().isoformat() + "Z",
    reporter={
        "org": "Security Operations",
        "contact": "[email protected]",
        "domain": "example.com"
    },
    sender={
        "org": "Security Operations",
        "contact": "[email protected]",
        "domain": "example.com"
    },
    source_identifier="192.0.2.100",
    category="connection",
    type="ddos"
)

# Validate
if report.validate():
    print("✓ Report is valid!")
    print(report.to_json(indent=2))

→ Full Python Documentation

// Install
npm install @xarf/xarf

// Create a report
const { XARFReport } = require('@xarf/xarf');

const report = new XARFReport({
  xarf_version: '4.0.0',
  report_id: '550e8400-e29b-41d4-a716-446655440000',
  timestamp: new Date().toISOString(),
  reporter: {
    org: 'Security Operations',
    contact: '[email protected]',
    domain: 'example.com'
  },
  sender: {
    org: 'Security Operations',
    contact: '[email protected]',
    domain: 'example.com'
  },
  source_identifier: '192.0.2.100',
  category: 'connection',
  type: 'ddos'
});

// Validate
if (report.validate()) {
  console.log('✓ Report is valid!');
  console.log(report.toJSON(null, 2));
}

Coming Soon - Express interest on GitHub

// The Go library is not yet publicly available (coming soon).
// The example below shows the planned API.

// Create a report
package main

import (
    "fmt"
    "time"
    "github.com/xarf/xarf-go"
)

func main() {
    report := xarf.Report{
        XARFVersion: "4.0.0",
        ReportID: "550e8400-e29b-41d4-a716-446655440000",
        Timestamp: time.Now().Format(time.RFC3339),
        Reporter: xarf.Reporter{
            Org: "Security Operations",
            Contact: "[email protected]",
            Domain: "example.com",
        },
        Sender: xarf.Sender{
            Org: "Security Operations",
            Contact: "[email protected]",
            Domain: "example.com",
        },
        SourceIdentifier: "192.0.2.100",
        Category: "connection",
        Type: "ddos",
    }

    // Validate
    if err := report.Validate(); err == nil {
        fmt.Println("✓ Report is valid!")
        json, _ := report.MarshalJSON()
        fmt.Println(string(json))
    }
}

Coming Soon - Express interest on GitHub


Community Libraries

Community-maintained libraries and integrations:

Looking to contribute?

We welcome community libraries for additional languages and frameworks!

  • Ruby
  • PHP
  • Rust
  • Perl
  • Swift
  • Kotlin

Contribution Guide


Integration Examples

Web Frameworks

  • Flask/Django (Python) - REST API integration
  • Express.js (Node.js) - Middleware for abuse reporting
  • Gin/Echo (Go) - High-performance handlers

Message Queues

  • RabbitMQ - AMQP integration
  • Apache Kafka - Streaming reports
  • AWS SQS - Cloud-native processing
  • Redis - Pub/sub patterns

Databases

  • PostgreSQL - JSONB storage
  • MongoDB - Document storage
  • Elasticsearch - Search and analytics
  • TimescaleDB - Time-series analysis

Library Features Comparison

Feature Python JavaScript Go
Schema Validation ✓ 🚧 🚧
Type Safety ✓ 🚧 🚧
Async/Await ✓ 🚧 N/A
Format Conversion ✓ 🚧 🚧
Evidence Hashing ✓ 🚧 🚧
Streaming ✓ 🚧 🚧
Legend: ✓ Available 🚧 Coming Soon N/A Not Applicable

Need Help?