Skip to content

Commit

Permalink
review comments for delegateDid, update dwn-server to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
LiranCohen committed Aug 14, 2024
1 parent 886c9bc commit c65f479
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
3 changes: 0 additions & 3 deletions packages/api/src/web5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ export type Web5ConnectResult = {
/** The DID that has been connected or created during the connection process. */
did: string;

/** The DID that is used to sign messages on behalf of the connectedDID */
delegatedDid?: string;

/**
* The first time a Web5 agent is initialized, the recovery phrase that was used to generate the
* agent's DID and keys is returned. This phrase can be used to recover the agent's vault contents
Expand Down
32 changes: 16 additions & 16 deletions packages/api/tests/web5.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,8 @@ describe('web5 api', () => {
// stub the walletInit method
sinon.stub(WalletConnect, 'initClient').resolves({
delegateGrants : [ writeGrant.dataEncodedMessage, readGrant.dataEncodedMessage ],
delegateDid: await app.export(),
connectedDid : alice.did.uri
delegateDid : await app.export(),
connectedDid : alice.did.uri
});

const appTestHarness = await PlatformAgentTestHarness.setup({
Expand All @@ -575,11 +575,11 @@ describe('web5 api', () => {
// connect to the app, the options don't matter because we're stubbing the initClient method
const { web5, did, delegateDid } = await Web5.connect({
walletConnectOptions: {
connectServerUrl : 'https://connect.example.com',
walletUri : 'https://wallet.example.com',
validatePin : async () => { return '1234'; },
onWalletUriReady : (_walletUri: string) => {},
permissionRequests : [],
connectServerUrl : 'https://connect.example.com',
walletUri : 'https://wallet.example.com',
validatePin : async () => { return '1234'; },
onWalletUriReady : (_walletUri: string) => {},
permissionRequests : [],
}
});
expect(web5).to.exist;
Expand Down Expand Up @@ -719,9 +719,9 @@ describe('web5 api', () => {
expect(queryResult.records).to.have.lengthOf(0); // record has been deleted

// connecting a 2nd time will return the same connectedDID and delegatedDID
const { did: did2, delegatedDid: delegatedDid2 } = await Web5.connect();
const { did: did2, delegateDid: delegateDid2 } = await Web5.connect();
expect(did2).to.equal(did);
expect(delegatedDid2).to.equal(delegatedDid);
expect(delegateDid2).to.equal(delegateDid);

// Close the app test harness storage.
await appTestHarness.clearStorage();
Expand Down Expand Up @@ -811,8 +811,8 @@ describe('web5 api', () => {
// stub the walletInit method of the Connect placeholder class
sinon.stub(WalletConnect, 'initClient').resolves({
delegateGrants : [ writeGrant.dataEncodedMessage, readGrant.dataEncodedMessage ],
delegateDid : await app.export(),
connectedDid : alice.did.uri
delegateDid : await app.export(),
connectedDid : alice.did.uri
});

const appTestHarness = await PlatformAgentTestHarness.setup({
Expand Down Expand Up @@ -840,11 +840,11 @@ describe('web5 api', () => {
// connect to the app, the options don't matter because we're stubbing the initClient method
await Web5.connect({
walletConnectOptions: {
connectServerUrl : 'https://connect.example.com',
walletUri : 'https://wallet.example.com',
validatePin : async () => { return '1234'; },
onWalletUriReady : (_walletUri: string) => {},
permissionRequests : []
connectServerUrl : 'https://connect.example.com',
walletUri : 'https://wallet.example.com',
validatePin : async () => { return '1234'; },
onWalletUriReady : (_walletUri: string) => {},
permissionRequests : []
}
});

Expand Down

0 comments on commit c65f479

Please sign in to comment.