Skip to content

Possible Askar Key Management issue after migrating to v0.6.1 #2597

@Sshovon

Description

@Sshovon

I am trying to migrate my agents to Credo v0.6.1, but I am encountering issues related to Askar key management. On this version, the agent is unable to create new keys or access existing keys to any ops. When attempting to create a new key, the process fails with a KeyManagementError: Error creating key, caused by a TypeError: Cannot read properties of undefined (reading 'keyGetJwkSecret') originating from AskarKeyManagementService.privateJwkFromKey.

KeyManagementError: Error creating key
    at AskarKeyManagementService.createKey (file:///home/frcs/my-zone/temp-credo-agent/node_modules/@credo-ts/askar/src/kms/AskarKeyManagementService.ts:250:13)
    at KeyManagementApi$1.createKey (file:///home/frcs/my-zone/temp-credo-agent/node_modules/@credo-ts/core/src/modules/kms/KeyManagementApi.ts:81:27)
    at Function.build (/home/frcs/my-zone/temp-credo-agent/holder.ts:42:48)
    at main (/home/frcs/my-zone/temp-credo-agent/holder.ts:89:5) {
  [cause]: TypeError: Cannot read properties of undefined (reading 'keyGetJwkSecret')
      at AskarKeyManagementService.privateJwkFromKey (file:///home/frcs/my-zone/temp-credo-agent/node_modules/@credo-ts/askar/src/kms/AskarKeyManagementService.ts:721:13)
      at AskarKeyManagementService.publicJwkFromKey (file:///home/frcs/my-zone/temp-credo-agent/node_modules/@credo-ts/askar/src/kms/AskarKeyManagementService.ts:710:45)
      at AskarKeyManagementService.createKey (file:///home/frcs/my-zone/temp-credo-agent/node_modules/@credo-ts/askar/src/kms/AskarKeyManagementService.ts:235:30)
      at KeyManagementApi$1.createKey (file:///home/frcs/my-zone/temp-credo-agent/node_modules/@credo-ts/core/src/modules/kms/KeyManagementApi.ts:81:27)
      at Function.build (/home/frcs/my-zone/temp-credo-agent/holder.ts:42:48)
      at main (/home/frcs/my-zone/temp-credo-agent/holder.ts:89:5)
}

If I attempt to use any existing key, I instead encounter a TypeError: Cannot read properties of undefined (reading 'sessionFetchKey'). One important observation is that this issue only occurs when installing and running the packages in a separate repository; the demo-openid works as expected with similar agent configuration.

This makes me wonder if I might be missing some initialization step, configuration that demo-openid already includes. The issue can be reproduced by running npm run holder in this repo. I would really appreciate any pointers or guidance on what I might be overlooking, or if there are any known migration steps or changes in v0.6.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions