-
Notifications
You must be signed in to change notification settings - Fork 13
API #9
base: master
Are you sure you want to change the base?
API #9
Conversation
|
My initial thoughts/concerns on this are largely around limits it imposes on extensibility. Because I'm also at least a little concerned that there's more than a fair share of indirection going on here and I'm not sure it's entirely warranted. Currently |
|
There's only one level of indirection src/hash.method -> provider.method(), where provider is either src/node/hash, src/script/hash, or src/webcrypto/hash. Hmmm...that may not be super apparent, though. Some of the messiness is due to competing ways of dividing this up. On the one hand, there are some distinct sets of functionality: hashes, signing functions, and others (key generators, ciphers, ...). On the other hand, there's the platform-based breakdown: node, browser, and pure JS. The current API uses both divisions, which makes for a lot of unnecessary exports. |
|
I'm revising this to be a bit simpler and more easily extensible. |
src/crypto.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in a dedicated has module. See dojo-dom/has for an example.
|
Some of the comments I've left on the hash side of things are also applicable to sign. This branch needs to be rebased against master. Test coverage probably isn't quite where we'd like it to be yet. A few things that aren't covered:
|
- Algorithm validation is handled at both the module level and provider level. The module checks algorithms against the standard list until a provider is loaded, at which point the provider takes over. - Tests coverage is much improved.
|
This has been rebased on master and cleaned up based on Ken's comments. Test coverage is much improved. The only untested code is loader-related; more of that will be exercised when we have additional providers. |
README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to move this to the top of the file since it is first used in the SignFunction interface definition
This is the base API for crypto, along with the Node-backed implementation.