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

Error Signing data with verkey #2130

Open
sudddy opened this issue Dec 6, 2024 · 2 comments
Open

Error Signing data with verkey #2130

sudddy opened this issue Dec 6, 2024 · 2 comments

Comments

@sudddy
Copy link

sudddy commented Dec 6, 2024

Error signing data with verkey while issuing credential using OPENIDVC protocol

When trying to issue a credential using the OPENIDVC protocol, I get a Error signing data with verkey error.
The error occurs after CredentialRequestReceived state (while processing the Request) on the /credential endpoint.

Error Details

{
  "_tags": {
    "cNonce": "a10d73cb-7cf1-4cf4-8d74-2a4450df4098",
    "credentialOfferUri": "https://corgi-healthy-preferably.ngrok-free.app/oid4vci/831a636d-225a-4e75-b1ed-45a42d74656e/offers/b25cbfc3-d3d6-4fd7-aeeb-ec9c94d29817",
    "issuerId": "831a636d-225a-4e75-b1ed-45a42d74656e",
    "preAuthorizedCode": "905920343458391194868841",
    "state": "CredentialRequestReceived"
  },
  "cNonce": "a10d73cb-7cf1-4cf4-8d74-2a4450df4098",
  "cNonceExpiresAt": "2024-12-06T01:40:05.724Z",
  "createdAt": "2024-12-06T01:34:59.582Z",
  "credentialOfferPayload": {
    "credential_configuration_ids": [
      "temp_6747b5d12f935574d554de63"
    ],
    "credential_issuer": "https://corgi-healthy-preferably.ngrok-free.app/oid4vci/831a636d-225a-4e75-b1ed-45a42d74656e",
    "credentials": [
      "temp_6747b5d12f935574d554de63"
    ],
    "grants": {
      "urn:ietf:params:oauth:grant-type:pre-authorized_code": {
        "pre-authorized_code": "905920343458391194868841",
        "user_pin_required": false
      }
    }
  },
  "credentialOfferUri": "https://corgi-healthy-preferably.ngrok-free.app/oid4vci/831a636d-225a-4e75-b1ed-45a42d74656e/offers/b25cbfc3-d3d6-4fd7-aeeb-ec9c94d29817",
  "errorMessage": "Error signing data with verkey 2VSH4YK8HxRQBJ45bNrVv9DLGRwXjznhyq98e6ssVC9n. Error retrieving Secure Environment record",
  "id": "81bbe793-2d07-4adb-a595-a31457afce2c",
  "issuedCredentials": [
    "temp_6747b5d12f935574d554de63"
  ],
  "issuerId": "831a636d-225a-4e75-b1ed-45a42d74656e",
  "level": "error",
  "message": "OpenID4VC Issuance session error",
  "metadata": {
    "data": {}
  },
  "preAuthorizedCode": "905920343458391194868841",
  "state": "Error",
  "type": "OpenId4VcIssuanceSessionRecord",
  "updatedAt": "2024-12-06T01:35:05.752Z"
}

Error Stack Trace

WARN: [OID4VCI] Sending error response: {
  "error": "invalid_request",
  "error_description": "Error signing data with verkey 2VSH4YK8HxRQBJ45bNrVv9DLGRwXjznhyq98e6ssVC9n. Error retrieving Secure Environment record"
}

WalletError: Error signing data with verkey 2VSH4YK8HxRQBJ45bNrVv9DLGRwXjznhyq98e6ssVC9n. Error retrieving Secure Environment record
    at AskarWallet.sign (/app/node_modules/@credo-ts/askar/build/wallet/AskarBaseWallet.js:241:19)
    at async /app/node_modules/@credo-ts/core/build/modules/sd-jwt-vc/SdJwtVcService.js:257:34

Caused by: WalletError: Error retrieving Secure Environment record
    at AskarWallet.getSecureEnvironmentKey (/app/node_modules/@credo-ts/askar/build/wallet/AskarBaseWallet.js:409:19)
    at async AskarWallet.sign (/app/node_modules/@credo-ts/askar/build/wallet/AskarBaseWallet.js:189:39)
    at async /app/node_modules/@credo-ts/core/build/modules/sd-jwt-vc/SdJwtVcService.js:257:34

Caused by: SyntaxError: "undefined" is not valid JSON
    at JSON.parse (<anonymous>)
    at JsonEncoder.fromString (/app/node_modules/@credo-ts/core/build/utils/JsonEncoder.js:45:21)
    at AskarWallet.getSecureEnvironmentKey (/app/node_modules/@credo-ts/askar/build/wallet/AskarBaseWallet.js:406:39)
    at async AskarWallet.sign (/app/node_modules/@credo-ts/askar/build/wallet/AskarBaseWallet.js:189:39)
    at async /app/node_modules/@credo-ts/core/build/modules/sd-jwt-vc/SdJwtVcService.js:257:34

Any explanations on this would be helpful 🙏

@TimoGlastra
Copy link
Contributor

It seems it can't find the key. Are you sure the key exists? How did you create the key before issuance?

@sudddy
Copy link
Author

sudddy commented Dec 8, 2024

Screenshot 2024-12-07 at 8 00 14 PM

Supported Cryptographic Binding Methods: ['did:key', 'did:jwk']
Actual Issuer DID: did:key

Problem: The system is attempting to resolve the did:jwk method, despite the issuer using a did:key method. @TimoGlastra

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

No branches or pull requests

2 participants