सामग्री पर जाएँ

एजेंट · प्रगति पर

सेवाओं के लिए AgentPass

स्पष्ट मंज़ूरी के साथ AI एजेंट को पासवर्ड या सत्र साझा किए बिना आपके उपयोगकर्ता के लिए कार्य करने दें। Identvia AgentPass v0.1 संघीय Authority है; आपकी साइट Service।

अपने AI एजेंट के लिए प्रॉम्प्ट कॉपी करें

कोडिंग एजेंट इस्तेमाल कर रहे हैं? यह प्रॉम्प्ट उसे इन दस्तावेज़ों की ओर भेजता है और वे नियम बताता है जिनका पालन उसे करना है। वह जो लिखे, उसकी समीक्षा किसी भी दूसरे कोड की तरह करें।

You are helping me add "Sign in with Identvia" to my app (PHP). Identvia is an OpenID Connect provider.

Read these first (they are plain Markdown and are the source of truth; prefer them over anything you remember):
- https://id.identvia.com/developers/docs/quickstart.md
- https://id.identvia.com/developers/docs/oidc.md
- https://id.identvia.com/developers/docs/security.md
- Discovery: https://id.identvia.com/.well-known/openid-configuration

Stack: plain PHP 8.1+ (no framework). Use the official SDK identvia/identvia-php (composer require identvia/identvia-php, or the zip with vendor/ from https://id.identvia.com/developers/docs/php for hosts without Composer). Create identvia.php (config), login.php (redirectToSignIn), callback.php (handleCallback, then session_regenerate_id(true) and store sub) and logout.php. Read secrets from environment variables or a config file outside the web root.

Requirements:
1. Authorization code flow with PKCE (S256 only), a random state and a nonce per sign-in. No implicit flow.
2. Validate the ID token: RS256 signature from the JWKS, iss = https://id.identvia.com, aud contains my client_id, exp/iat, and the nonce.
3. Identify users by sub (it is pairwise: different for every app). Treat email as optional, because the person may choose not to share it.
4. Redirect URIs must match exactly. Keep the client secret and refresh tokens server-side; never log tokens.
5. Ask only for the scopes I need (openid, plus email/profile if used). Handle the user canceling (error=access_denied) gracefully.

Optional, only if I ask for AI-agent access later:
- AgentPass (agents acting for a user with single-use, holder-bound passes): https://id.identvia.com/developers/docs/agentpass.md
- MCP server for agent clients: https://id.identvia.com/developers/docs/mcp.md
- Token exchange, rich authorization requests and CIBA: https://id.identvia.com/developers/docs/delegation.md

Before writing code, tell me which files you will add or change. Don't invent endpoints or options that aren't in the docs; if something is unclear, ask me.

AgentPass v0.1 एक मसौदा विनिर्देश है और बदल सकता है। Identvia clerk/agentpass@937efe3 पर पिन संस्करण लागू करता है। अभी अपरिवर्तनीय या उच्च-मूल्य क्रियाएँ इसके पीछे न रखें।

यह कैसे काम करता है

  1. एजेंट का harness Identvia से पास माँगता है: कौन सी साइट, उपयोगकर्ता, कार्य, प्रकार (bearer_token या browser_session) और harness की सार्वजनिक कुंजी।
  2. Identvia DNS से आपकी साइट खोजती है, कौन से अनुमतियाँ हैं पूछती है, और अनुरोध उपयोगकर्ता के इनबॉक्स में रखती है। उपयोगकर्ता अनुमतियाँ चुनता है और पासकी या प्रमाणक ऐप से मंज़ूर करता है। एजेंट अपने अनुरोध कभी मंज़ूर नहीं कर सकते।
  3. Harness को पास मिलता है जो एक बार, सिर्फ़ आपकी साइट, 2 मिनट में, और सिर्फ़ harness कुंजी से हस्ताक्षरित प्रमाण के साथ काम करता है।
  4. आपकी साइट पास भुनाती है: Identvia से जाँच, प्रमाण सत्यापन, और अपना API टोकन या एक-बार साइन-इन लिंक जारी करती है।
  5. एजेंट काम करते हुए साइट कम से कम हर 60 सेकंड प्रतिनिधिमंडल दोबारा जाँचती है। उपयोगकर्ता Identvia में रद्द करे तो एजेंट रुकता है।

PHP: identvia/agentpass-php

GitHub पर देखें · सभी SDK

किसी भी PHP 8.1+ साइट के लिए MIT लाइसेंस लाइब्रेरी (बिना फ्रेमवर्क, साझा होस्टिंग पर)। AgentPass एंडपॉइंट, DNS खोज और authority समाधान, Authority से पास सत्यापन, धारक प्रमाण, bearer टोकन या ब्राउज़र सत्र जारी करना, और निरंतर जाँच (fail-closed) करती है।

PHP
$service = new AgentPass\Service\Service(new AgentPass\Service\ServiceConfig(
    origin: 'https://todo.example.com',
    signingKeyPem: file_get_contents(__DIR__ . '/agentpass-key.pem'),   // bin/agentpass-keygen
    trustedAuthorities: [AgentPass\Service\ServiceConfig::authority('https://id.identvia.com')],
    scopes: [['name' => 'todos:read', 'description' => 'See your todos'], ['name' => 'todos:write', 'description' => 'Add todos']],
    store: AgentPass\Service\Store\PdoStore::sqlite(__DIR__ . '/data/agentpass.sqlite'),
));
if ($service->handleGlobals()) { exit; }            // /agentpass-service/* एंडपॉइंट

// आपके API में:
$d = $service->authenticateBearer($_SERVER['HTTP_AUTHORIZATION'] ?? '');
if (!$d->can('todos:write')) { /* 403 */ }

डाउनलोड में पूरा डेमो todo सेवा (examples/todo) है जो bearer टोकन और ब्राउज़र सत्र स्वीकार करती है।

DNS रिकॉर्ड

Authority आपकी कॉन्फ़िगरेशन खोजें, इसके लिए एक TXT रिकॉर्ड प्रकाशित करें:

DNS
_agentpass-service.todo.example.com.  TXT  "https://todo.example.com/agentpass-service/config.json"

एंटरप्राइज़ डोमेन अपना Authority URL वाला _agentpass.<domain> प्रकाशित कर सकते हैं, या प्रतिनिधिमंडल बंद करने के लिए none। Identvia और SDK इस प्राथमिकता का सम्मान करते हैं।

Identvia के Authority एंडपॉइंट

  • कॉन्फ़िगरेशन: https://id.identvia.com/agentpass/ap
  • जारी करना: POST /agentpass/requests → स्थिति लिंक के साथ 202; poll_after_ms से तेज़ पोल न करें।
  • Validate और authorization-check: Service उन्हें अपने JWKS की कुंजी से हस्ताक्षरित अल्पकालिक ES256 assertion से कॉल करते हैं।

आपकी ज़िम्मेदारियाँ

  • एजेंट को उपयोगकर्ता के लिए काम करते मानें, पर लेबल करें: UI और लॉग में 「via agent」 दिखाएँ।
  • संकरी अनुमतियाँ दें। कभी * न दें; Identvia भी नहीं।
  • checkCacheSeconds 60 या कम रखें, और Authority न मिलने पर fail-closed।
  • कार्य विवरण को एजेंट का अविश्वसनीय पाठ मानें।