@authdp/protocol
v1.0.3
Published
SDK for Domain Node Protocol (IMAGXP Native Integration)
Downloads
39
Readme
@authdp/protocol (Authentication over Domain Protocol)
AuthDP is the foundational SDK for building decentralized, secure, and sovereign nodes on the web. It leverages the IMAGXP cryptographic standard to enable seamless, password-less communication between independent web domains.
With AuthDP, you can turn any Next.js or Node.js application into a verifiable Domain Node capable of sending and receiving cryptographically signed messages, without relying on centralized SaaS databases for user identity.
Features
- Sovereign Identity: Replaces traditional login/signup. Your domain is your identity (e.g.,
alice.comtalking tobob.shop). - Cryptographic Verification: Built on top of
@imagxp/protocolusing ECDSA P-256 for robust signature validation and DNS-binding. - Node-to-Node Messaging: Securely route envelopes between independent domains using standardized capabilities.
- Next.js Ready: Includes Higher-Order Components (HOCs) and adapters optimized for the Next.js App Router.
Installation
npm install @authdp/protocolCore Concepts
1. The Protocol Node
A generic handler that defines what your domain is capable of doing.
import { NodeRouter } from 'authdp';
// Initialize the router for your domain
export const nodeRouter = new NodeRouter('yourdomain.com');
// Register capabilities
nodeRouter.registerCapability('messaging.receive', async (envelope, storage) => {
console.log(`Received message from: ${envelope.from}`);
console.log(`Payload:`, envelope.payload);
});2. Next.js App Router Integration
AuthDP provides adapters to easily expose your Domain Node to the internet.
In your app/api/inbox/route.ts:
import { createNextInboxHoc } from 'authdp';
import { nodeRouter } from '@/lib/node'; // Your router from above
export const POST = createNextInboxHoc(nodeRouter);3. Client Usage (Sending securely)
When you want to send data to another domain, AuthDP signs the payload using your .env private keys and delivers it directly to the receiver's inbox.
import { ProtocolNode } from 'authdp';
const node = new ProtocolNode("yourdomain.com", {
private: process.env.IMAGXP_PRIVATE_KEY,
public: process.env.IMAGXP_PUBLIC_KEY,
});
await node.sendMessage(
"receiverdomain.com",
"messaging.receive",
{ content: "Hello from my sovereign node!" }
);License
MIT
