The host half of the sodium stand-in: every sodium_* function the PHP extension has, over
synchronous JavaScript.
The bridge is synchronous because the build has no Asyncify, which rules WebCrypto out
(crypto.subtle is Promise-based and would need one Zend park per call). Each function is backed
by the first of these that holds: @noble/ciphers and @noble/hashes (installed), blakejs
(installed, used for the BLAKE2b state), then the noble curve wrappers in sodium-curve.ts
and the AEGIS code in sodium-aegis.ts. Randomness is crypto.getRandomValues, which is synchronous.
The PHP half passes each argument as base64 (strings) or a number (ints) and gets back a tagged
value; a refusal is a reply the PHP half raises as the exception ext-sodium raises.
The host half of the sodium stand-in: every
sodium_*function the PHP extension has, over synchronous JavaScript.The bridge is synchronous because the build has no Asyncify, which rules WebCrypto out (
crypto.subtleis Promise-based and would need one Zend park per call). Each function is backed by the first of these that holds:@noble/ciphersand@noble/hashes(installed),blakejs(installed, used for the BLAKE2b state), then the noble curve wrappers insodium-curve.tsand the AEGIS code insodium-aegis.ts. Randomness iscrypto.getRandomValues, which is synchronous.The PHP half passes each argument as base64 (strings) or a number (ints) and gets back a tagged value; a refusal is a reply the PHP half raises as the exception ext-sodium raises.