Skip to content

Conversation

CorruptedAesthetic
Copy link

No description provided.

…tion Method 1

- Add hybrid sr25519/ECDSA cryptographic signer with deterministic key derivation
- Implement RFC 7515 compliant JSON Web Signature (JWS) with ES256 algorithm
- Create Whiteflag Protocol Method 1 JWT authentication tokens with proper claims
- Add comprehensive test suite (32 tests) covering functionality and security
- Include examples demonstrating API integration and Node.js compatibility
- Support JWKS generation for public key distribution
- Maintain full compatibility with Substrate sr25519 keys and Whiteflag Protocol v1.0
- Modernize GitHub Actions workflow with proper YAML syntax
- Update to ubuntu-latest and actions@v4
- Add proper Rust toolchain setup with dtolnay/rust-toolchain
- Fix branches array syntax for workflow triggers
- Apply cargo fmt formatting to all code files
- Add clippy linting with warning enforcement
- All tests passing (32 total across wf_auth and main project)
- Remove unnecessary cast in wf_common/src/common.rs
- Fix lifetime syntax in wf_crypto/src/wf_encryption_key.rs
- Replace ToString with Display implementation in wf_field/src/types.rs
- Fix redundant field names in wf_field/src/message_header.rs
- Update format strings to use inline variables throughout codebase
- Fix manual ok() implementation in wf_parser/src/header.rs
- Remove needless match expressions and question mark operators
- Add allow(dead_code) for unused struct fields

All 143 tests passing, clippy warnings resolved.
- Apply rustfmt formatting to wf_field/src/request.rs
- Ensures CI/CD pipeline passes formatting checks
- Update JwtHeader::default() to use 'sr25519' instead of 'ES256'
- Update JWS creation to use sr25519 signing instead of ECDSA
- Update JWK Set creation to use sr25519 public key format
- Update all tests to expect sr25519 algorithm
- Update examples and documentation to reflect sr25519 usage
- Maintain backward compatibility with existing functionality

This change aligns with Polkadot/Substrate blockchain compatibility
as suggested in the evaluation document.
- Fix clippy warning about needless borrows for generic args
- Change Sha256::digest(&public_key_bytes) to Sha256::digest(public_key_bytes)
- Add bounds checking to prevent index out of bounds panic
- Return descriptive error message instead of crashing
- Fixes WhiteFlag encoding failures in production
@CorruptedAesthetic CorruptedAesthetic self-assigned this Oct 4, 2025
The JSON deserializer was assigning pseudoMessageCode index 14, which came
after text (index 11), authentication, crypto, and resource fields. This caused
the field values array to be sorted incorrectly for Test messages.

According to WhiteFlag spec section 4.3.6 and 5.5:
- Test messages have header fields (bytes 0-70)
- Followed by pseudoMessageCode (byte 71)
- Then body fields from the original message type (byte 72+)
- 'All other test message fields are shifted 1 byte / 8 bits'

The parser expects pseudoMessageCode FIRST in the body (after header), but the
old index ordering put it last, causing validation errors like:
'unencoded byte length is invalid - expected 1 but was 15'

This happened because the deserializer sorts fields by index, so when both
'text' (index 11) and 'pseudoMessageCode' (index 14) were present, 'text'
came first in the sorted array, violating the spec.

Fix: Move pseudoMessageCode to index 7 (immediately after header fields),
and shift all other body field indices up by 1. This ensures pseudoMessageCode
always appears first in the body, matching the WhiteFlag specification.

Fixes encoding of Test F messages and other test messages with body fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant