stratum-node-core
Pre-release (
0.1.0-alpha). The API and the formats it defines may change before 0.1.0. Do not rely on it for production authentication yet.
Zero-I/O core types for Stratum pod
nodes, shared by the node controller and the stratum command-line client:
DidNostr: adid:nostrprincipal over a BIP-340 x-only public key, with hex and NIP-19npubforms.- Typed identifiers:
EventId,Sha256Digest,ChallengeId,InvitationId,OperationId,RevisionandUnixTime, each with one canonical text form. SignedEventandUnsignedEvent: NIP-01 events with event-ID recomputation and BIP-340 verification.verify_request: a signed-request verifier forAuthorization: Nostrheaders that is stricter than NIP-98: exactly oneuandmethodtag, mandatory body binding, byte-exact URL match and a bounded clock window.UnverifiedRequest,verify_request_without_bodyandBodyUncheckedRequest: read a header's claimed author before spending a signature verification, and verify everything but the body digest for a proxy that never sees the body.PodPathandis_valid_pod_query: pod request paths under the Stratum gate's allow-list and shape rules, with owner, container and sibling-ACL helpers.AdmissionClaim,InvitationId,ADMISSION_NOTICE_V1andMemberState: the body a tenant signs to redeem an invitation, the notice it binds, and the states a membership moves through.NostrSecretKey: signs events and request headers. It is zeroised on drop and redacted inDebug.ClaimBody: the immutable bootstrap claim an administrator signs, kept as the exact bytes issued.
The crate never reads a clock, a random source, the environment, the
filesystem or the network: time, randomness and expected values are
parameters. Cryptography comes from k256 (BIP-340), sha2 and bech32, and
is tested against the published BIP-340 vectors and against headers minted
by an independent NIP-98 implementation.
The verifier does not make requests single use. Record
VerifiedRequest::event_id() durably and refuse repeats.
Example
use ;
Minimum supported Rust version
1.89.
Licence
AGPL-3.0-only. See LICENSE.