Skip to content

Commit

Permalink
feat: ⚡ clear some extra
Browse files Browse the repository at this point in the history
  • Loading branch information
sadiabbasi committed Dec 11, 2024
1 parent 48dd5cd commit 3fa380f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
5 changes: 2 additions & 3 deletions src/sdk/controllers/UserRequestsManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export class UserRequestsManager extends UserCommunication implements IUserReque
}

async loginWithApp(app: App, key: PublicKey): Promise<void> {
debug('loginWithApp', app);
const myAccount = await this.getAccountName();

const appRecord: IUserAppRecord = {
Expand All @@ -108,13 +107,13 @@ export class UserRequestsManager extends UserCommunication implements IUserReque
try {
(await getAccountInfo(myAccount)).getPermission(app.accountName);
} catch (e) {
debug('getAccountInfo error', e);

if (e.message === `Unknown permission ${app.accountName.toString()} on account ${myAccount.toString()}.`) {
linkAuth = true;
}
}

debug('loginWithApp key', key);

await tonomyContract.loginwithapp(myAccount.toString(), app.accountName.toString(), 'local', key, localSigner);

if (linkAuth) {
Expand Down
13 changes: 2 additions & 11 deletions src/sdk/helpers/responsesManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,24 +212,15 @@ export class ResponsesManager {
}

async createResponses(user: IUserRequestsManager): Promise<WalletRequestAndResponse[]> {
debug('createResponses() user', user);
const issuer = await user.getIssuer();

debug('createResponses() this.responses', this.responses);

for (const response of this.responses) {
const request = response.getRequest();

debug('createResponses() getPayload', request.getPayload(), request.getType(), request.getIssuer());

if (request instanceof LoginRequest) {
if (response.getMetaOrThrow().requiresLogin === true) {
debug(
'createResponses() getPayload',
request.getPayload().publicKey,
request.getPayload(),
request.getType(),
request.getIssuer()
);

await user.loginWithApp(response.getAppOrThrow(), request.getPayload().publicKey);
}

Expand Down

0 comments on commit 3fa380f

Please sign in to comment.