-
Notifications
You must be signed in to change notification settings - Fork 1
Update validator #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update validator #19
Conversation
Update LineBreakValidator to check for correct number of empty lines before the URI field per EIP-4361: require 1 empty line if a statement exists, and 2 if not. Adds error reporting for missing or extra empty lines in these cases.
Added comprehensive tests for EIP-4361 line break handling in messages without a statement. Updated Jest setup to handle Docusaurus module mocks more robustly and clarified CSS module handling.
Update LineBreakValidator to insert two empty lines after the address when no statement is present, per EIP-4361. Add a test to verify correct line break fixing and validation in this scenario.
Added a comment to explain the use of two empty lines in the 'minimal' sample message per EIP-4361 specification when no statement is present.
Added support for the 'MISSING_LINE_BREAK_NO_STATEMENT' error in the FieldReplacer to ensure proper line break handling in messages without a statement.
Update SiweMessageParser to output 2 empty lines when no statement and 1 empty line before and after the statement when present, as required by EIP-4361. Add tests to verify correct line break handling and FieldReplacer fix for missing line breaks.
Update SiweMessageParser to correctly handle messages with two empty lines after the address when no statement is present, as per EIP-4361. Add a test to verify parsing behavior for this case.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude finished @caveman-eth's task —— View job TypeScript Code Quality ReviewTypeScript Quality AssessmentType Safety Rating: 9/10 ⭐
Architecture Rating: 8/10 🏗️
Modern Features Usage: 7/10 🚀
Overall TypeScript Quality: 8.5/10 🎯 Strengths🎯 Excellent Type System Usage
📋 Comprehensive Test Coverage
🔧 Solid Architecture Patterns
Areas for Improvement🚨 Type Safety Issues// parser.ts:99,122 - Consider type-safe field access
(fields as any)[field] = lines[lineIndex].substring(prefix.length);
// Better approach with mapped types
type FieldMap = {
[K in keyof SiweMessageFields]: K extends string ? `${K}Field` : never;
}⚡ Modern TypeScript Opportunities// lineBreakValidator.ts:279 - Could use template literals
type FieldKeys = 'headerIndex' | 'addressIndex' | 'statementIndex';
// Consider using utility types
type MessageStructure = Record<`${string}Index`, number>;🏗️ Architecture Enhancements// Consider discriminated unions for error types
type ValidationError =
| { type: 'format'; field: string; formatCode: string }
| { type: 'security'; field: string; securityLevel: 'high' | 'medium' | 'low' }
| { type: 'compliance'; field: string; standard: 'EIP-4361' };Specific File Analysis
|
No description provided.