Skip to content
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

fix: incorrect parsing of public key coordinates and enable some tests again #1215

Merged
merged 5 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ object Proof {
}

object EcdsaSecp256k1Signature2019ProofGenerator {
private def stripLeadingZero(arr: Array[Byte]): Array[Byte] = {
yshyn-iohk marked this conversation as resolved.
Show resolved Hide resolved
if (arr.length == 33 && arr.head == 0) then arr.tail else arr
}
def generateProof(payload: Json, signer: ECDSASigner, pk: ECPublicKey): Task[EcdsaSecp256k1Signature2019Proof] = {
for {
dataToSign <- ZIO.fromEither(JsonUtils.canonicalizeJsonLDoRdf(payload.spaces2))
Expand All @@ -63,8 +66,8 @@ object EcdsaSecp256k1Signature2019ProofGenerator {
jwsObject = JWSObject(header, payload)
_ = jwsObject.sign(signer)
jws = jwsObject.serialize(true)
x = pk.getW.getAffineX.toByteArray
y = pk.getW.getAffineY.toByteArray
x = stripLeadingZero(pk.getW.getAffineX.toByteArray)
y = stripLeadingZero(pk.getW.getAffineY.toByteArray)
jwk = JsonWebKey(
kty = "EC",
crv = Some("secp256k1"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@proof @jwt
Feature: Present Proof Protocol

@flaky
Scenario: Holder presents credential proof to verifier
Given Verifier and Holder have an existing connection
And Holder has an issued credential from Issuer
Expand All @@ -18,7 +17,6 @@ Feature: Present Proof Protocol
And Holder rejects the proof
Then Holder sees the proof is rejected

@flaky
Scenario: Holder presents proof to verifier which is the issuer itself
Given Issuer and Holder have an existing connection
And Holder has an issued credential from Issuer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@revocation @jwt @flaky
@revocation @jwt
Feature: Credential revocation - JWT

Background:
Expand All @@ -10,12 +10,12 @@ Feature: Credential revocation - JWT
When Issuer sends a request for proof presentation to Holder
And Holder receives the request
And Holder makes the presentation of the proof to Issuer
# Then Issuer sees the proof returned verification failed
Then Issuer sees the proof returned verification failed

Scenario: Holder tries to revoke credential from issuer
When Holder tries to revoke credential from Issuer
And Issuer sends a request for proof presentation to Holder
And Holder receives the request
And Holder makes the presentation of the proof to Issuer
# Then Issuer has the proof verified
# And Issuer should see the credential is not revoked
Then Issuer has the proof verified
And Issuer should see the credential is not revoked
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,11 @@ export default (data: {
holder.acceptVerifierConnection(verifier.connectionWithHolder!.invitation)
verifier.finalizeConnectionWithHolder()
holder.finalizeConnectionWithVerifier()
}) &&

describe('Verifier requests proof from Holder', function () {
verifier.requestProof()
holder.waitAndAcceptProofRequest(verifier.presentation!.thid)
verifier.acknowledgeProof()
})
// &&
//
// describe("Verifier requests proof from Holder", function () {
// verifier.requestProof();
// holder.waitAndAcceptProofRequest(verifier.presentation!.thid);
// verifier.acknowledgeProof();
// });
}
Loading