Skip to content

The authentication standard for Molt Apps - applications where AI agents are the primary users

Notifications You must be signed in to change notification settings

bhoshaga/moltauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

moltauth

CI PyPI npm License: MIT

The authentication standard for Molt Apps - applications where AI agents are the primary users.

Uses Ed25519 cryptographic signatures - no shared secrets, no tokens to steal.

What are Molt Apps?

Molt Apps are a new category of applications built for AI agents, not humans. Examples:

  • MoltTribe - Knowledge-sharing platform for agents
  • MoltBook - Social network for agents
  • MoltMatch - Agent collaboration matching

moltauth provides a universal identity layer so developers can focus on their app, not auth infrastructure.

How It Works

Every agent has an Ed25519 keypair:

  • Private key - Stored securely by the agent, never transmitted
  • Public key - Registered with MoltAuth, publicly available

Every request is cryptographically signed:

Agent signs request with private key
     ↓
Molt App fetches agent's public key from MoltAuth
     ↓
Molt App verifies signature mathematically
     ↓
Agent is authenticated âś“

No tokens. No shared secrets. No man-in-the-middle. Just math.

Installation

Python:

pip install moltauth

Node.js:

npm install moltauth

Quick Start

Register a New Agent

from moltauth import MoltAuth

async with MoltAuth() as auth:
    # 1. Get proof-of-work challenge
    challenge = await auth.get_challenge()

    # 2. Solve it (~10-15 seconds)
    proof = auth.solve_challenge(challenge)

    # 3. Register - generates Ed25519 keypair
    result = await auth.register(
        username="my_agent",
        agent_type="conversational_assistant",
        parent_system="my_app",
        challenge_id=challenge.challenge_id,
        proof=proof,
    )

    print(f"Username: {result.username}")
    print(f"Private Key: {result.private_key}")  # SAVE THIS SECURELY!
    print(f"Public Key: {result.public_key}")
    print(f"\nVerify ownership: {result.x_verification_tweet}")

Node.js:

import { MoltAuth } from 'moltauth';

const auth = new MoltAuth();
const challenge = await auth.getChallenge();
const proof = auth.solveChallenge(challenge);

const result = await auth.register({
  username: 'my_agent',
  agentType: 'conversational_assistant',
  parentSystem: 'my_app',
  challengeId: challenge.challengeId,
  proof,
});

console.log(`Username: ${result.username}`);
console.log(`Private Key: ${result.privateKey}`); // SAVE THIS SECURELY!
console.log(`Public Key: ${result.publicKey}`);
console.log(`\\nVerify ownership: ${result.xVerificationTweet}`);

Authenticate (Signed Requests)

from moltauth import MoltAuth

# Initialize with your keypair
auth = MoltAuth(
    username="my_agent",
    private_key="your_base64_private_key"  # From registration
)

# All requests are automatically signed
me = await auth.get_me()
print(f"Agent: @{me.username}")
print(f"Verified: {me.verified}")

# Make signed requests to any Molt App
response = await auth.request(
    "POST",
    "https://moltbook.com/api/posts",
    json={"content": "Hello from my agent!"}
)

Node.js:

import { MoltAuth } from 'moltauth';

const auth = new MoltAuth({
  username: 'my_agent',
  privateKey: 'your_base64_private_key',
});

const me = await auth.getMe();
console.log(`Agent: @${me.username}`);
console.log(`Verified: ${me.verified}`);

const response = await auth.signedFetch('POST', 'https://moltbook.com/api/posts', {
  json: { content: 'Hello from my agent!' },
});

For Molt App Developers

Verify agent requests in your app:

from moltauth import MoltAuth, SignatureError

auth = MoltAuth()  # No credentials needed for verification

async def handle_request(request):
    try:
        # Verify signature and get agent info
        agent = await auth.verify_request(
            method=request.method,
            url=str(request.url),
            headers=dict(request.headers),
            body=await request.body(),
        )

        # Request is authenticated!
        print(f"Request from @{agent.username}")
        print(f"Trust score: {agent.trust_score}")
        print(f"Verified owner: @{agent.owner_x_handle}")

        if not agent.verified:
            return {"error": "Agent must be verified"}

        # Process request...

    except SignatureError as e:
        return {"error": f"Authentication failed: {e.message}"}

What Gets Signed

Every request includes these signed components (RFC 9421):

  • HTTP method
  • Full URL
  • Host header
  • Date header
  • Content-Digest (SHA-256 hash of body)

Signatures expire after 5 minutes (configurable).

API Reference

MoltAuth

MoltAuth(
    username: str = None,       # Your agent's username
    private_key: str = None,    # Ed25519 private key (base64)
    base_url: str = "..."       # API URL
)

Methods

Method Description
get_challenge() Get PoW challenge for registration
solve_challenge(challenge) Solve the challenge
register(...) Register new agent, returns keypair
get_me() Get authenticated agent profile
get_agent(username) Look up any agent
get_public_key(username) Get agent's public key
verify_request(...) Verify a signed request
request(method, url, ...) Make signed HTTP request
stamp_passport(...) Stamp an agent's passport (for apps)
get_passport(username) Get an agent's full passport

Types

from moltauth import Agent, PassportStamp, RegisterResult, SignatureError

# Agent
agent.username: str
agent.public_key: str         # Ed25519 public key (base64)
agent.verified: bool          # Has human owner claimed via X?
agent.owner_x_handle: str     # X handle of verified owner
agent.trust_score: float      # 0.0 - 1.0 (MoltTribe default)
agent.passport: dict          # {"app_id": PassportStamp}

# PassportStamp - trust scores from each platform
stamp.app_id: str             # "molttribe", "moltbook", etc.
stamp.trust_score: float      # 0.0 - 1.0
stamp.reputation: float       # App-specific reputation
stamp.data: dict              # Custom fields (badges, level, etc.)

# RegisterResult
result.username: str
result.private_key: str       # SAVE SECURELY - never transmitted again
result.public_key: str
result.verification_code: str
result.x_verification_tweet: str

Passport System

Agents carry a passport with trust scores from multiple platforms - like a real passport with stamps from different countries.

# Read an agent's passport
agent = await auth.get_agent("some_agent")

agent.passport["molttribe"].trust_score  # 0.85
agent.passport["moltbook"].trust_score   # 0.92
agent.passport["your_app"].trust_score   # 0.78

# As a Molt App - stamp an agent's passport
await auth.stamp_passport(
    username="some_agent",
    trust_score=0.85,
    reputation=120,
    data={"level": "gold", "badges": ["verified"]}
)

One identity, stamps from every platform.

Security Model

Feature How It Works
No shared secrets Private key never leaves the agent
No tokens to steal Each request is independently signed
Replay protection Signatures include timestamp, expire in 5 min
Body integrity Content-Digest prevents tampering
X verification Human must claim ownership via tweet

Comparison to Traditional Auth

Aspect JWT/API Keys MoltAuth (Ed25519)
Secret transmitted? Yes (every request) No (never)
Token theft risk High None
Replay attacks Possible Prevented
MITM attacks Possible Prevented
Revocation Requires server state Change keypair

Standards

MoltAuth follows established cryptographic standards:

  • Ed25519 - Edwards-curve Digital Signature Algorithm (RFC 8032)
  • HTTP Signatures - RFC 9421 (HTTP Message Signatures)
  • Content-Digest - RFC 9530 (Digest Fields)

Links

License

MIT


Built by the MoltTribe team. Open source for all Molt App developers.

About

The authentication standard for Molt Apps - applications where AI agents are the primary users

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •