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(dids): allow to pass in a key instance when creating a did document #1944

Conversation

berendsliedrecht
Copy link
Contributor

Signed-off-by: Berend Sliedrecht sliedrecht@berend.io

Copy link

changeset-bot bot commented Jul 8, 2024

🦋 Changeset detected

Latest commit: 4478cc4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@credo-ts/core Patch
@credo-ts/action-menu Patch
@credo-ts/anoncreds Patch
@credo-ts/askar Patch
@credo-ts/bbs-signatures Patch
@credo-ts/cheqd Patch
@credo-ts/drpc Patch
@credo-ts/indy-sdk-to-askar-migration Patch
@credo-ts/indy-vdr Patch
@credo-ts/node Patch
@credo-ts/openid4vc Patch
@credo-ts/question-answer Patch
@credo-ts/react-native Patch
@credo-ts/tenants Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines 40 to 61
let key = options.options.key

if (!key && keyType) {
key = await agentContext.wallet.createKey({
keyType,
seed,
privateKey,
})
}

if (!key) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to handle where both keyType and key are passed, but they don't match

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also need to handle the case where privateKey/seed is passed and key as well. That should cause an error. As it results in ambigious behaviour (I have no idea without looking at the code which will take precedence)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same for all files)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed now.

key instance cannot be combined with keyType, seed or private key.

@TimoGlastra
Copy link
Contributor

can you also add a changest?

Signed-off-by: Berend Sliedrecht <sliedrecht@berend.io>
@berendsliedrecht
Copy link
Contributor Author

can you also add a changest?

how?

@TimoGlastra
Copy link
Contributor

image

…ID jwk, key or peer with num algo 0

Signed-off-by: Berend Sliedrecht <sliedrecht@berend.io>
didRegistrationMetadata: {},
didState: {
state: 'failed',
reason: 'Key instance cannot be combined with key type, seed and or private key',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
reason: 'Key instance cannot be combined with key type, seed and or private key',
reason: 'Key instance cannot be combined with key type, seed or private key',

seed,
privateKey,
})
if (!key && keyType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can now just be if (keyType) because of the check above

Signed-off-by: Berend Sliedrecht <sliedrecht@berend.io>
@berendsliedrecht berendsliedrecht enabled auto-merge (squash) July 8, 2024 13:34
@berendsliedrecht berendsliedrecht enabled auto-merge (squash) July 8, 2024 13:34
@berendsliedrecht berendsliedrecht merged commit a5235e7 into openwallet-foundation:main Jul 16, 2024
11 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants