Skip to content

feature/packages refactor#32

Draft
tarakby wants to merge 42 commits intomainfrom
feature/packages-refactor
Draft

feature/packages refactor#32
tarakby wants to merge 42 commits intomainfrom
feature/packages-refactor

Conversation

@tarakby
Copy link
Collaborator

@tarakby tarakby commented Jul 17, 2025

devin-ai-integration bot and others added 28 commits July 4, 2025 18:49
- Move SigningAlgorithm, Signature, PrivateKey, PublicKey to sign/sign.go
- Add registry system for algorithm implementations in sign package
- Update main sign.go to re-export types for backward compatibility
- Delegate public API functions to sign package
- Maintain all existing exported function/type names
- First step in crypto package refactoring

Co-Authored-By: tarak.benyoussef@flowfoundation.org <benyoussef.tarak@gmail.com>
- Implement signatureFormatCheck for blsBLS12381Algo to satisfy signer interface
- Method checks if signature has correct length (SignatureLenBLSBLS12381)
- Fixes compilation error where BLS implementation was missing required method

Co-Authored-By: tarak.benyoussef@flowfoundation.org <benyoussef.tarak@gmail.com>
- Remove unused 'fmt' import (no longer needed after delegating to sign package)
- Remove unused 'github.com/onflow/crypto/hash' import (moved to sign package)
- Keep only necessary imports: crypto/elliptic, btcec/v2, and sign package
- Fixes linting errors about unused imports

Co-Authored-By: tarak.benyoussef@flowfoundation.org <benyoussef.tarak@gmail.com>
- Remove newSigner function that became unused after delegating to sign package
- All public API functions now delegate directly to sign package methods
- Fixes linting error about unused function

Co-Authored-By: tarak.benyoussef@flowfoundation.org <benyoussef.tarak@gmail.com>
- Add signatureFormatCheck method to blsBLS12381Algo in no_cgo.go
- Method panics with appropriate message for no-CGO builds
- Fixes compilation error in CGO_ENABLED=0 test builds
- Ensures both CGO and no-CGO builds implement complete signer interface

Co-Authored-By: tarak.benyoussef@flowfoundation.org <benyoussef.tarak@gmail.com>
- Remove public Signer interface from sign package (violated user's rule)
- Remove RegisterSigner function (was not exported before)
- Restore original newSigner function in main package
- Update main package functions to use internal signer directly
- Add missing fmt import for error formatting

Co-Authored-By: tarak.benyoussef@flowfoundation.org <benyoussef.tarak@gmail.com>
- Remove UnknownSigningAlgorithm, BLSBLS12381, ECDSAP256, ECDSASecp256k1 constants from main package
- Update all references to use sign package constants (sign.ECDSAP256, etc.)
- Fix test file to use sign.ECDSAP256 instead of ECDSAP256
- Maintain backward compatibility by keeping type aliases

Co-Authored-By: tarak.benyoussef@flowfoundation.org <benyoussef.tarak@gmail.com>
- Replace ECDSAP256 with sign.ECDSAP256 in ecdsa_test.go
- Replace ECDSASecp256k1 with sign.ECDSASecp256k1 in ecdsa_test.go
- Replace BLSBLS12381 with sign.BLSBLS12381 in sign_test_utils.go
- Replace ECDSAP256 with sign.ECDSAP256 in sign_test_utils.go
- Replace ECDSASecp256k1 with sign.ECDSASecp256k1 in sign_test_utils.go

All test files now use the sign package constants instead of the removed crypto package constants.

Co-Authored-By: tarak.benyoussef@flowfoundation.org <benyoussef.tarak@gmail.com>
- Add import for github.com/onflow/crypto/sign to ecdsa_test.go
- Add import for github.com/onflow/crypto/sign to sign_test_utils.go
- Required for test files to use sign.ECDSAP256, sign.ECDSASecp256k1, sign.BLSBLS12381 constants

Co-Authored-By: tarak.benyoussef@flowfoundation.org <benyoussef.tarak@gmail.com>
- Fix function name from Testsign.BLSBLS12381Hasher to TestBLSBLS12381Hasher
- Fix constant names: PrKeyLensign.BLSBLS12381 -> PrKeyLenBLSBLS12381
- Fix constant names: SignatureLensign.BLSBLS12381 -> SignatureLenBLSBLS12381
- Fix type names: pubKeysign.BLSBLS12381 -> pubKeyBLSBLS12381
- Update testEquals call to use sign.ECDSAP256 instead of ECDSAP256

Co-Authored-By: tarak.benyoussef@flowfoundation.org <benyoussef.tarak@gmail.com>
- Fix double sign.sign. prefixes back to single sign. in ecdsa_test.go
- Restore proper benchmark function names (BenchmarkECDSAP256Sign, etc.)
- Fix remaining ECDSAP256 reference in BenchmarkECDSADecode function
- Update invalidSK function in bls_test.go to use sign.ECDSAP256

Co-Authored-By: tarak.benyoussef@flowfoundation.org <benyoussef.tarak@gmail.com>
- Add sign package import to bls.go, spock.go, and spock_test.go
- Update all BLSBLS12381 references to use sign.BLSBLS12381
- Complete the removal of redundant constants from main crypto package

Co-Authored-By: tarak.benyoussef@flowfoundation.org <benyoussef.tarak@gmail.com>
- Fix undefined sign error in bls_thresholdsign_test.go line 291
- Complete the removal of redundant constants from main crypto package

Co-Authored-By: tarak.benyoussef@flowfoundation.org <benyoussef.tarak@gmail.com>
- Add sign package import to no_cgo_test.go
- Update BLSBLS12381 references to use sign.BLSBLS12381
- Fix no-CGO build failure after removing constants from main package

Co-Authored-By: tarak.benyoussef@flowfoundation.org <benyoussef.tarak@gmail.com>
- Update signatureFormatCheck method to panic with specified message format
- Address GitHub comment from @tarakby requesting panic behavior
- Use fmt.Sprintf with a.algo field as requested

Co-Authored-By: tarak.benyoussef@flowfoundation.org <benyoussef.tarak@gmail.com>
…kage

- Complete sign/sign.go implementation with proper algorithm registration
- Replace root sign.go with backward compatibility re-exports
- Maintain all existing public APIs through main crypto package
- Algorithm instances initialized in main package and registered with sign package

Co-Authored-By: Tarak Ben Youssef <benyoussef.tarak@gmail.com>
- Remove p256Instance and secp256k1Instance from ecdsa.go
- Remove blsInstance from bls.go
- These instances are now declared in sign.go and registered with sign package

Co-Authored-By: Tarak Ben Youssef <benyoussef.tarak@gmail.com>
- Update all algorithm implementation methods to use sign.PrivateKey and sign.PublicKey
- Update interface compliance assertions to use sign package types
- Fix BLS and ECDSA key implementation method signatures
- Still investigating interface conversion panic during initialization

Co-Authored-By: Tarak Ben Youssef <benyoussef.tarak@gmail.com>
- Check return error from all sign.RegisterSigner calls
- Panic if registration fails with non-nil error
- Fixes errcheck linter warnings

Co-Authored-By: Tarak Ben Youssef <benyoussef.tarak@gmail.com>
- Remove unused blsInstance variable from no_cgo.go
- Resolves golangci-lint unused variable error in CI

Co-Authored-By: Tarak Ben Youssef <benyoussef.tarak@gmail.com>
…ign-package

Create sign package - First step of crypto refactoring
@tarakby tarakby changed the title Feature/packages refactor feature/packages refactor Jul 17, 2025
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