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

build: Release 0.8.4 - TypeScript refactor #57

Merged
merged 18 commits into from
Mar 8, 2021
Merged

Conversation

liangyuanruo
Copy link
Contributor

Improvements

  • TypeScript refactor
  • Removal of unnecessary files when publishing
  • Expanded test suite

karrui and others added 18 commits January 27, 2021 19:05
* chore: rename test script to test-ci + update Travis to run ci script

* chore: add back old simpler test script

* chore: fix invalid Travis script npm command
* feat: add publicKey param to PackageInitParams type

`publicKey` and `mode` is typed to be mutually exclusive (for now, foresee removing mode entirely in the future).

* feat: add comment on new PackageInitParams shape in init function

* feat: use publicKey if given in PackageInitParams

If not given, then the app will fallback to its previous implementation and use the static public keys.

* feat: add `homeno` possible field type in FieldType type

That's a lot of typing type.
* feat: add new errors.ts file containing MissingSecretKeyError

* feat: add util/webhooks.ts for helper methods used by Webhooks class

* feat: rewrite webhooks.ts functions as Webhooks class and use in init

* test(Webhooks): update tests to use new class based instantiation

* test: extract out commonly used functions across tests

* feat: add WebhookAuthenticateError class

* test: add tests for 100% coverage of Webhooks class

* refactor: move webhook signature malform check into util
* feat: add util/crypto.ts for helper methods used by new Crypto class

* feat: rewrite crypto.ts functions as Crypto class and use in init

* feat: update thrown error name in JSDoc of Webhook.authenticate

* test(Crypto): update tests to use new class based instantiation

* refactor(Crypto): change constructor to optional `publicSigningKey`

Instead of `publicKey`, `publicSigningKey` makes it more obvious of what the use of the key is for.
Making constructor optional also allows users of the library to encrypt and decrypt without having to provide a public signing key if they do not want to and still be able to decrypt content without verified fields.

Note that the default package initialisation still instantiates the library with a fallback key.

* refactor: allow optional constructor params

* test(Crypto): add tests for 100% coverage

* refactor: update import order

* test: remove misleading comment
* fix(errors): remove typo in error messages

* refactor: move separate verification functions into utils file

* refactor: move verification publicKey retrieval into publicKey util

* feat: rewrite verification.ts functions as Verification class

* refactor: use Verification class in package init

* test: add verification/utils tests

* test: rewrite verification tests to use new Verification class

* feat: add check for malformed auth payload

* test: add tests for new package initialisation (#39)

* test: add tests for package initialisation

* test: fix weird expected keys

* test: add better comments for publicKey test
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: update webhook's generateSignature undefined checks

* chore: update FormField type link in README
Our GitHub repo name should be identical to the package name.
This commit should be accompanied by a repo rename.
…meter is used (#51)

* chore: Update JSDoc and print warning message if deprecated mode parameter is used to initialize FormSG SDK

* Update src/index.ts

Co-authored-by: Yuan Ruo <yuanruo@data.gov.sg>

* update README.md file

Co-authored-by: Yuan Ruo <yuanruo@data.gov.sg>
* feat!: split out publicKey param to distinct signing+verification keys

* feat: remove deprecated tag from old JSDoc

this prevents the entire formsg sdk module from being marked as deprecated

* ref!: continue using mode init parameter

* test(verification): fix test init parameters

* test(init): add test cases for parameter instantiation

* docs: revert README update about publicKey init params

This partly reverts commit bccad0a.

* fix: remove export default

* feat: add documentation on what the various keys are used for
This reverts commit 400db74.

Co-authored-by: Yuanruo Liang <yuanruo@open.gov.sg>
@liangyuanruo liangyuanruo changed the title Release 0.8.4 - TypeScript refactor, build optimisation build: Release 0.8.4 - TypeScript refactor, build optimisation Feb 23, 2021
@liangyuanruo liangyuanruo changed the title build: Release 0.8.4 - TypeScript refactor, build optimisation build: Release 0.8.4 - TypeScript refactor Feb 23, 2021
Copy link
Contributor

@karrui karrui left a comment

Choose a reason for hiding this comment

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

lgtm

@liangyuanruo liangyuanruo merged commit d82162d into release Mar 8, 2021
@KenLSM KenLSM deleted the release-0.8.4 branch November 17, 2023 10:44
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

4 participants