Search by

pushinbr / pam-native-plugin-kit

DavidWilliamBalbino

Scaffold, validate and generate typed PAM Native plugins.

Package info

github.com/push-in/pam-native-plugin-kit

pkg:composer/pushinbr/pam-native-plugin-kit

Statistics

Installs: 4 256

Dependents: 8

Suggesters: 0

Stars: 0

Open Issues: 0

v0.5.0 2026-08-25 19:31 UTC

This package is auto-updated.

Last update: 2026-11-29 04:36:21 UTC


README

pam-native-plugin-kit: Scaffold, validate and code-generate typed PAM Native plugins from one IDL.

The official toolchain for building PAM Native plugins.
Validate plugin manifests, compile one typed IDL into PHP, Kotlin and Swift, scaffold cross-platform packages with CI, and certify them with a portable conformance report.

Packagist Latest release PHP 8.5 CI License

Install · Quick example · Typed IDL · Conformance · Docs · Issues

Install

Inside a PAM project, as a development tool:

pam composer require --dev pushinbr/pam-native-plugin-kit

The kit is plain PHP with no runtime dependency. Its CLI is vendor/bin/pam-native-plugin; run it on PAM's PHP runtime with pam exec as shown below. New to PAM? pam init my-app --template native creates a PAM Native project (see the PAM Native overview).

Quick example

pam exec vendor/bin/pam-native-plugin new acme/pam-native-biometric ./pam-native-biometric
pam exec vendor/bin/pam-native-plugin validate ./pam-native-biometric/pam-native.plugin.json
pam exec vendor/bin/pam-native-plugin compile ./pam-native-biometric/pam-native.idl.json ./generated
pam exec vendor/bin/pam-native-plugin conformance ./pam-native-biometric --json > conformance.json

new writes a cross-platform package (pam-native.plugin.json, pam-native.idl.json, src/, android/, ios/, tests/, CI). compile writes Contracts.php, Contracts.kt and Contracts.swift. Every command exits non-zero on failure.

Platform support

Platform Support Notes
PHP 8.5+ No other runtime dependency (composer.json)
Generated code PHP · Kotlin · Swift From one pam-native.idl.json
Scaffolded plugins Android · iOS Native SDK builds, device tests and signing stay in the plugin's own CI

Typed IDL

Coded variants are integer enums with sequential values beginning at 1. The compiler rejects gaps and string variants so PHP, Kotlin and Swift cannot silently disagree about wire values.

{
    "version": 1,
    "namespace": "Acme.Biometric",
    "enums": {
        "AuthenticationState": {
            "Pending": 1,
            "Authenticated": 2,
            "Rejected": 3
        }
    },
    "records": {
        "AuthenticationResult": {
            "state": "AuthenticationState",
            "reason": "string?"
        }
    }
}

Generated sources are deterministic and suitable for committing or checking in CI. The plugin manifest and IDL digests are recorded by PAM Native in .pam-native/plugins.lock.json. The schema is resources/pam-native.idl.schema.json.

Portable contributor certification

conformance is a non-mutating, dependency-free package audit that can run before native SDK jobs. It emits schema 1, Native surfaceCode: 2, sequential integer result/check codes, and SHA-256 evidence for seven bounded checks:

  1. manifest validation;
  2. typed IDL compilation;
  3. byte-for-byte PHP/Kotlin/Swift generation determinism;
  4. Composer plugin metadata;
  5. declared Kotlin source evidence;
  6. declared Swift source evidence;
  7. the portable PHP test entrypoint.

The runner reads at most 1 MiB per document, 256 native source files and 16 MiB per platform. Package paths are confined segment-by-segment; symlinks, traversal, duplicate source evidence and empty native source sets fail closed. The JSON contract is resources/pam-native-conformance.schema.json. This portable report does not replace Android/iOS compilation, device tests, signing or store validation.

API guide

API Responsibility
Scaffolder Create a cross-platform plugin repository with CI.
ManifestValidator Validate plugin metadata, native sources, and declared contracts.
IdlCompiler Generate deterministic PHP, Kotlin, and Swift types from one IDL.
ConformanceRunner / ConformanceReport Run the seven portable checks and export the report.
Diagnostic / ValidationResult Consume typed validation findings in tooling or CI.

All coded states, kinds, and variants are sequential integer-backed enums. Use enum cases in application code; do not depend on raw wire numbers.

Production checklist

  • Commit generated sources and verify regeneration is clean in CI.
  • Use sequential integer enums beginning at 1 in every wire contract.
  • Pin native requirements and record manifest/IDL digests.
  • Run pam doctor, pam test, and a signed release build on every supported platform.
  • Exercise denial, cancellation, backgrounding, process restart, and offline behavior before release.

Troubleshooting

  • Validation reports missing files: compare paths with the package root in the manifest.
  • Generated languages disagree: remove handwritten copies and regenerate from the IDL.
  • CI has a dirty diff: run compile locally and commit deterministic output.
  • Native integration is stale: run pam doctor --fix, rebuild the native host, and inspect the first reported diagnostic.

Report security vulnerabilities through the repository security policy or GitHub private vulnerability reporting, not a public issue.

Docs

Part of the PAM ecosystem

PAM

PAM runs PHP natively on servers, desktops and phones. This repository is one piece of it.

PAM PAM Desktop PAM Native Ecosystem
the runtime and CLI native desktop apps in PHP native Android and iOS apps in PHP every official package and plugin

Docs: push-in.github.io/pam-docs · Issues

Apache License 2.0 · Made in Brazil by Pushin