Skip to content

[PM-33906] Use PureCrypto::new_guid for FIDO2 credential ID#20736

Open
dereknance wants to merge 3 commits into
mainfrom
pm-33906-use-purecrypto-new-guid
Open

[PM-33906] Use PureCrypto::new_guid for FIDO2 credential ID#20736
dereknance wants to merge 3 commits into
mainfrom
pm-33906-use-purecrypto-new-guid

Conversation

@dereknance
Copy link
Copy Markdown
Contributor

@dereknance dereknance commented May 19, 2026

🎟️ Tracking

PM-33906

📔 Objective

Update Fido2CredentialView to set credentialId using PureCrypto.new_guid().

@dereknance dereknance added the ai-review Request a Claude code review label May 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

This PR replaces Utils.newGuid() with PureCrypto.new_guid() in createKeyView() for FIDO2 credential ID generation, and adds await SdkLoadService.Ready to ensure the SDK WASM module is initialized before use. The test setup adds the matching mocks for SdkLoadService.Ready and PureCrypto.new_guid, following the established pattern in encrypt.service.spec.ts. The change is narrow, well-scoped, and directly addresses the prior reviewer feedback from dani-garcia regarding SDK readiness.

Code Review Details

No findings. The implementation follows existing codebase conventions for SDK-backed operations (matches patterns in encrypt.service.implementation.ts, default-unlock.service.ts, and other PureCrypto consumers). The test mock approach mirrors libs/common/src/key-management/crypto/services/encrypt.service.spec.ts:53.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.46%. Comparing base (0345984) to head (bfffbf0).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #20736   +/-   ##
=======================================
  Coverage   47.46%   47.46%           
=======================================
  Files        4003     4003           
  Lines      123145   123148    +3     
  Branches    18945    18945           
=======================================
+ Hits        58447    58450    +3     
  Misses      60272    60272           
  Partials     4426     4426           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread package.json
Comment on lines 60 to 149
"@ngtools/webpack": "21.2.9",
"@nx/devkit": "22.6.5",
"@nx/eslint": "22.6.5",
"@nx/jest": "22.6.5",
"@nx/js": "22.6.5",
"@nx/webpack": "22.6.5",
"@storybook/addon-a11y": "10.3.6",
"@storybook/addon-designs": "11.1.3",
"@storybook/addon-docs": "10.3.6",
"@storybook/addon-links": "10.3.6",
"@storybook/addon-themes": "10.3.6",
"@storybook/angular": "10.3.6",
"@storybook/test-runner": "0.24.3",
"@storybook/web-components-vite": "10.3.6",
"@nx/devkit": "22.6.5",
"@nx/eslint": "22.6.5",
"@nx/jest": "22.6.5",
"@nx/js": "22.6.5",
"@nx/webpack": "22.6.5",
"@tailwindcss/container-queries": "0.1.1",
"@types/chrome": "0.1.28",
"@types/firefox-webext-browser": "143.0.0",
"@types/inquirer": "8.2.10",
"@types/jest": "30.0.0",
"@types/jsdom": "28.0.1",
"@types/koa": "3.0.1",
"@types/koa__multer": "2.0.7",
"@types/koa-bodyparser": "4.3.7",
"@types/koa-json": "2.0.24",
"@types/lowdb": "1.0.15",
"@types/lunr": "2.3.7",
"@types/node": "22.19.17",
"@types/node-fetch": "2.6.13",
"@types/node-forge": "1.3.14",
"@types/papaparse": "5.5.2",
"@types/proper-lockfile": "4.1.4",
"@types/retry": "0.12.5",
"@types/zxcvbn": "4.4.5",
"@typescript-eslint/rule-tester": "8.59.1",
"@typescript-eslint/utils": "8.59.1",
"@webcomponents/custom-elements": "1.6.0",
"@yao-pkg/pkg": "6.5.1",
"angular-eslint": "20.7.0",
"autoprefixer": "10.4.22",
"axe-playwright": "2.2.2",
"babel-loader": "10.1.1",
"base64-loader": "1.0.0",
"browserslist": "4.28.2",
"chromatic": "13.3.4",
"concurrently": "9.2.1",
"copy-webpack-plugin": "14.0.0",
"cross-env": "10.1.0",
"css-loader": "7.1.4",
"electron": "39.8.5",
"electron-builder": "26.8.2",
"electron-log": "5.4.3",
"electron-reload": "2.0.0-alpha.1",
"electron-store": "11.0.2",
"electron-updater": "6.6.4",
"eslint": "9.39.4",
"eslint-config-prettier": "10.1.8",
"eslint-import-resolver-typescript": "4.4.4",
"eslint-plugin-import": "2.32.0",
"eslint-plugin-jest": "29.15.2",
"eslint-plugin-rxjs": "5.0.3",
"eslint-plugin-rxjs-angular": "2.0.1",
"eslint-plugin-storybook": "10.3.6",
"eslint-plugin-tailwindcss": "3.18.3",
"fantasticon": "4.1.0",
"html-loader": "5.1.0",
"html-webpack-injector": "1.1.4",
"html-webpack-plugin": "5.6.6",
"husky": "9.1.7",
"jest": "30.3.0",
"jest-diff": "30.3.0",
"jest-environment-jsdom": "29.7.0",
"jest-junit": "17.0.0",
"jest-mock-extended": "4.0.1",
"jest-preset-angular": "16.1.4",
"json5": "2.2.3",
"lint-staged": "16.4.0",
"mini-css-extract-plugin": "2.10.2",
"nx": "22.6.5",
"path-browserify": "1.0.1",
"postcss": "8.5.10",
"postcss-loader": "8.2.1",
"prettier": "3.8.1",
"prettier-plugin-tailwindcss": "0.8.0",
"process": "0.11.10",
"remark-gfm": "4.0.1",
"rimraf": "6.1.2",
"storybook": "10.3.6",
"sass": "1.99.0",
"sass-loader": "16.0.7",
"storybook": "10.3.6",
"style-loader": "4.0.0",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure how these became out of order, but I figured I'd include the sort in this PR.

@dereknance dereknance marked this pull request as ready for review May 19, 2026 20:25
@dereknance dereknance requested a review from a team as a code owner May 19, 2026 20:25
@dereknance dereknance requested a review from dani-garcia May 19, 2026 20:25
Copy link
Copy Markdown
Member

@dani-garcia dani-garcia left a comment

Choose a reason for hiding this comment

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

LGTM just a small suggestion. You also have some conflicts to solve

const pkcs8Key = new Uint8Array(await crypto.subtle.exportKey("pkcs8", keyValue));
const fido2Credential = new Fido2CredentialView();
fido2Credential.credentialId = Utils.newGuid();
fido2Credential.credentialId = PureCrypto.new_guid();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should probably do await SdkLoadService.Ready; before we use purecrypto to ensure that the SDK is initialized on time

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed! 88d336b

@sonarqubecloud
Copy link
Copy Markdown

@dereknance dereknance requested a review from dani-garcia May 20, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants