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

Bearer Did Impl #247

Merged
merged 7 commits into from
Jun 25, 2024
Merged

Bearer Did Impl #247

merged 7 commits into from
Jun 25, 2024

Conversation

nitro-neal
Copy link
Contributor

@nitro-neal nitro-neal commented Jun 21, 2024

This is the implementation for bearer dids

Usage is here:

    @Test
    fun `test basic bearer did creation`() {
        val privateJwk = ed25519GeneratorGenerate()

        val keyManager = InMemoryKeyManager(listOf())
        val publicJwk = keyManager.importPrivateJwk(privateJwk)

        val didJwk = DidJwk(publicJwk)

        val bearerDid = BearerDid(didJwk.did.uri, keyManager)
    }

@nitro-neal nitro-neal changed the title bearer did wip Bearer Did Impl Jun 24, 2024
@nitro-neal nitro-neal marked this pull request as ready for review June 24, 2024 19:27
* @return ResolutionResult The result of the DID resolution.
*/
@JvmStatic
suspend fun resolve(uri: String): ResolutionResult {
Copy link
Contributor

Choose a reason for hiding this comment

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

What's your thinking with this function? This isn't in the APID, is it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, I think got influenced by current impl in web5-kt.

That does beg the question though, how would we resovle a bearer did:

It would have to be like:

DidDht.resolve(bearerDid.did.uri)

But how would you know the type, (the bearer did could be JWK..)

Copy link
Contributor

Choose a reason for hiding this comment

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

Bearer DID could be resolvable via the CONSTRUCTOR(uri: string, key_manager: KeyManager), because internal to that constructor would be three things:

  1. A call to ResolutionResult(uri) to resolve the Document
  2. A call to Did(uri) to parse the Did
  3. Assignment of the key_manager to the data member

I'm doing this in web5-r

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CLASS BearerDid
  PUBLIC DATA did: Did
  PUBLIC DATA document: Document
  CONSTRUCTOR(uri: string, key_manager: KeyManager)
  METHOD get_signer(): Signer

Right genius, its already resolved basically and we have document right there :duhh: I'll update it

Copy link
Contributor

@KendallWeihe KendallWeihe left a comment

Choose a reason for hiding this comment

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

💯

@nitro-neal nitro-neal merged commit 1155fed into main Jun 25, 2024
6 checks passed
@nitro-neal nitro-neal deleted the bearer-did-impl branch June 25, 2024 18:29
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.

2 participants