Skip to content

Commit 187759c

Browse files
Joshua Coffeyfundthmcalculus
andauthored
DID Upgrade Documentation (#1077)
Co-authored-by: Scott Phillips <[email protected]>
1 parent b3c2819 commit 187759c

File tree

8 files changed

+398
-32
lines changed

8 files changed

+398
-32
lines changed

docs/reference/services/provider-service.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,72 @@ Deletes a webhook from an ecosystem.
270270

271271
{{ proto_method_tabs("services.provider.v1.Provider.DeleteWebhook") }}
272272

273+
---
274+
275+
## Upgrade Wallet DID
276+
277+
!!! warning "Restricted API"
278+
This feature is not yet publicly available, and the list of supported DID Methods is not final.
279+
280+
Please contact Trinsic to enable this endpoint on your account.
281+
282+
!!! info "Ledger Interactions"
283+
Many DID methods are based on distributed ledgers (commonly known as "blockchains"), so the following should be kept in mind when registering a DID which uses a ledger:
284+
285+
- Depending on the DID method chosen, registering a DID may incur a ledger write fee, which is different for each ledger. **You are responsible for these fees.**
286+
- We will provide clear documentation regarding these fees before this feature becomes generally available.
287+
- Newly-registered DIDs may not be immediately resolvable, as most ledgers cannot provide instantaneous writes.
288+
- Issuance and verification of credentials against these DIDs will still function during this time, but only within the Trinsic platform.
289+
290+
Upgrades a wallet's DID from the default `did:key` to another DID Method. This endpoint may only be called by an ecosystem provider.
291+
292+
Trinsic will register a DID Document for you, and update the wallet's `public_did` property to the newly-registered DID. Credentials previously issued by this wallet will not have their `issuer` field updated to the new DID, but they will still verify correctly.
293+
294+
Presently, once a wallet's DID has been upgraded, its DID Method cannot be changed again. However, it is possible to perform further upgrades _within_ a method, to go from a testing to production network (for example, `did:ion:test` to `did:ion`).
295+
296+
{{ proto_sample_start() }}
297+
=== "Trinsic CLI"
298+
```bash
299+
trinsic provider upgrade-did --wallet-id {wallet_id} --method ion --method-options testnet
300+
```
301+
302+
=== "TypeScript"
303+
<!--codeinclude-->
304+
```typescript
305+
[UpgradeDid](../../../web/test/ProviderService.test.ts) inside_block:upgradeDid
306+
```
307+
<!--/codeinclude-->
308+
309+
=== "C#"
310+
<!--codeinclude-->
311+
```csharp
312+
[UpgradeDid](../../../dotnet/Tests/Tests.cs) inside_block:upgradeDid
313+
```
314+
<!--/codeinclude-->
315+
316+
=== "Python"
317+
<!--codeinclude-->
318+
```python
319+
[UpgradeDid](../../../python/samples/provider_demo.py) inside_block:upgradeDid
320+
```
321+
<!--/codeinclude-->
322+
323+
=== "Go"
324+
<!--codeinclude-->
325+
```golang
326+
[UpgradeDid](../../../go/services/provider_service_test.go) inside_block:upgradeDid
327+
```
328+
<!--/codeinclude-->
329+
330+
=== "Java"
331+
<!--codeinclude-->
332+
```java
333+
[UpgradeDid](../../../java/src/test/java/trinsic/ProviderServiceTest.java) inside_block:upgradeDid
334+
```
335+
<!--/codeinclude-->
336+
337+
{{ proto_method_tabs("services.provider.v1.Provider.UpgradeDID") }}
338+
273339
<!--
274340
// This call is not yet implemented
275341
## List Ecosystems

dotnet/Tests/Tests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,27 @@ public async Task EcosystemTests() {
254254
var inviteStatus = await trinsic.Provider.InvitationStatusAsync(new() { InvitationId = invitationId });
255255
// }
256256
} catch (Exception) { } // This is expected as a doc sample
257+
258+
259+
// Test upgrading account DID
260+
var accountInfo = await trinsic.Account.InfoAsync();
261+
var walletId = accountInfo.WalletId;
262+
263+
// Wrap in try-catch as this ecosystem will not presently have DID upgrade permissions
264+
try {
265+
// upgradeDid() {
266+
var upgradeResponse = await trinsic.Provider.UpgradeDIDAsync(new() {
267+
WalletId = walletId,
268+
Method = SupportedDidMethod.Ion,
269+
IonOptions = new() {
270+
Network = IonOptions.Types.IonNetwork.TestNet
271+
}
272+
});
273+
// }
274+
} catch (RpcException e)
275+
{
276+
e.StatusCode.Should().Be(StatusCode.PermissionDenied);
277+
}
257278
}
258279

259280
[Fact]

dotnet/Trinsic/Trinsic.xml

Lines changed: 153 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/services/provider_service_test.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package services
22

33
import (
44
"context"
5+
"github.com/trinsic-id/sdk/go/proto/services/common/v1/common"
56
"testing"
67

78
"github.com/stretchr/testify/assert"
@@ -88,6 +89,42 @@ func TestEcosystemUpdateInfo(t *testing.T) {
8889
}
8990
}
9091

92+
func TestUpgradeDid(t *testing.T) {
93+
assert2 := assert.New(t)
94+
95+
trinsic, err := CreateTestTrinsicWithNewEcosystem()
96+
if !assert2.Nil(err) {
97+
return
98+
}
99+
100+
info, err := trinsic.Account().Info(context.Background())
101+
if !assert2.Nil(err) {
102+
return
103+
}
104+
105+
walletId := info.WalletId
106+
107+
// upgradeDid() {
108+
upgradeResponse, err := trinsic.Provider().UpgradeDID(context.Background(), &provider.UpgradeDidRequest{
109+
Account: &provider.UpgradeDidRequest_WalletId{
110+
WalletId: walletId,
111+
},
112+
Method: common.SupportedDidMethod_ION,
113+
Options: &provider.UpgradeDidRequest_IonOptions{
114+
IonOptions: &provider.IonOptions{
115+
Network: provider.IonOptions_TestNet,
116+
},
117+
},
118+
})
119+
// }
120+
121+
// Should error as ecosystems cannot upgrade by default ATM
122+
if assert2.NotNil(err) || assert2.Nil(upgradeResponse) {
123+
return
124+
}
125+
126+
}
127+
91128
func TestProviderBase_InviteParticipant(t *testing.T) {
92129
assert2 := assert.New(t)
93130

0 commit comments

Comments
 (0)