Crate ironshield_types

Source
Expand description

Shared types and utilities for the IronShield PoW system

This crate contains the common data structures and serialization utilities used across ironshield-core, ironshield-cloudflare, and ironshield-wasm.

Re-exports§

pub use chrono;

Structs§

IronShieldChallenge
IronShieldChallengeResponse
IronShieldRequest
endpoint: The endpoint URL for the request.timestamp: The timestamp of the request in unix millis.
IronShieldToken
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)
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