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.

Ability to use browser's native implementation

See original GitHub issue

With the Web Cryptography API becoming a W3C Recommendation as of 26th of January of 2017, we could safely implement pbkdf2 natively for some browsers (i.e. Chrome and Firefox). I know we are browserifying crypto here, but maybe we could fallback to the native methods if implemented.

Would you be interested in having such a fallback in this repo? It’s pretty popular and other people seem to use it a lot in the browser. Here’s how I implemented it for github.com/jjperezaguinaga/deniable.website.

const pbkdf2Native = (password, salt, iterations, digest, mode, keylen) =>
    (window.crypto.subtle||window.crypto.webkitSubtle).importKey('raw', password, {name: 'PBKDF2'}, false, ['deriveKey'])
        .then(baseKey => (window.crypto.subtle||window.crypto.webkitSubtle).deriveKey({name: 'PBKDF2', salt, iterations, hash: digest, baseKey, {'name': mode, 'length': keylen*8}, true, ['encrypt', 'decrypt']))
        .then(key => (window.crypto.subtle||window.crypto.webkitSubtle).exportKey('raw', key))

I can make a PR to detect window and leverage on it based on the options given, since it seems the API has some limitations (e.g. keylen for mode has to be either 128 or 256 bits, see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/deriveKey). You can see how lesspass is using it alongside this repository for a reference of what we could do.

👋 @jprichardson!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
dcousenscommented, Apr 10, 2017

@fanatid if we documented the difference that pkbdf2 async could be higher performance… I think people would be OK with that.

1reaction
calvinmetcalfcommented, May 12, 2017

this is done

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating an embedded browser with React-Native ... - Medium
We are going to go over a basic browser implementation using react-native-webview, it is able to: use the search bar to go to...
Read more >
Implementing feature detection - Learn web development | MDN
This article details how to write your own simple feature detection, how to use a library to speed up implementation, and native features ......
Read more >
In-App Browsers: What You Need to Know - AddThis
The most popular examples of apps that use bespoke in-app browsers are probably Facebook and Twitter. Twitter on iOS and Facebook on Android ......
Read more >
OAuth 2.0 Best Practices for Native Apps - Auth0
Using the browser to make native app authorization requests results in better security. It also enables use of the user's current authentication ...
Read more >
Copy the Browser's Native Focus Styles | CSS-Tricks
Take two minutes right now and visit your current project in a browser. Then, using only the Tab key, you should be able...
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