<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rami Beshry</title>
    <description>The latest articles on DEV Community by Rami Beshry (@ramibeshry).</description>
    <link>https://dev.to/ramibeshry</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4273314%2Fd7d2eade-6a02-4ae7-8f23-b8dfc8dc87fb.png</url>
      <title>DEV Community: Rami Beshry</title>
      <link>https://dev.to/ramibeshry</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ramibeshry"/>
    <language>en</language>
    <item>
      <title>Request-Bound HMAC Authentication in Laravel with MKAP</title>
      <dc:creator>Rami Beshry</dc:creator>
      <pubDate>Mon, 30 Nov 2026 04:25:23 +0000</pubDate>
      <link>https://dev.to/ramibeshry/request-bound-hmac-authentication-in-laravel-with-mkap-52nh</link>
      <guid>https://dev.to/ramibeshry/request-bound-hmac-authentication-in-laravel-with-mkap-52nh</guid>
      <description>&lt;h2&gt;
  
  
  Why bind a proof to a request?
&lt;/h2&gt;

&lt;p&gt;A static bearer token is easy to copy: once captured, the same value can often be replayed against a different request. MKAP takes a different approach. The server issues a short-lived challenge containing selected key identifiers. The client retrieves the corresponding secrets from its local pool and derives a proof bound to the HTTP method, the origin-form request target and the exact body bytes.&lt;/p&gt;

&lt;p&gt;The protocol is framework-independent; the two Laravel packages are thin adapters around it. This article explains what each adapter actually does, what its configuration keys mean, and which parts of a working integration you still have to build yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the two packages are responsible for
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;proit365/laravel-multikey-auth-server&lt;/code&gt; is the server adapter. It provides an opt-in challenge route, request-authentication middleware, database-backed repositories bound in the container, a Laravel cache-backed rate limiter, and guarded Artisan commands for pools, keys, exports and challenge pruning.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;proit365/laravel-multikey-auth&lt;/code&gt; is the client adapter. It wraps the PHP MKAP client with Laravel configuration, a Laravel HTTP transport, dependency injection and the &lt;code&gt;MKAP&lt;/code&gt; facade. It authenticates outbound requests; it does not protect incoming application routes.&lt;/p&gt;

&lt;p&gt;The server adapter does not globally secure your application. Only the challenge endpoint is registered, and only when explicitly enabled, and you must attach the middleware to the routes that need it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Requirements and versions
&lt;/h2&gt;

&lt;p&gt;Both packages require PHP &lt;code&gt;^8.2&lt;/code&gt; and Laravel &lt;code&gt;^12.0&lt;/code&gt; (the required &lt;code&gt;illuminate/*&lt;/code&gt; components are constrained to &lt;code&gt;^12.0&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;The server package additionally requires &lt;code&gt;ext-pdo&lt;/code&gt; and a configured PDO driver, plus the framework-independent &lt;code&gt;proit365/multikey-auth-server:^1.0&lt;/code&gt;; the client requires &lt;code&gt;proit365/multikey-auth:^1.0&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The server README states that Laravel 13 is not supported by this package version; no other Laravel version is claimed here.&lt;/p&gt;

&lt;p&gt;At the time of writing, Packagist lists &lt;code&gt;v1.0.3&lt;/code&gt; as the latest server release and &lt;code&gt;v1.0.2&lt;/code&gt; as the latest client release, both published on 2026-11-26.&lt;/p&gt;

&lt;p&gt;Development dependencies are &lt;code&gt;orchestra/testbench:^10.0&lt;/code&gt; and &lt;code&gt;phpunit/phpunit:^11.5&lt;/code&gt; in both packages.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation commands
&lt;/h2&gt;

&lt;p&gt;Server, in a Laravel 12 application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require proit365/laravel-multikey-auth-server:^1.0
php artisan vendor:publish --tag=mkap-config
php artisan migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Client:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer require proit365/laravel-multikey-auth:^1.0
php artisan vendor:publish --tag=mkap-client-config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Laravel package discovery registers &lt;code&gt;MultiKeyAuthServiceProvider&lt;/code&gt; for the server and &lt;code&gt;MultiKeyAuthClientServiceProvider&lt;/code&gt; plus the &lt;code&gt;MKAP&lt;/code&gt; alias for the client, so no manual provider registration is needed in a standard installation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Server configuration keys
&lt;/h2&gt;

&lt;p&gt;The published file is &lt;code&gt;config/multikey-auth-server.php&lt;/code&gt;. Its shipped defaults, together with the server guide, define the following keys.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Key&lt;/th&gt;
&lt;th&gt;Default&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;database_connection&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;null&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Laravel database connection used by the MKAP repositories (&lt;code&gt;MKAP_DATABASE_CONNECTION&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;master_key_provider&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;null&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Application class implementing &lt;code&gt;MasterKeyProviderInterface&lt;/code&gt; (&lt;code&gt;MKAP_MASTER_KEY_PROVIDER&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;client_pool_provider&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;null&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Optional custom &lt;code&gt;ClientPoolProviderInterface&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;challenge_lifetime_seconds&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;30&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Challenge lifetime; the guide gives a valid range of 1–3,600 seconds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;maximum_challenge_body_bytes&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;65536&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Maximum challenge request body&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;maximum_authenticated_body_bytes&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1048576&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Maximum protected API body&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;rate_limits.challenge&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;60&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Challenge requests per decay interval and client&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;rate_limits.authenticate&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;120&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Authenticated requests per decay interval and client&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;rate_limits.decay_seconds&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;60&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rate-limit interval in seconds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;routes.enabled&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;false&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Whether the package's challenge route is registered&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;routes.challenge_path&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;v1/auth/challenges&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Challenge route path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;routes.middleware&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;['api']&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Middleware applied to that route&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The master-key provider must be supplied by the application: it has to implement &lt;code&gt;ProIT365\\MultiKeyAuth\\Core\\Server\\MasterKeyProviderInterface&lt;/code&gt; and return a versioned, 32-byte master key from an external secret manager. The package does not create, store or default a master key.&lt;/p&gt;

&lt;p&gt;The default client-pool provider reads the package's database tables; a client must resolve to exactly one active pool. Custom lookup policies require a &lt;code&gt;ClientPoolProviderInterface&lt;/code&gt; implementation.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happens on an authenticated request
&lt;/h2&gt;

&lt;p&gt;The challenge endpoint accepts JSON containing &lt;code&gt;version&lt;/code&gt;, &lt;code&gt;client_id&lt;/code&gt;, &lt;code&gt;method&lt;/code&gt;, &lt;code&gt;target&lt;/code&gt; and &lt;code&gt;body_sha256&lt;/code&gt;, where &lt;code&gt;body_sha256&lt;/code&gt; is the unpadded base64url encoding of the SHA-256 hash of the exact API body.&lt;/p&gt;

&lt;p&gt;A successful response includes &lt;code&gt;version&lt;/code&gt;, &lt;code&gt;request_id&lt;/code&gt;, &lt;code&gt;nonce&lt;/code&gt;, &lt;code&gt;key_ids&lt;/code&gt;, &lt;code&gt;key_count&lt;/code&gt;, &lt;code&gt;id_length&lt;/code&gt;, &lt;code&gt;expires_in&lt;/code&gt; and &lt;code&gt;expires_at&lt;/code&gt;, and is marked &lt;code&gt;Cache-Control: no-store&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The middleware reads &lt;code&gt;X-MKAP-Version&lt;/code&gt;, &lt;code&gt;X-MKAP-Client&lt;/code&gt;, &lt;code&gt;X-MKAP-Request&lt;/code&gt; and &lt;code&gt;X-MKAP-Proof&lt;/code&gt;. It requires version &lt;code&gt;1&lt;/code&gt;, decodes the request identifier as 16 bytes and the proof as 32 bytes with strict canonical base64url checking, then calls the verifier with the uppercased HTTP method, &lt;code&gt;getRequestUri()&lt;/code&gt;, the raw request body and protocol version &lt;code&gt;1&lt;/code&gt;. The next middleware or controller runs only after verification succeeds.&lt;/p&gt;

&lt;p&gt;The server guide documents these error mappings for the current Laravel adapter: 400 for malformed JSON or invalid challenge metadata, 401 for missing, invalid, expired or mismatched proofs, 403 for an unknown client, 404 for an unknown challenge, 409 for replay, 413 for oversized requests, 429 for rate limits, and 500 for unexpected failures. These mappings describe this adapter's behavior, not universal Laravel behavior. The adapter does not currently emit 422.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenge route URL
&lt;/h2&gt;

&lt;p&gt;When &lt;code&gt;routes.enabled&lt;/code&gt; is true, the service provider loads &lt;code&gt;routes/api.php&lt;/code&gt; and registers the configured &lt;code&gt;routes.challenge_path&lt;/code&gt; with &lt;code&gt;routes.middleware&lt;/code&gt;. The shipped path is &lt;code&gt;/v1/auth/challenges&lt;/code&gt; and the shipped middleware is the &lt;code&gt;api&lt;/code&gt; middleware group. Do not assume that the effective URL automatically contains an &lt;code&gt;/api&lt;/code&gt; prefix. Laravel route and host configuration determine the final URL; verify it after enabling the endpoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php artisan route:list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Protecting application routes
&lt;/h2&gt;

&lt;p&gt;The service provider registers the &lt;code&gt;multikey.auth&lt;/code&gt; middleware alias. Attach it only to routes that require MKAP.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;App&lt;/span&gt;\\&lt;span class="nc"&gt;Http&lt;/span&gt;\\&lt;span class="nc"&gt;Controllers&lt;/span&gt;\\&lt;span class="nc"&gt;OrderController&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;Illuminate&lt;/span&gt;\\&lt;span class="nc"&gt;Support&lt;/span&gt;\\&lt;span class="nc"&gt;Facades&lt;/span&gt;\\&lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;middleware&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'multikey.auth'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;group&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Route&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/api/orders'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;OrderController&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'store'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The middleware itself uses the uppercased HTTP method, &lt;code&gt;getRequestUri()&lt;/code&gt;, &lt;code&gt;getContent()&lt;/code&gt; and protocol version 1; it does not inspect proxy headers or apply a proxy-specific target policy. It is therefore the application's responsibility to ensure that TLS termination, proxy headers and upstream middleware preserve the method, request target and raw body before &lt;code&gt;multikey.auth&lt;/code&gt; runs. Confirm this behavior in the target deployment rather than assuming it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Calling an MKAP-protected API from Laravel
&lt;/h2&gt;

&lt;p&gt;Configure the client through environment variables; the published config file supplies the defaults shown here.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MKAP_BASE_URI=https://api.example.test
MKAP_CLIENT_ID=CLIENT_001
MKAP_POOL_VERSION=1
MKAP_IDENTIFIER_LENGTH=6
MKAP_IDENTIFIER_ALPHABET=abcdefghijklmnopqrstuvwxyz0123456789
MKAP_EXPORT_PATH=/secure/application-data/mkap/client-export.json
MKAP_REQUIRE_HTTPS=true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Serialize the body once and pass those exact bytes to the facade.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;ProIT365&lt;/span&gt;\\&lt;span class="nc"&gt;MultiKeyAuth&lt;/span&gt;\\&lt;span class="nc"&gt;LaravelClient&lt;/span&gt;\\&lt;span class="nc"&gt;Facades&lt;/span&gt;\\&lt;span class="no"&gt;MKAP&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;json_encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'status'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'pending'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;JSON_THROW_ON_ERROR&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;MKAP&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/api/orders'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;statusCode&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;201&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;RuntimeException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Order request did not succeed.'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same client is available by dependency injection.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;ProIT365&lt;/span&gt;\\&lt;span class="nc"&gt;MultiKeyAuth&lt;/span&gt;\\&lt;span class="nc"&gt;Client&lt;/span&gt;\\&lt;span class="nc"&gt;HttpResponse&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="nc"&gt;ProIT365&lt;/span&gt;\\&lt;span class="nc"&gt;MultiKeyAuth&lt;/span&gt;\\&lt;span class="nc"&gt;LaravelClient&lt;/span&gt;\\&lt;span class="nc"&gt;LaravelMultiKeyClient&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;final&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;OrderGateway&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;__construct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nc"&gt;LaravelMultiKeyClient&lt;/span&gt; &lt;span class="nv"&gt;$client&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;submit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;HttpResponse&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/api/orders'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;HttpResponse&lt;/code&gt; exposes &lt;code&gt;statusCode&lt;/code&gt;, &lt;code&gt;headers&lt;/code&gt; and &lt;code&gt;body&lt;/code&gt;, and non-2xx API responses are returned rather than thrown as transport exceptions. An API &lt;code&gt;401&lt;/code&gt; is returned unchanged and is not retried. The facade supports &lt;code&gt;request&lt;/code&gt;, &lt;code&gt;get&lt;/code&gt;, &lt;code&gt;post&lt;/code&gt;, &lt;code&gt;put&lt;/code&gt;, &lt;code&gt;patch&lt;/code&gt; and &lt;code&gt;delete&lt;/code&gt;, and all targets must be origin-form paths that match what the server authenticates.&lt;/p&gt;

&lt;p&gt;The README shows the same facade pattern with a &lt;code&gt;200&lt;/code&gt; status check; that number is application-specific. The parts to preserve are single serialization, unchanged bytes, and no redirects or rewriting after signing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key and export administration
&lt;/h2&gt;

&lt;p&gt;The server guide documents these Artisan commands.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mkap:pools:generate &amp;lt;client_id&amp;gt; &amp;lt;pool_id&amp;gt; [--count=1000] [--selection=3] [--pool-version=1] [--identifier-length=6] [--alphabet=...] [--force]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Create a pool and encrypted random keys&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mkap:pools:inspect &amp;lt;pool_id&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show pool metadata and active/revoked key counts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mkap:keys:revoke &amp;lt;pool_id&amp;gt; &amp;lt;identifier&amp;gt; [--force]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Revoke an active key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mkap:keys:rotate &amp;lt;pool_id&amp;gt; &amp;lt;identifier&amp;gt; [--reason=...] [--force]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Revoke a key and create its replacement&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mkap:exports:create &amp;lt;pool_id&amp;gt; [--client=...] --output=&amp;lt;path&amp;gt; [--development-json] [--force]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Write a client export to a file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mkap:challenges:prune [--dry-run]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Remove expired challenges without a retained audit record&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;There is no client-creation Artisan command in the Laravel package: create the client through the separate CLI package or your own administrative workflow before generating a pool.&lt;/p&gt;

&lt;p&gt;The PHP client loads plaintext JSON through &lt;code&gt;ExportLoader::fromJson()&lt;/code&gt;. Protected export envelopes are not supported by that loader. The server command currently exposes only the development JSON export mode. Treat that export as a credential, not as a production credential-delivery mechanism. A complete compromise of the export can allow an attacker to impersonate the client.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;--force&lt;/code&gt; skips interactive confirmation but does not skip validation. Revocation and rotation take effect immediately; after rotation, issue a fresh export before clients use the replacement key.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you must check before using any of this
&lt;/h2&gt;

&lt;p&gt;The examples follow the API shapes documented in the packages' README and guide. None of it is a drop-in production setup. Before adopting it, check the following against your own application and the exact installed version:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Implement and configure a master-key provider backed by your external secret manager; the package intentionally supplies none.&lt;/li&gt;
&lt;li&gt;Create the client record, generate a pool, produce an export and place it outside the public web root with restricted permissions; never commit it to source control or write it to logs.&lt;/li&gt;
&lt;li&gt;Confirm that no middleware rewrites the method, request target or raw body before &lt;code&gt;multikey.auth&lt;/code&gt; runs, and that proxies and TLS termination preserve them.&lt;/li&gt;
&lt;li&gt;Configure a shared cache store if you run multiple workers or servers; the package uses Laravel's cache limiter, and a process-local cache does not provide shared enforcement.&lt;/li&gt;
&lt;li&gt;Enforce request-size limits at the web server/PHP layers in addition to &lt;code&gt;maximum_challenge_body_bytes&lt;/code&gt; and &lt;code&gt;maximum_authenticated_body_bytes&lt;/code&gt;, and keep HTTPS enabled.&lt;/li&gt;
&lt;li&gt;Match &lt;code&gt;pool_version&lt;/code&gt;, &lt;code&gt;identifier_length&lt;/code&gt; and &lt;code&gt;identifier_alphabet&lt;/code&gt; to the export metadata; a stale export cannot prove possession of a newly selected key.&lt;/li&gt;
&lt;li&gt;Re-run the installed package's own tests (&lt;code&gt;composer install&lt;/code&gt; then &lt;code&gt;composer test&lt;/code&gt;) and test the complete network path in the target environment; package tests do not verify production HTTPS, shared cache configuration or multi-worker deployment.&lt;/li&gt;
&lt;li&gt;Re-check the version constraints and release notes on Packagist at the time of adoption, since this article reflects only the versions listed above.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Deployment limitations
&lt;/h2&gt;

&lt;p&gt;The internal architecture note describes a &lt;strong&gt;local&lt;/strong&gt; deployment demonstration: a single-host Docker Compose stack with Caddy TLS on loopback ports, an nginx reverse proxy to PHP-FPM, MySQL and Redis, a one-shot bootstrap, a shared read-only client export volume and a two-replica application overlay. It uses a local self-signed CA and file-based demo secrets.&lt;/p&gt;

&lt;p&gt;That demonstration is not a public production deployment and should not be described as one. The package tests and local demonstration do not verify public TLS, target-environment request-limit behavior, proxy preservation of signed fields, distributed replay protection, concurrent challenge consumption or production deployment readiness. None of this should be turned into a production-readiness, security-certification or customer-adoption claim.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limitations and disclosure
&lt;/h2&gt;

&lt;p&gt;MKAP is a custom authentication protocol under development. It is not currently recommended for production use, has not undergone an independent cryptographic security review, and must not be considered production-secure or independently audited.&lt;/p&gt;

&lt;p&gt;Published-package and loopback integration tests are evidence of tested behavior only, not production certification. Protected-export envelopes are not supported by the currently released PHP/Laravel client loader. Distributed replay protection, shared rate limiting and concurrent challenge consumption remain unverified; target-environment deployment checks and independent security review remain outstanding.&lt;/p&gt;

&lt;p&gt;This is a community-oriented technical article, not an announcement of a production release, adoption, traffic or customer results. No votes, likes, reviews or purchases are requested.&lt;/p&gt;

&lt;p&gt;The author is a maintainer of the MKAP project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Server package: &lt;a href="https://packagist.org/packages/proit365/laravel-multikey-auth-server" rel="noopener noreferrer"&gt;Packagist&lt;/a&gt; · &lt;a href="https://github.com/proit365/laravel-multikey-auth-server" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Client package: &lt;a href="https://packagist.org/packages/proit365/laravel-multikey-auth" rel="noopener noreferrer"&gt;Packagist&lt;/a&gt; · &lt;a href="https://github.com/proit365/laravel-multikey-auth" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Protocol, specification and documentation monorepo: &lt;a href="https://github.com/proit365/multikey-auth" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://packagist.org/packages/proit365/laravel-multikey-auth-server" rel="noopener noreferrer"&gt;Server package on Packagist&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/proit365/laravel-multikey-auth-server/8acba1afe59bd308a2b42f481518f31fdfe64674/README.md" rel="noopener noreferrer"&gt;Server README — v1.0.3 source commit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/proit365/laravel-multikey-auth-server/8acba1afe59bd308a2b42f481518f31fdfe64674/composer.json" rel="noopener noreferrer"&gt;Server composer.json — v1.0.3 source commit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/proit365/laravel-multikey-auth-server/8acba1afe59bd308a2b42f481518f31fdfe64674/config/multikey-auth-server.php" rel="noopener noreferrer"&gt;Server configuration — v1.0.3 source commit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/proit365/laravel-multikey-auth-server/8acba1afe59bd308a2b42f481518f31fdfe64674/src/Http/AuthenticateMkapRequest.php" rel="noopener noreferrer"&gt;Server middleware — v1.0.3 source commit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/proit365/laravel-multikey-auth-server/8acba1afe59bd308a2b42f481518f31fdfe64674/src/MultiKeyAuthServiceProvider.php" rel="noopener noreferrer"&gt;Server service provider — v1.0.3 source commit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/proit365/laravel-multikey-auth-server/8acba1afe59bd308a2b42f481518f31fdfe64674/docs/guide.md" rel="noopener noreferrer"&gt;Server guide — v1.0.3 source commit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://packagist.org/packages/proit365/laravel-multikey-auth" rel="noopener noreferrer"&gt;Client package on Packagist&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/proit365/laravel-multikey-auth/0d9e828487dae11cb25b117ba80f5f6636644d4b/README.md" rel="noopener noreferrer"&gt;Client README — v1.0.2 source commit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/proit365/laravel-multikey-auth/0d9e828487dae11cb25b117ba80f5f6636644d4b/composer.json" rel="noopener noreferrer"&gt;Client composer.json — v1.0.2 source commit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/proit365/laravel-multikey-auth/0d9e828487dae11cb25b117ba80f5f6636644d4b/config/multikey-auth-client.php" rel="noopener noreferrer"&gt;Client configuration — v1.0.2 source commit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/proit365/laravel-multikey-auth/0d9e828487dae11cb25b117ba80f5f6636644d4b/docs/guide.md" rel="noopener noreferrer"&gt;Client guide — v1.0.2 source commit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/proit365/multikey-auth/main/README.md" rel="noopener noreferrer"&gt;MKAP monorepo README&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/proit365/multikey-auth/main/SECURITY.md" rel="noopener noreferrer"&gt;MKAP security policy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://raw.githubusercontent.com/proit365/multikey-auth/main/KNOWN_LIMITATIONS.md" rel="noopener noreferrer"&gt;MKAP known limitations&lt;/a&gt;``&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>security</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
