Skip to content

Commit

Permalink
🚀 Release 1.0.2
Browse files Browse the repository at this point in the history
Don't rely on figuring out isNode in dynamic.cjs.
Instead, we can just check global.crypto, since we're doing a dynamic check anyway.
Also, we're absolutely making sure we've got access to a global object thorugh either globalThis, window or self.
  • Loading branch information
matheus23 committed Nov 2, 2021
1 parent b844138 commit a95b889
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion browser.mjs
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export const webcrypto = globalThis.crypto
const global = globalThis || window || self

export const webcrypto = global.crypto
10 changes: 5 additions & 5 deletions dynamic.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// check the environment dynamically
const global = globalThis || window || self

const isNode = typeof process === 'object'
const webcrypto = isNode ? require('crypto').webcrypto : globalThis.crypto

module.exports = { webcrypto }
module.exports = {
// check the environment dynamically
webcrypto: global.crypto != null ? global.crypto : require('crypto').webcrypto
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "one-webcrypto",
"version": "1.0.1",
"version": "1.0.2",
"description": "Import the webcrypto API as a single module in both nodejs and browsers.",
"repository": "https://github.com/fission-suite/one-webcrypto",
"author": "Philipp Krüger <philipp@fission.codes>",
Expand Down

0 comments on commit a95b889

Please sign in to comment.