Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commit log keystore _isSpecialKey returns incorrect result for public keys #2114

Closed
murali-shris opened this issue Oct 8, 2024 · 1 comment · Fixed by #2115
Closed

commit log keystore _isSpecialKey returns incorrect result for public keys #2114

murali-shris opened this issue Oct 8, 2024 · 1 comment · Fixed by #2115
Assignees
Labels
bug Something isn't working

Comments

@murali-shris
Copy link
Member

Describe the bug

bool _isSpecialKey(String atKey) {
return atKey.contains(AtConstants.atEncryptionSharedKey) ||
atKey.startsWith('public:') ||
atKey.contains(AtConstants.atPkamSignature) ||
atKey.contains(AtConstants.atSigningPrivateKey);
}

should be public:publickey.

Steps to reproduce

```
test('test to verify last committed sequenceNumber with regex', () async {
    var commitLogInstance =
        await (AtCommitLogManagerImpl.getInstance().getCommitLog('@alice'));
    var commit = await commitLogInstance?.commit(
        'public:location_1.wavi@alice', CommitOp.UPDATE);
    await commitLogInstance?.commit(
        'public:phone.buzz@alice', CommitOp.UPDATE);
    await commitLogInstance?.commit(
        'public:location_2.wavi@alice', CommitOp.UPDATE);
    await commitLogInstance?.commit(
        'public:email.buzz@alice', CommitOp.UPDATE);
    expect(await commitLogInstance
        ?.lastCommittedSequenceNumberWithRegex('buzz'), 3);
    expect(await commitLogInstance
        ?.lastCommittedSequenceNumberWithRegex('wavi'), 2);
  });
  ```
  this unit test fails

Expected behavior

unit test should pass

Screenshots

No response

Smartphones

No response

Were you using an atApplication when the bug was found?

No response

Additional context

No response

@murali-shris murali-shris added the bug Something isn't working label Oct 8, 2024
@murali-shris murali-shris self-assigned this Oct 8, 2024
@VJag VJag changed the title commit log keystore _isSpecialKey returns in correct result for public keys commit log keystore _isSpecialKey returns incorrect result for public keys Oct 8, 2024
@murali-shris
Copy link
Member Author

#2115 (comment)
Testing these changes

  • replaced the check atKey.contains(AtConstants.atEncryptionSharedKey) with checks suggested in the PR review comment
  • removed the checks for AtConstants.atPkamSignature, AtConstants.atSigningPrivateKey in _specialKey

@gkc gkc closed this as completed in #2115 Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant