question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add more `worktop/crypto` helpers

See original GitHub issue

As of #11, there is now a worktop/crypto module that includes the following helpers:

  • digest(algo, message)
  • SHA1(message)
  • SHA256(message)
  • SHA384(message)
  • SHA512(message)

This ticket exists to collect suggestions for additional helpers that should be added to the module, if any. So far, I think these would be good additions, if for no other reason than type safety:

declare function importkey(secret: string, algo: ALGO, scopes = ['sign', 'verify']): Promise<CryptoKey>;
declare function verify(secret: string, algo: ALGO, message: string): Promise<ArrayBuffer>;
declare function sign(secret: string, algo: ALGO, message: string): Promise<ArrayBuffer>;

Additionally, I have a PBKDF2 implementation that I can extract from existing application(s) and generalize it:

declare function PBKDF2(input: string, salt: string, iterations: number, keylen: number, digest: string): Promise<ArrayBuffer>;

What else should be here? 🙏


Lastly, WRT importkey, verify, and sign specifically – my applications’ implementations only made use of a “raw” imported key:

// example
crypto.subtle.importKey('raw', ....);

Is/Was this application-specific? Or is this “the norm” for a Workers environment?

My hesitation is that these utilities will be too reliant on my importKey assumption/default and be incorrect for a larger audience.

Thanks!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lukeedcommented, Apr 10, 2021

Thanks @mattwebbio! Yeah, there will definitely be a worktop/jwt. Still working through the knowledge gap of importKey so that I’m not setting everyone up for limited use cases.

1reaction
ajwildcommented, Mar 25, 2021

While worktop is still “young” I’d say go with whatever works for your use case right now, but make it easy to extend. I just set some defaults based on what I needed, but allowed everything to be passed as parameters. I’m looking forward to giving this framework a go!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best Crypto Wallets - Consumer Reports
Consumer Reports reviews five popular crypto wallets, including the Ledger Nano and the ShapeShift KeepKey, to see which ones were easiest ...
Read more >
8 Ways to Create Extra Counter Space in a Tiny Kitchen
8 Ways to Create Extra Counter Space in a Tiny Kitchen · 1. Add some shelf risers. · 2. And a cake stand....
Read more >
The Apple veteran building Square's bitcoin wallet ... - Protocol
The Square executive leading Jack Dorsey's big plan for a bitcoin wallet is a veteran hardware technologist with a quirky hobby: taking pictures...
Read more >
From crypto to housing, collapse of speculative wealth could ...
As companies like Twitter lose value and cryptocurrencies decline, maybe we should put our cash somewhere more useful. (Brett Purdy/CBC).
Read more >
How Much Do Kitchen Countertops Cost? - Bankrate.com
The bigger the countertop, the more you should expect to spend. Odd-shaped countertops can add additional costs. If you have to cut your ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found