Skip to content

Conversation

tyllark
Copy link

@tyllark tyllark commented Oct 7, 2025

For web builds only sha512_slowsinks.dart is supported and sha512_fastsinks.dart is not supported. The conditional importing of sha512_slowsinks.dart uses dart:js instead of the new js interop library dart:js_interop, which does not work for WebAssembly builds. This change aligns us with the recommended conditional import to differentiate between native and web.

#913

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

Note: The Dart team is trialing Gemini Code Assist. Don't take its comments as final Dart team feedback. Use the suggestions if they're helpful; otherwise, wait for a human reviewer.

@tyllark tyllark requested a review from a team as a code owner October 7, 2025 21:58
@tyllark
Copy link
Author

tyllark commented Oct 7, 2025

Previous changes to this conditional import 686d021 and 61dca74 did not add unit tests so I didn't either.

I could potentially add WASM to the Crypto test matrix via dart test --platform chrome --compiler dart2wasm and use @TestOn and visibleForTesting to check if _Sha64BitSink._digest has a type of Uint32List (web builds) or Uint64List (native builds). Let me know if you think this is necessary.

Copy link
Member

@mosuem mosuem left a comment

Choose a reason for hiding this comment

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

Thanks!


import 'digest.dart';
import 'hash.dart';
// ignore: uri_does_not_exist
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Is this ignore really necessary?


- Run `dart format` with the new style.
- Performance improvements.
- Updated web conditional import to use `js_interop` to support WebAssembly
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- Updated web conditional import to use `js_interop` to support WebAssembly
- Updated web conditional import to use `js_interop` to support WebAssembly.

;)

Copy link

github-actions bot commented Oct 8, 2025

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
crypto None 3.0.6 3.0.7-wip 3.0.6 ✔️

This check can be disabled by tagging the PR with skip-breaking-check.

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

Coverage ✔️
File Coverage
pkgs/crypto/lib/src/sha512.dart 💚 100 %

This check for test coverage is informational (issues shown here will not fail the PR).

This check can be disabled by tagging the PR with skip-coverage-check.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbol Leaking sources

This check can be disabled by tagging the PR with skip-leaking-check.

License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

This check can be disabled by tagging the PR with skip-license-check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants