generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 10
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
[Bug] Cannot update DID documents #310
Comments
3 tasks
@angiejones as a work around: val keyManager = InMemoryKeyManager()
var myBearerDid = DidDht.create(keyManager, CreateDidDhtOptions(publish = true))
val existingBearerDid: BearerDid = myBearerDid
val serviceToAdd = Service.Builder()
.id("pfi")
.type("PFI")
.serviceEndpoint(listOf("https://example.com/"))
.build()
val updatedServices = existingBearerDid.document.service?.toMutableList() ?: mutableListOf()
updatedServices.add(serviceToAdd)
print(updatedServices)
val updatedDidDocument = DidDocument(
id = existingBearerDid.document.id,
context = existingBearerDid.document.context,
controller = existingBearerDid.document.controller,
verificationMethod = existingBearerDid.document.verificationMethod,
authentication = existingBearerDid.document.authentication,
assertionMethod = existingBearerDid.document.assertionMethod,
keyAgreement = existingBearerDid.document.keyAgreement,
capabilityInvocation = existingBearerDid.document.capabilityInvocation,
capabilityDelegation = existingBearerDid.document.capabilityDelegation,
service = updatedServices
)
val updatedBearerDid = BearerDid(
uri = existingBearerDid.uri,
did = existingBearerDid.did,
keyManager = existingBearerDid.keyManager,
document = updatedDidDocument
)
DidDht.publish(existingBearerDid.keyManager, updatedDidDocument) works - I am not sure of idiomatic mods to make kotlin allow mutation but need to look into it |
Closed
my attempt at an idiomatic change: #311 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
There are several reasons why one might need to update a DID document including adding/deleting/updating service endpoints. However, the fields of the DidDocument class are final, and therefore cannot be updated.
To Reproduce:
Create and publish a DID:
Try to add a service later:
Expected behavior:
Supporting Material
This is possible in web5-js:
The text was updated successfully, but these errors were encountered: