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

Add DidDht create, publish and resolve, add unit tests #308

Merged
merged 3 commits into from
Aug 23, 2024

Conversation

KendallWeihe
Copy link
Contributor

No description provided.

import web5.sdk.rust.Signer as RustCoreSigner

data class DidDhtCreateOptions(
val publish: Boolean? = false,
Copy link
Contributor

@nitro-neal nitro-neal Aug 23, 2024

Choose a reason for hiding this comment

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

so we don't publish by default? Should maybe talk to gabe, I think a while back we defaulted to published by default?

I'm 95% sure we will run into user error on this a lot. people will do default did dht create and wonder why it is not working for resolve

Copy link
Contributor

Choose a reason for hiding this comment

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

people will do default did dht create and wonder why it is not working for resolve

I would argue it is good for people to notice it is not working as they might expect and wonder why, causing them to learn that did:dht is a published did. If they do not understand that aspect of did:dht, they cannot make an informed choice of which did method to use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it actually is set to publish by default as you can see here

I was following the web5-js design

but perhaps here I should reinforce that experience by seeing = true? what do we think? Rust doesn't have the equivalent syntax so I was following Rust

Copy link
Contributor Author

Choose a reason for hiding this comment

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

alright, that's changed in the latest commit. I think we should set it as true at that layer, even though the default is true inside the rust core code (as I linked to above), because developers often look at the function signature to determine default behavior. good catch!

Copy link
Member

@decentralgabe decentralgabe Aug 23, 2024

Choose a reason for hiding this comment

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

FWIW I have both separated in the server impl

create - https://github.com/TBD54566975/did-dht/blob/main/impl/internal/did/did.go#L119
publish - https://github.com/TBD54566975/did-dht/blob/main/impl/internal/did/client.go#L65

I'd create them as two different methods, but perhaps better to keep this as defaulting to true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh I just realized the way I had it before, there are code paths where the default value you be false actually, even tho I'm using the default value of true inside the rust core code. jumping across languages is hard! thanks for the spot @nitro-neal

Copy link
Contributor

@nitro-neal nitro-neal left a comment

Choose a reason for hiding this comment

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

looks great!

Copy link
Member

@decentralgabe decentralgabe left a comment

Choose a reason for hiding this comment

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

are these test vectors implemented? https://did-dht.com/#test-vectors

@KendallWeihe
Copy link
Contributor Author

are these test vectors implemented? https://did-dht.com/#test-vectors

@nitro-neal is following behind with test vectors

it's an interesting question tho, because those specific test vectors are distinct from our web5-spec test vectors, but maybe they shouldn't be?

@KendallWeihe
Copy link
Contributor Author

@decentralgabe brought the receipts! 😆

We'll get 'er done here #310

@KendallWeihe KendallWeihe merged commit d0740ae into kendall/did-web Aug 23, 2024
16 checks passed
@KendallWeihe KendallWeihe deleted the kendall/did-dht branch August 23, 2024 21:07
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.

4 participants