Skip to content

Commit

Permalink
cleanup around future export
Browse files Browse the repository at this point in the history
  • Loading branch information
shamilovtim committed Oct 23, 2024
1 parent 78fd373 commit 58bb0c9
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions packages/api/src/web5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,8 @@ export class Web5 {
// Since we are connecting a new identity, we will want to register sync for the connectedDid
registerSync = true;

// No connected identity found and connectOptions are provided, attempt to import a delegated DID from an external wallet
try {
console.log('before initclient');
const { delegatePortableDid, connectedDid, delegateGrants } = await WalletConnect.initClient(walletConnectOptions);
console.log('after initclient');

// Import the delegated DID as an Identity in the User Agent.
// Setting the connectedDID in the metadata applies a relationship between the signer identity and the one it is impersonating.
Expand All @@ -310,25 +307,7 @@ export class Web5 {
throw new Error(`Failed to connect to wallet: ${error.message}`);
}
} else if (isWalletExportedConnect) {
console.log('IN EXPORT case');
if (sync === 'off') {
// sync must be enabled when using WalletConnect to ensure a connected app
// is not in a disjointed state from any other clients using the connectedDid
throw new Error('Sync must not be disabled when using WalletConnect');
}

// Since we are connecting a new identity, we will want to register sync for the connectedDid
registerSync = true;

try {
// TODO: do the exported connect
} catch (error:any) {
// clean up the DID and Identity if import fails and throw
// TODO: Implement the ability to purge all of our messages as a tenant
await this.cleanUpIdentity({ identity, userAgent });
throw new Error(`Failed to connect to wallet: ${error.message}`);
}
// else connecting to a locally held DID
throw new Error('Exported connect will be implemented in a separate PR');

Check warning on line 310 in packages/api/src/web5.ts

View check run for this annotation

Codecov / codecov/patch

packages/api/src/web5.ts#L310

Added line #L310 was not covered by tests
} else {
console.log('IN else case');
// No connected identity found and no connectOptions provided, use local Identities
Expand Down

0 comments on commit 58bb0c9

Please sign in to comment.