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

TS Library src #8

Merged
merged 3 commits into from
Jan 31, 2024
Merged

TS Library src #8

merged 3 commits into from
Jan 31, 2024

Conversation

bh2smith
Copy link
Contributor

@bh2smith bh2smith commented Jan 31, 2024

We split up the logic from the test into an actual library:

  • keyContract (containing structure and interface related to KeyContract)
  • NearAccount Type
  • encryption module (with interface) and Base58 implementation (i.e. the one from @nearfoundation/near-js-encryption-box)

Essentially just performing the same thing the test did before, but offloading all the code logic to the library so the test can be slimmed down.

Closes #1 (introducing the toy/sample encryption library).

Test Plan

Existing CI.

@bh2smith bh2smith requested a review from tifrel January 31, 2024 12:49

async retrieveAndDecryptKey(
nearAccount: NearAccount,
nonce?: string | undefined,
Copy link
Member

Choose a reason for hiding this comment

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

Why make this optional here and then use the non-null assertion on it later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some Encryption libraries (like the one introduced here) use a nonce and others don't. This makes it possible to reuse the same interface for both. See #9

ts-lib/tests/contract.test.ts Outdated Show resolved Hide resolved
@bh2smith bh2smith merged commit 7990048 into main Jan 31, 2024
2 checks passed
@bh2smith bh2smith deleted the expand-ts-lib branch January 31, 2024 13:37
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.

Base58: Encryption Library
2 participants