OpaqueLibrary
in package
Loads `libaxiam_opaque_ffi` once per process, memoizing failure as well as success.
Two independent things can be absent, and both are normal:
ext-ffi. Not guaranteed on any PHP runtime, and disabled outright on some shared hosts. A consumer whose tenant does not use OPAQUE should not be obliged to have it.- The shared library. A Rust
cdylibpublished as a per-platform asset of the AXIAM release, not a Composer package — there is no cross-language registry to put it on.
Either absence makes Opaque::available() report false rather than throwing, so an
application chooses the password path up front instead of discovering the gap mid-login.
Memoizing the failure matters as much as memoizing the success: retrying the load on every
login is a per-request filesystem walk for a file that is not going to appear.
Table of Contents
Constants
- PATH_ENV : mixed = 'AXIAM_OPAQUE_LIBRARY'
- Overrides the search: an absolute path to the shared library.
Methods
- candidatePaths() : array<int, string>
- Where to look, most specific first.
- load() : OpaqueNativeInterface|null
- The library, or `null` when it — or `ext-ffi` — is not present.
- require() : OpaqueNativeInterface
- The library, or a refusal naming the artifact.
- resetForTests() : void
- Forgets the memoized load. Test-only.
- setForTests() : void
- Installs a binding, bypassing the loader. Test-only.
Constants
PATH_ENV
Overrides the search: an absolute path to the shared library.
public
mixed
PATH_ENV
= 'AXIAM_OPAQUE_LIBRARY'
Methods
candidatePaths()
Where to look, most specific first.
public
static candidatePaths() : array<int, string>
The environment variable wins when set — the escape hatch for a deployment that ships the artifact somewhere the loader would not look, which is the normal case for a container image carrying it alongside the application rather than installing it system-wide.
Return values
array<int, string>load()
The library, or `null` when it — or `ext-ffi` — is not present.
public
static load() : OpaqueNativeInterface|null
Return values
OpaqueNativeInterface|nullrequire()
The library, or a refusal naming the artifact.
public
static require() : OpaqueNativeInterface
Never an AuthError: absent is a deployment fact, and reporting it as a credential failure would send a user off to reset a password that works.
Return values
OpaqueNativeInterfaceresetForTests()
Forgets the memoized load. Test-only.
public
static resetForTests() : void
setForTests()
Installs a binding, bypassing the loader. Test-only.
public
static setForTests(OpaqueNativeInterface|null $stub) : void
Parameters
- $stub : OpaqueNativeInterface|null