-
Notifications
You must be signed in to change notification settings - Fork 111
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
Delegate digest generation to the auth module. #1162
Conversation
I think this is better as is since it is more general. This would couple the auth package directly to the If an auth package needs the transaction details, I'd suggest we use an interface like: type Byter interface {
Bytes() []byte
} and handle it within the auth package for that special case. |
@aaronbuchwald Unfortunately, our EIP712 implementation requires almost all the data from the
Other authentication methods do need the Regarding the coupling of type Transaction interface {
GetBase() chain.Base
GetActions() []chain.Action
Bytes() []byte
Sign(...) *Transaction, error
Verify(...) error
} But yeah, I have second thoughts about it. My solution doesn't look as neat as I would like if we end up making By the way, |
Hmm, I think it's a good thing for the auth package to be decoupled from the transaction type. It's not a large change, but I'd prefer not to couple the auth package to transactions if it can be avoided since it makes it more versatile and generally seems like a reasonable line to draw. If we passed an interface in, then the EIP-712 package could cast to the original transaction type and others could call the I don't want to make too large of a change to fit EIP-712 here either. Let's discuss offline and then post the result here. |
I couldn't use the type DigestProvider interface {
Digest() ([]byte, error)
} I'll test this version with manual casting for EIP712 next. |
Not currently necessary. Closing. |
Current implementation: The transaction calls its
Digest
method, which returns []byte. Then,chain.AuthFactory.Sign(msg []byte)
signs the resulting bytes of the digest.Proposal: Change to
chain.AuthFactory.Sign(tx *Transaction)
wherechain.AuthFactory
calls theDigest
method instead of the transaction.Similar changes for
chain.AuthBatchVerifier.Add
andchain.Auth.Verify
.