Skip to main content

Crate ironshield_core

Crate ironshield_core 

Source
Expand description

§Core functionality for the IronShield proof-of-work system.

This module contains shared code that can be used in both the server-side (Cloudflare Workers) and client-side (WASM) implementations

Modules§

chrono
Chrono: Date and Time for Rust

Structs§

IronShieldChallenge
IronShieldChallengeResponse
IronShieldRequest
endpoint: The endpoint URL for the request.timestamp: The timestamp of the request in unix millis.
IronShieldToken
PoWConfig
Configuration parameters for proof-of-work challenges.
SigningKey
ed25519 signing key which can be used to produce signatures.

Enums§

CryptoError

Constants§

CHALLENGE_DIFFICULTY

Functions§

concat_struct_base64url_decode
Decodes a Base64 URL-safe encoded string into a concatenated string.
concat_struct_base64url_encode
Encodes a concatenated string into a Base64 URL-safe format without padding.
create_signing_message
Creates a message to be signed from challenge data components
deserialize_32_bytes
Custom serialization for 32-byte arrays (challenge params, public keys)
deserialize_signature
Custom deserialization for 64-byte arrays (Ed25519 signatures)
execute_proof_of_work
Proof-of-work function that handles both worker coordination and single-threaded fallback modes.
find_solution
Find a solution for the given IronShieldChallenge using optimized multithreaded computation.
generate_signature
Generates an Ed25519 signature for a given message using the provided signing key
generate_test_keypair
Generates a new Ed25519 keypair for testing purposes
load_private_key_from_data
Loads a private key from raw key data (for Cloudflare Workers)
load_private_key_from_env
Loads the private key from the IRONSHIELD_PRIVATE_KEY environment variable
load_public_key_from_data
Loads a public key from raw key data (for Cloudflare Workers)
load_public_key_from_env
Loads the public key from the IRONSHIELD_PUBLIC_KEY environment variable
serialize_32_bytes
Custom serialization for 32-byte arrays (challenge params, public keys).
serialize_signature
Custom serialization for 64-byte arrays (Ed25519 signatures)
sign_challenge
Signs a challenge using the private key from environment variables.
validate_challenge
Verifies a challenge and checks if it’s valid and not expired
verify_challenge_signature
Verifies a challenge signature using the public key from environment variables
verify_challenge_signature_with_key
Verifies a challenge signature using a provided public key
verify_ironshield_solution
Verify that an IronShieldChallengeResponse contains a valid solution.