spomky-labs/oauth2-server-defuse-generator
A helper for spomky-labs/oauth2-server that generates Defuse encryption keys, giving you a quick command to create the secret needed to protect tokens and authorization codes. Install with Composer, run the generator, and add the key to your OAuth2 configuration.
spomky-labs/oauth2-server. In that case it is a pure plug-in: low effort, reversible, no API surface exposed to end users. Good candidate for "adopt quietly, don't announce."Adopt only when all of the following hold:
spomky-labs/oauth2-server and its generator interface is still the one this package targets (verify against your pinned version — this ecosystem has moved on, and API drift is likely).rand(), mt_rand(), uniqid(), or a non-CSPRNG source, or you cannot easily prove it doesn't.Look elsewhere — or build in-house — when:
league/oauth2-server or any other stack. This package will not fit; the integration point is Spomky-specific.bin2hex(random_bytes(32)) or rtrim(strtr(base64_encode(random_bytes(32)), '+/', '-_'), '='). PHP 7+ ships a CSPRNG in core. You are buying ~20 lines of code and inheriting a dependency graph. Recommend build, not buy.paragonie/random_compat successors, ramsey/uuid v4 for identifiers, or the OAuth2 framework's own generator implementations — or, best, the framework's default if it already delegates to random_bytes.Bottom line for the backlog: file as "verify token generation uses a CSPRNG." Close as won't-fix-by-dependency; fix in-house.
To executives (30 seconds): "A security review question came up about how our login tokens are generated. There's a small open-source add-on that swaps in a well-regarded crypto library for that specific job. It's low effort and low risk, but the package itself is unmaintained and nobody else uses it — so I'm recommending we implement the same guarantee ourselves in about a day of engineering rather than take on a dead dependency. Net effect for the business: same security posture, no new supply-chain exposure, negligible cost."
To engineering (the actual ask): "Confirm what generates our authorization codes and access tokens. If it's already random_bytes-backed, we close this. If not, replace it with a 20-line CSPRNG-backed generator behind the existing interface — don't pull in spomky-labs/oauth2-server-defuse-generator. It targets a stack we may not be on, it has zero dependents and no maintenance signal, and it's wrapping functionality PHP gives us for free. If someone specifically wants the Defuse string format for compatibility, we can vendor the logic with attribution and own the patch path."
Framing note: position this as risk retirement, not capability acquisition. There is no user-visible feature here, no performance win, no revenue lever. The value is entirely in being able to answer "yes" to a security questionnaire and in not adding an unmaintained crypto-adjacent package to the dependency tree.
How can I help you explore Laravel packages today?