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

update Hash implementations with Checksum interface #492

Merged
merged 1 commit into from
Jan 11, 2023

Conversation

AndrewFossAWS
Copy link
Contributor

@AndrewFossAWS AndrewFossAWS commented Dec 2, 2022

Description of changes:

Related issue #485

This PR updates Hash implementations with Checksum interface.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

import { Hash as SdkNodeHash } from "@aws-sdk/hash-node";

// TODO: remove the following when SdkNodeHash has implemented Checksum interface in aws-sdk-js-v3
export class NodeHash implements Checksum {
Copy link
Contributor Author

@AndrewFossAWS AndrewFossAWS Dec 12, 2022

Choose a reason for hiding this comment

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

There is circular dependency between the aws-sdk-js-crypto-helpers and aws-js-sdk-v3.

@aws-sdk/hash-node's Hash implementation needs to be updated to use Checksum interface after this PR is merged, then this class will be removed afterwards.

Copy link
Contributor

@texastony texastony left a comment

Choose a reason for hiding this comment

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

I have some code style suggestions.

Otherwise, I have two blocking questions.

  1. Does a circular dependency already exist? If not, I would like to avoid it.
  2. I am generally against creating a field that holds priveldged information unless strictly neccesary. For the sha packages, I think it may be possible to avoid creating the secret field and still implement reset. It may even be possible to avoid repeat code...

I am requesting changes for the test imports.
Have you tried abstracting the reset and constructor logic
in the Sha packages such that we can avoid secret and repeat code?

packages/crc32/test/index.test.ts Outdated Show resolved Hide resolved
packages/crc32c/test/index.test.ts Outdated Show resolved Hide resolved
packages/sha1-browser/src/crossPlatformSha1.ts Outdated Show resolved Hide resolved
@AndrewFossAWS
Copy link
Contributor Author

  1. Does a circular dependency already exist? If not, I would like to avoid it.

Yes the circular dependency has already existed prior to this change.

Copy link
Contributor

@texastony texastony left a comment

Choose a reason for hiding this comment

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

Avoid ts-ignore at all costs.
In this case, we can tell TypeScript we will assign a value to operation.

(It's surprising that TypeScript cannot figure that out on it's own.
Dafny can, or at least provides a method to annotate the code such that it can.)

packages/sha1-browser/src/ie11Sha1.ts Outdated Show resolved Hide resolved
packages/sha1-browser/src/ie11Sha1.ts Outdated Show resolved Hide resolved
packages/sha1-browser/src/ie11Sha1.ts Outdated Show resolved Hide resolved
packages/sha1-browser/src/ie11Sha1.ts Outdated Show resolved Hide resolved
packages/sha256-browser/src/ie11Sha256.ts Outdated Show resolved Hide resolved
packages/sha256-browser/src/ie11Sha256.ts Outdated Show resolved Hide resolved
packages/sha256-browser/src/ie11Sha256.ts Outdated Show resolved Hide resolved
@texastony texastony dismissed their stale review January 10, 2023 19:09

All blockiing issues have been resolved

texastony
texastony previously approved these changes Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants