Skip to content

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: [email protected] <[email protected]>
- 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: [email protected] <[email protected]>
- 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: [email protected] <[email protected]>
- 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: [email protected] <[email protected]>
- 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: [email protected] <[email protected]>
- 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: [email protected] <[email protected]>
- 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: [email protected] <[email protected]>
- 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: [email protected] <[email protected]>
- 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: [email protected] <[email protected]>
- 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: [email protected] <[email protected]>
- 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: [email protected] <[email protected]>
- 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: [email protected] <[email protected]>
- Fix undefined sign error in bls_thresholdsign_test.go line 291
- Complete the removal of redundant constants from main crypto package

Co-Authored-By: [email protected] <[email protected]>
- 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: [email protected] <[email protected]>
- 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: [email protected] <[email protected]>
…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 <[email protected]>
- 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 <[email protected]>
- 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 <[email protected]>
- 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 <[email protected]>
- Remove unused blsInstance variable from no_cgo.go
- Resolves golangci-lint unused variable error in CI

Co-Authored-By: Tarak Ben Youssef <[email protected]>
…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