PHPackages                             debc-camie/camie-superapp-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. debc-camie/camie-superapp-sdk

ActiveLibrary[API Development](/categories/api)

debc-camie/camie-superapp-sdk
=============================

The official PHP and Laravel SDK for the CamIE SuperApp.

v1.0.3(1mo ago)047↓50%MITPHPPHP ^8.0

Since Jun 23Pushed 1mo agoCompare

[ Source](https://github.com/khimsynat/camie-superapp-sdk)[ Packagist](https://packagist.org/packages/debc-camie/camie-superapp-sdk)[ RSS](/packages/debc-camie-camie-superapp-sdk/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

CamIE SuperApp SDK – Usage Guidelines
=====================================

[](#camie-superapp-sdk--usage-guidelines)

This guide covers the installation, initialization, and core methods for interacting with the CamIE SuperApp ecosystem using the PHP/Laravel SDK.

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require debc-camie/camie-superapp-sdk
```

Set up environment
------------------

[](#set-up-environment)

EdDSA: use to sign data with mobile or thirdparty with algorithm (secp384r1). Generate function generate public/private keys: node js

```
function generateKeyPair(): KeyPair {
    const { publicKey, privateKey } = crypto.generateKeyPairSync('ec', {
        namedCurve: 'secp384r1', // The curve you mentioned in previous code
        publicKeyEncoding: {
            type: 'spki', // Recommended standard for public keys
            format: 'pem',
        },
        privateKeyEncoding: {
            type: 'pkcs8', // Recommended standard for private keys
            format: 'pem',
        },
    });

    return { publicKey, privateKey };
}
```

set up .env for laravel

```
TEST_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----
MIG2AgEAMBAGByqGSM49AgEGBSuBBAAiBIGeMIGbAgEBBDDYspqhkiy10B4xqoAK
YTGcjP0cjKyh1n3Ocvdt7de0wbcE8gqsPaQ+mADYWa2vpCihZANiAASbb0QR7DBS
1x/GwYkgxd5lbyuIRNLkzKxS1oL1JMw4ZoDJZfO0i2R3UactFsw22Z/ydHglD8qX
80u1qdyd8ZaVf3TcNsz/h8+LwX9vg9ckj/Ni6NKp6HdGaN93oNF8kfI=
-----END PRIVATE KEY-----"

SUPERAPPDOMAIN="https://some-other-domain.com"
```

Initialization (Laravel)
------------------------

[](#initialization-laravel)

If you need to connect dynamically to different environments or bypass the global Facade, you can instantiate the SDK directly in your controllers or services.

```
use CamIE\SuperApp\CamIESuperAppSDK;

// Initialize the SDK with the target SuperApp domain
$superAppDomain=env('SUPERAPPDOMAIN');
$privateKey=env('TEST_PRIVATE_KEY');
$customSdk = new CamIESuperAppSDK($superAppDomain);
```

---

🎟️ Ticket Protocol
------------------

[](#️-ticket-protocol)

Tickets are specialized JWS (JSON Web Signature) payloads used for routing and verifying requests between MiniApps and the SuperApp.

### 1. `verifyAndExtractTicket()`

[](#1-verifyandextractticket)

This is your primary method for receiving tickets. It securely fetches the sender's public key, verifies the ES384 signature, and extracts the core business data.

*Throws an Exception if the signature is invalid or tampered with.*

```
$base64Ticket = "eyJ0eXBl...";

try {
    // Returns the associative array contained inside the ticket's 'data' property
    $data = $customSdk->verifyAndExtractTicket($base64Ticket);

    // Process your business logic
    $orderId = $data['some_fields'];

} catch (\Exception $e) {
    // Handle tampering, expired keys, or malformed data
    return response()->json(['error' => $e->getMessage()], 401);
}
```

### 2. `inspectTicket()`

[](#2-inspectticket)

Use this strictly for **debugging and logging**. It decodes and prints the ticket payload to the screen *without* verifying the cryptographic signature. Never use this for authentication.

```
$base64Ticket = "eyJ0eXBl...";

// Directly outputs the decoded JSON payload to the console/browser
$customSdk->inspectTicket($base64Ticket);
```

---

🔑 Token Protocol
----------------

[](#-token-protocol)

Tokens are standard 3-part JWTs used for secure data exchange and authentication.

### 1. `signToken()`

[](#1-signtoken)

Generates a signed JWT using your Elliptic Curve (ES384/P-384) private key. It automatically injects the `iat` (Issued At), `jti` (JWT ID), and `scope` claims into your payload.

```
$data = $customSdk->signToken(
        ['data'=>123, 'issby'=> "6a3a59fbed0de3f4dd4ba9dd"],
        $privateKey
    );
```

### 2. `verifyAndExtractToken()`

[](#2-verifyandextracttoken)

Validates an incoming JWT. It checks the signature against the sender's public key, ensures the token has not expired (maximum age: 10 minutes), and accounts for server clock skew.

```
$jwtToken = "eyJhbGciOiJFUzM4NC...";

try {
    // Returns the fully decoded token envelope if verification passes
    $envelope = $customSdk->verifyAndExtractToken($jwtToken);

    $sender = $envelope['issby'];

} catch (\Exception $e) {
    // Fails on bad signatures, expired tokens, or missing claims
    return response()->json(['error' => 'Invalid Token: ' . $e->getMessage()], 401);
}
```

### 3. `inspectToken()`

[](#3-inspecttoken)

A debugging helper that splits the 3-part JWT and prints both the Header and Payload arrays to the screen *without* cryptographic verification.

```
$jwtToken = "eyJhbGciOiJFUzM4NC...";

// Directly outputs the decoded Header and Payload
$customSdk->inspectToken($jwtToken);
```

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance93

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

4

Last Release

37d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ca01cef59a4f10558a11c23d1de18601aebaedc93a11d0c7e88cb3b788cbaa1c?d=identicon)[khimsynat](/maintainers/khimsynat)

### Embed Badge

![Health badge](/badges/debc-camie-camie-superapp-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/debc-camie-camie-superapp-sdk/health.svg)](https://phpackages.com/packages/debc-camie-camie-superapp-sdk)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.5M7](/packages/exsyst-swagger)[lucasdotvin/laravel-soulbscription

A straightforward interface to handle subscriptions and features consumption.

709209.3k](/packages/lucasdotvin-laravel-soulbscription)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
