Skip to content

Commit

Permalink
fix: incorrect parsing of public key coordinates and enable some test…
Browse files Browse the repository at this point in the history
…s again (#1215)

Signed-off-by: Shota Jolbordi <shota.jolbordi@iohk.io>
Signed-off-by: Hyperledger Bot <hyperledger-bot@hyperledger.org>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Hyperledger Bot <hyperledger-bot@hyperledger.org>
  • Loading branch information
3 people authored Jun 21, 2024
1 parent cb4d479 commit 5398a75
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
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] = {
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();
// });
}

0 comments on commit 5398a75

Please sign in to comment.