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 (includingsuspendedandremoved), with one predicate each for capacity, provisioning and the gate's directory.DirectoryMemberStatereads a directory entry so that an unknown state refuses that one member instead of failing the document.MemberActionRequest,RemoveRequest,SuspendResponse,ResumeResponse,ArchiveResponse,RemoveResponse,MemberView,EnforcementandRemovalArchive: the bodies of the administrator's suspend, resume, archive, remove and member-view routes.ErrorCodedefines the codes Steps 3a and 3b add, such assuspended(403),archive_required(409),lease_revoked(403) andlease_expired(503).ValidManifest,Manifest,ManifestRule,JobCeilingsandJobLimits: an application manifest, validated member by member against the node's ceilings, with each refusal naming its member and rule.render_offeredrenders the WAC authorisations (OfferedGrant) a member consents to, byte for byte as the node stores them, andScheduledoes a scheduled installation's period arithmetic.- The bodies of the administrator's application routes and the member's
installation routes, their identifiers (
ApplicationId,InstallationId,JobId) and states, theEnforcementPartsof a withdrawal or suspension, andDirectoryAppKey, the gate directory'sapp_keysentry. profile_card_path,profile_owner,profile_card,profile_aclandcard_names_owner: the one public profile document per pod, the gate's byte-exact matcher for its path, the Turtle document and ACL a client writes, and a conservative check that an existing card names its owner.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.