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

Refactor eth_getEncryptionPublicKey handling #18319

Merged
merged 13 commits into from
Apr 13, 2023

Conversation

bergarces
Copy link
Contributor

@bergarces bergarces commented Mar 24, 2023

Explanation

Moves encryption-public-key-manager and related metamask-controller logic, responsible for eth_getEncryptionPublicKey, to a new EncryptionPublicKeyController that uses EncryptionPublicKeyManager from @metamask/message-managers.

See: https://github.com/MetaMask/MetaMask-planning/issues/394

Manual Testing Steps

  • Go to https://metamask.github.io/test-dapp/
  • Connect MM wallet
  • Go to the Encrypt / Decrypt section
  • Click on "Get Encryption Key"
  • If request is rejected, "Encryption key" field should display "Error: MetaMask EncryptionPublicKey: User denied message EncryptionPublicKey."
  • If request is approved, the encryption key should appear.

Pre-merge author checklist

  • I've clearly explained:
    • What problem this PR is solving
    • How this problem was solved
    • How reviewers can test my changes
  • Sufficient automated test coverage has been added

Pre-merge reviewer checklist

  • Manual testing (e.g. pull and build branch, run in browser, test code being changed)
  • PR is linked to the appropriate GitHub issue
  • IF this PR fixes a bug in the release milestone, add this PR to the release milestone

If further QA is required (e.g. new feature, complex testing steps, large refactor), add the Extension QA Board label.

In this case, a QA Engineer approval will be be required.

@bergarces bergarces requested a review from a team as a code owner March 24, 2023 11:57
@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@bergarces bergarces marked this pull request as draft March 24, 2023 12:47
@bergarces bergarces force-pushed the encryption-public-key-controller branch 7 times, most recently from 9516d7b to d5c99cd Compare March 24, 2023 15:27
};

export type StateMessage = Required<AbstractMessage> & {
msgParams: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UI expects a string with the address, not a Required<AbstractMessageParams>.

@bergarces bergarces force-pushed the encryption-public-key-controller branch 3 times, most recently from 54f273d to 397ef22 Compare March 29, 2023 11:09
package.json Outdated Show resolved Hide resolved
@bergarces bergarces force-pushed the encryption-public-key-controller branch from 62af169 to 4fb99cb Compare March 29, 2023 12:36
@bergarces bergarces marked this pull request as ready for review March 29, 2023 12:36
@metamaskbot
Copy link
Collaborator

Builds ready [0206733]
Page Load Metrics (1612 ± 42 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint89129112105
domContentLoaded1472182116049043
load1473182116128842
domInteractive1472182116049043
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2743 bytes
  • ui: 0 bytes
  • common: 0 bytes

@codecov
Copy link

codecov bot commented Mar 29, 2023

Codecov Report

Merging #18319 (6eda32a) into develop (b5184db) will increase coverage by 0.19%.
The diff coverage is 42.73%.

❗ Current head 6eda32a differs from pull request most recent head a24f983. Consider uploading reports for the commit a24f983 to get more accurate results

@@             Coverage Diff             @@
##           develop   #18319      +/-   ##
===========================================
+ Coverage    64.68%   64.87%   +0.19%     
===========================================
  Files          924      924              
  Lines        35493    35404      -89     
  Branches      9117     9098      -19     
===========================================
+ Hits         22956    22965       +9     
+ Misses       12537    12439      -98     
Impacted Files Coverage Δ
app/scripts/controllers/sign.ts 92.77% <ø> (ø)
app/scripts/controllers/encryption-public-key.ts 38.38% <38.38%> (ø)
app/scripts/metamask-controller.js 63.87% <81.82%> (+1.90%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@bergarces bergarces force-pushed the encryption-public-key-controller branch from 0206733 to 6eda32a Compare March 30, 2023 08:14
@metamaskbot
Copy link
Collaborator

Builds ready [6eda32a]
Page Load Metrics (1546 ± 42 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint912121162512
domContentLoaded1414172515368541
load1414172515468742
domInteractive1414172515368541
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2743 bytes
  • ui: 0 bytes
  • common: 0 bytes

@bergarces bergarces force-pushed the encryption-public-key-controller branch 2 times, most recently from 985027e to a24f983 Compare April 3, 2023 10:10
@bergarces bergarces force-pushed the encryption-public-key-controller branch from a24f983 to 6045df0 Compare April 3, 2023 10:19
@socket-security
Copy link

New dependency changes detected. Learn more about Socket for GitHub ↗︎


👍 No new dependency issues detected in pull request

Bot Commands

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore [email protected] bar@* or ignore all packages with @SocketSecurity ignore-all

Pull request alert summary
Issue Status
Install scripts ✅ 0 issues
Native code ✅ 0 issues
Bin script shell injection ✅ 0 issues
Unresolved require ✅ 0 issues
Invalid package.json ✅ 0 issues
HTTP dependency ✅ 0 issues
Git dependency ✅ 0 issues
Potential typo squat ✅ 0 issues
Known Malware ✅ 0 issues
Telemetry ✅ 0 issues
Protestware/Troll package ✅ 0 issues

📊 Modified Dependency Overview:

⬆️ Updated Package Version Diff Added Capability Access +/- Transitive Count Publisher
@metamask/[email protected] 2.1.0...3.0.0 None +0/-0 metamaskbot

@bergarces bergarces force-pushed the encryption-public-key-controller branch from 8726d98 to f1f794f Compare April 11, 2023 12:11
@bergarces bergarces force-pushed the encryption-public-key-controller branch from f1f794f to 86d8ccd Compare April 11, 2023 12:36
@metamaskbot
Copy link
Collaborator

Builds ready [f8f9a42]
Page Load Metrics (1561 ± 37 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint86134105115
domContentLoaded1404169415387938
load1467172215617637
domInteractive1404169415387938
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 5217 bytes
  • ui: -44 bytes
  • common: 0 bytes

Copy link
Member

@OGPoyraz OGPoyraz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@metamaskbot
Copy link
Collaborator

Builds ready [e60bfd4]
Page Load Metrics (1568 ± 38 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint88137110136
domContentLoaded1408171515429244
load1408172915687838
domInteractive1408171515429244
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 5217 bytes
  • ui: -44 bytes
  • common: 0 bytes

@bergarces bergarces merged commit 6ed72d6 into develop Apr 13, 2023
@bergarces bergarces deleted the encryption-public-key-controller branch April 13, 2023 08:25
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants