Skip to content

Commit

Permalink
fix: 馃悰 Allow Accounts to accept becoming multisig signer
Browse files Browse the repository at this point in the history
  • Loading branch information
polymath-eric committed Feb 17, 2022
1 parent b44004c commit 4af0afb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,7 @@ describe('consumeAddMultiSigSignerAuthorization procedure', () => {
let result = await boundFunc(args);
expect(result).toEqual({
roles: true,
permissions: {
transactions: [TxTags.multiSig.AcceptMultisigSignerAsKey],
},
permissions: undefined,
});

args.authRequest.target = entityMockUtils.getIdentityInstance({
Expand Down
7 changes: 4 additions & 3 deletions src/api/procedures/consumeAddMultiSigSignerAuthorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,24 +92,25 @@ export async function getAuthorization(

let calledByTarget: boolean;

let permissions;
if (target instanceof Account) {
calledByTarget = currentAccount.address === target.address;
hasRoles = calledByTarget;
transactions = [TxTags.multiSig.AcceptMultisigSignerAsKey];
// An account accepting multisig cannot be part of an Identity, so we cannot check for permissions
} else {
calledByTarget = !!identity?.isEqual(target);
hasRoles = calledByTarget;
transactions = [TxTags.multiSig.AcceptMultisigSignerAsIdentity];
permissions = { transactions };
}

if (accept) {
return {
roles:
hasRoles ||
'"AddMultiSigSigner" Authorization Requests can only be accepted by the target Signer',
permissions: {
transactions,
},
permissions,
};
}

Expand Down

0 comments on commit 4af0afb

Please sign in to comment.