-
Notifications
You must be signed in to change notification settings - Fork 160
feat: Update Tink version, protobuf type #3413
Conversation
c346ec0
to
0f76497
Compare
@@ -278,14 +278,6 @@ func TestPublicKeyDataWithInvalidInput(t *testing.T) { | |||
|
|||
_, err = pkm.PublicKeyData(serializedKey) | |||
require.Error(t, err, "expect an error when input is a modified serialized key") | |||
|
|||
// nil | |||
_, err = pkm.PublicKeyData(nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer returns an error with the updated Tink version (pub key bytes in returned struct are just empty now)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove the whole test function since the main test is not applicable anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Baha-sk You mean remove TestPublicKeyDataWithInvalidInput
? Are the other test cases in it not applicable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the whole test function's purpose was to test empty/nil cases, it seems Tink now panics on purpose in these cases... you can probably recover the panic here and make sure it does actually panic instead of removing these calls? that would be a good test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some other test cases in this function still that work the same as before (above the code I removed, in this same function). For these two particular test cases I removed, they just don't return an error anymore (i.e. are not an invalid test case anymore)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point re: catching the panic - I'll update the other places in this PR where I removed those tests that panic to catch it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some other test cases in this function still that work the same as before (above the code I removed, in this same function). For these two particular test cases I removed, they just don't return an error anymore (i.e. are not an invalid test case anymore)
I think you can use require.Panics()
in this case, without having to set a value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two cases don't panic - they're not an error or panic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh ok.. I see.. no issues then.. it looks good.
require.Errorf(t, err, "expect an error when input is nil") | ||
|
||
// empty slice | ||
_, err = pkm.PublicKeyData([]byte{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer returns an error with the updated Tink version (pub key bytes in returned struct are just empty now)
@@ -38,9 +38,6 @@ func Test_ExtractPrivKey(t *testing.T) { | |||
require.EqualError(t, err, "extractPrivKey: can't extract unsupported private key 'type.googleapis.com/"+ | |||
"google.crypto.tink.AesGcmKey'") | |||
|
|||
_, err = extractPrivKey(&keyset.Handle{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing an empty keyset handle causes Tink to do a panic now instead of throwing an error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, this is fine then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to check for the panic now using require.PanicsWithValue
Why do we need a second PR for the second commit? |
4a9fae0
to
33c1634
Compare
@Moopli I don't have a valid commit I can use with |
you can push a second commit within the same PR where you can use the commit hash of the first commit in go.mod of the second commit, @Moopli is right
just replace the whole commit version with the sha hash of the first commit in go.mod then do |
never mind my previous comment, git needs to query GH to fetch the commit, and it's not there till it's merged |
Updated the Tink version and our methods to use the newer protobuf type that it uses. Reason for this change: the existing version of Tink makes use of a very large int in one particular place in the code, and this very large int prevents the gomobile tool from successfully generating Android bindings. This meant that aries-framework-go packages that used Tink could not be used in any code that you may want to generate Android bindings for. The updated version of Tink does not have that check anymore, which resolves the issue. Due to a circular dependency between the main module and component/storage/edv (and the fact that both of them require Tink), there are some module/build issues with this commit. This will be resolved in the next commit. Signed-off-by: Derek Trider <[email protected]>
33c1634
to
253124a
Compare
Updated the Tink version and our methods to use the newer protobuf type that it uses.
Reason for this change: the existing version of Tink makes use of a very large int in one particular place in the code, and this very large int prevents the gomobile tool from successfully generating Android bindings. This meant that aries-framework-go packages that used Tink could not be used in any code that you may want to generate Android bindings for. The updated version of Tink does not have that check anymore, which resolves the issue.
Due to a circular dependency between the main module and component/storage/edv (and the fact that both of them require Tink), there are some module/build issues with this commit. This will be resolved in the next commit.
Signed-off-by: Derek Trider [email protected]