feat(sirius-press): a WordPress where the account is a key, not a mailbox
WordPress makes two assumptions this project cannot accept: that identity
comes from an email address, and that a site lives at one server. Both are
things somebody else can take away — a mailbox is rented from a provider who
can close it or be compelled to open it, and a server is one seizure from
being gone.
Sirius Press replaces the first and hedges the second.
Signing in means signing a challenge with the key that controls a CashAddress.
The address is recovered from the signature, so nothing is typed but the
signature itself, and the result is an ordinary WordPress session cookie —
roles, capabilities, nonces and the REST API never learn the login was
different. Three ways to produce one: a wallet the browser already exposes, a
phrase used once in the page and wiped, or a signature pasted in from any
BIP-137 wallet, which needs no JavaScript and lets the key stay on a machine
that never touches the web.
There is no password reset, and the recovery page says so plainly rather than
offering a form that cannot work. A reset mechanism is by construction a way
to take an account from its owner, and it is always easier to attack than the
cryptography it bypasses.
Publishing a post also exports it as static HTML to the name's storage on Sia,
signed by the key that owns the name, so the site keeps answering when the
server does not.
Email as a feature is untouched. wp_mail() still works, SMTP still sends, and
contact forms still deliver to addresses real people typed. Only mail to the
site's own unroutable placeholder addresses is diverted to an in-app inbox.
The objection was to email as identity, not to email.
Core is pinned and patched rather than vendored. WordPress 7.1.1 is 149 MB and
5,008 files; the fork's entire core diff is 75 lines in wp-admin/install.php.
Carrying the former to express the latter would bury the patch where nobody
reviews it and make every clone of the monorepo pay for it. Upstream releases
still merge through tools/update-wordpress.sh, which reapplies the series and
says exactly which hunk needs a human.
The cryptography is implemented twice — PHP on the server, JavaScript in the
page — because the server must verify and the browser must sign. Both are
pinned against libauth, the library the Sirius portal wallet and the BNS
gateway already use, so a disagreement of one byte fails the test suite rather
than presenting as a rejected login at three in the morning.
132 checks, no framework, about a second.
2026-09-21 01:39:38 +02:00
< ? php
/**
* Plugin Name : Sirius Press Core
* Plugin URI : https :// code . silentmode . st / silentmode / sirius - press
* Description : Wallet identity , gateway publishing and the in - app inbox that the rest of Sirius Press is built on .
* Version : 0.1 . 0
* Requires at least : 6.5
* Requires PHP : 7.4
* Author : Silent Mode
* Author URI : https :// silentmode . st
* License : GPL - 2.0 - or - later
* License URI : https :// www . gnu . org / licenses / gpl - 2.0 . html
* Text Domain : sirius - press
*
* @ package SiriusPress
*/
defined ( 'ABSPATH' ) || exit ;
define ( 'SIRIUS_PRESS_VERSION' , '0.1.0' );
define ( 'SIRIUS_PRESS_CORE_FILE' , __FILE__ );
define ( 'SIRIUS_PRESS_CORE_DIR' , plugin_dir_path ( __FILE__ ) );
define ( 'SIRIUS_PRESS_CORE_URL' , plugin_dir_url ( __FILE__ ) );
foreach (
array (
'class-sp-bn' ,
'class-sp-secp256k1' ,
'class-sp-cashaddr' ,
'class-sp-hd' ,
'class-sp-message' ,
'class-sp-settings' ,
'class-sp-gateway' ,
'class-sp-identity' ,
'class-sp-inbox' ,
'class-sp-admin' ,
) as $sp_class
) {
require_once SIRIUS_PRESS_CORE_DIR . 'includes/' . $sp_class . '.php' ;
}
/**
* The function this whole fork turns on .
*
* Core calls `is_email()` in a dozen places to decide whether a string is a
* usable identity . Sirius Press answers the same question about a different
* kind of string , and the core patches in `patches/` swap the call rather
* than changing what `is_email()` itself means — plugins still need the real
* `is_email()` for contact forms and newsletters .
*
* @ param string $value
* @ return bool
*/
function is_cashaddr ( $value ) {
return SP_CashAddr :: is_valid ( $value );
}
/**
* The address that identifies a user , or '' — the `user_email` of this fork .
*
* @ param int | WP_User | null $user Defaults to the current user .
*/
function sirius_press_address ( $user = null ) {
if ( null === $user ) {
$user = get_current_user_id ();
}
$id = $user instanceof WP_User ? $user -> ID : ( int ) $user ;
return $id ? SP_Identity :: address_of ( $id ) : '' ;
}
/**
* Whether this installation can do wallet cryptography at all .
*
* Checked on activation and shown as an admin notice rather than left to
* surface as a fatal during someone ' s first login attempt .
*
* @ return string '' when fine , otherwise what is missing .
*/
function sirius_press_requirements_problem () {
if ( ! SP_BN :: available () ) {
return __ ( 'Sirius Press needs either the GMP or the BCMath PHP extension to verify wallet signatures. Ask your host to enable one — GMP is much faster.' , 'sirius-press' );
}
if ( PHP_INT_SIZE < 8 ) {
return __ ( 'Sirius Press needs 64-bit PHP. Address checksums cannot be computed on a 32-bit build.' , 'sirius-press' );
}
if ( ! function_exists ( 'openssl_encrypt' ) ) {
return __ ( 'Sirius Press needs the OpenSSL PHP extension to store a publishing key safely.' , 'sirius-press' );
}
return '' ;
}
register_activation_hook (
__FILE__ ,
function () {
SP_Inbox :: install ();
}
);
add_action (
'plugins_loaded' ,
function () {
if ( ( int ) get_option ( 'sirius_press_inbox_version' , 0 ) < SP_Inbox :: VERSION ) {
SP_Inbox :: install ();
}
SP_Identity :: hooks ();
SP_Inbox :: hooks ();
SP_Admin :: hooks ();
}
);
fix(sirius-press): recovering a key is not the same as verifying a signature
Running the fork against a live WordPress found a real hole in registration,
and it is the kind that only shows up when you actually try it.
ECDSA public-key recovery always succeeds. Given any well-formed signature
and any digest it returns a key — just not the signer's, unless the digest is
the one that was signed. The auth flow leaned on that as if a wrong message
would fail. It does not; it quietly yields a stranger's address.
At sign-in this was harmless, because the wrong address matches no account
and the attempt fails. Registration and wallet-linking were another matter:
both took the recovered address and bound it to an account, so a signature
over slightly different text — a challenge copied without its blank line, a
wallet that rewrote the text, a login signature replayed at the registration
form — created an account keyed to an address nobody could sign for. The
person would see "success" and discover the truth the next time they tried to
get in. Wallet-linking was worse still: it would move an existing account onto
a dead address and lock its owner out of their own site.
Both paths now require the address the signer claims and compare it to the
recovered one, which is what verification actually means. Sign-in accepts the
claim when the page sends it and uses it to turn "no account uses that wallet"
into the more useful "that signature is not over the text we asked for".
Also from running it:
URL rewriting mangled every link on a site whose URL carries a port. The
protocol-relative pass matched inside absolute URLs and gave each one a second
scheme, and matching the host without its port left the port stranded as
`//host:8760:8760/`. Local and staging installs would have exported a site of
broken links.
Plain permalinks silently collapse an entire site onto one exported file,
because every post's URL is `/?p=N` and its path is `/`. The queue looks
healthy the whole time. The Publishing screen now says so.
Translations loaded on `plugins_loaded`, which WordPress 6.7 warns about on
every request — the kind of noise that trains people to stop reading logs.
And one deletion: an `is_email()` filter written on the assumption that
WordPress rejects `.invalid` addresses. It does not — `is_email()` validates
syntax, not whether a domain could exist — so the filter never fired. A filter
that appears to relax a rule but does not is worse than no filter, because
someone later reasons from it. The documentation made the same claim and has
been corrected.
Verification added rather than asserted: tests/live.mjs drives a real instance
over HTTP (40 checks), and tests/mock-gateway.mjs answers uploads with the
signature check transcribed from the gateway's own source, so the publishing
path can be exercised without a registered name.
2026-09-21 02:35:32 +02:00
/*
* Translations load on `init` , not `plugins_loaded` . WordPress 6.7 started
* warning about the earlier hook because the locale is not settled yet , and a
* notice on every request is the kind of thing that trains people to ignore
* their logs .
*/
add_action (
'init' ,
function () {
load_plugin_textdomain ( 'sirius-press' , false , dirname ( plugin_basename ( SIRIUS_PRESS_CORE_FILE ) ) . '/languages' );
}
);
feat(sirius-press): a WordPress where the account is a key, not a mailbox
WordPress makes two assumptions this project cannot accept: that identity
comes from an email address, and that a site lives at one server. Both are
things somebody else can take away — a mailbox is rented from a provider who
can close it or be compelled to open it, and a server is one seizure from
being gone.
Sirius Press replaces the first and hedges the second.
Signing in means signing a challenge with the key that controls a CashAddress.
The address is recovered from the signature, so nothing is typed but the
signature itself, and the result is an ordinary WordPress session cookie —
roles, capabilities, nonces and the REST API never learn the login was
different. Three ways to produce one: a wallet the browser already exposes, a
phrase used once in the page and wiped, or a signature pasted in from any
BIP-137 wallet, which needs no JavaScript and lets the key stay on a machine
that never touches the web.
There is no password reset, and the recovery page says so plainly rather than
offering a form that cannot work. A reset mechanism is by construction a way
to take an account from its owner, and it is always easier to attack than the
cryptography it bypasses.
Publishing a post also exports it as static HTML to the name's storage on Sia,
signed by the key that owns the name, so the site keeps answering when the
server does not.
Email as a feature is untouched. wp_mail() still works, SMTP still sends, and
contact forms still deliver to addresses real people typed. Only mail to the
site's own unroutable placeholder addresses is diverted to an in-app inbox.
The objection was to email as identity, not to email.
Core is pinned and patched rather than vendored. WordPress 7.1.1 is 149 MB and
5,008 files; the fork's entire core diff is 75 lines in wp-admin/install.php.
Carrying the former to express the latter would bury the patch where nobody
reviews it and make every clone of the monorepo pay for it. Upstream releases
still merge through tools/update-wordpress.sh, which reapplies the series and
says exactly which hunk needs a human.
The cryptography is implemented twice — PHP on the server, JavaScript in the
page — because the server must verify and the browser must sign. Both are
pinned against libauth, the library the Sirius portal wallet and the BNS
gateway already use, so a disagreement of one byte fails the test suite rather
than presenting as a rejected login at three in the morning.
132 checks, no framework, about a second.
2026-09-21 01:39:38 +02:00
add_action (
'admin_notices' ,
function () {
if ( ! current_user_can ( 'manage_options' ) ) {
return ;
}
$problem = sirius_press_requirements_problem ();
if ( '' !== $problem ) {
printf ( '<div class="notice notice-error"><p>%s</p></div>' , esc_html ( $problem ) );
return ;
}
if ( ! SP_Settings :: is_configured () ) {
printf (
'<div class="notice notice-warning"><p>%s <a href="%s">%s</a></p></div>' ,
esc_html__ ( 'Sirius Press does not know which BCNR name this site publishes under yet.' , 'sirius-press' ),
esc_url ( admin_url ( 'admin.php?page=sirius-press' ) ),
esc_html__ ( 'Set it now' , 'sirius-press' )
);
}
}
);