
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
iron-webcrypto
Advanced tools
a cryptographic utility for sealing-unsealing a JSON object using symmetric key encryption with message integrity verification
This module is a replacement for @hapi/iron
,
written using the
Web Crypto API
that makes it compatible with browser and edge environments.
Check out vvo/iron-session to see this module in use!
To use this module, run:
npm add iron-webcrypto
npm remove @hapi/iron
and update imports.
Then modify function calls to pass a Web Crypto implementation as the first param. For example:
Iron.seal(obj, password, Iron.defaults)
becomes:
Iron.seal(_crypto, obj, password, Iron.defaults)
where _crypto
is your Web Crypto implementation. Generally, this will
available in your context (for example, globalThis.crypto
in browsers, edge
runtimes, Deno1, Bun and Node.js v19+; require('crypto').webcrypto
in
Node.js v15+). However, you may also need to polyfill this for older Node.js
versions. We recommend using
@peculiar/webcrypto
for
that.
You can use esm.sh for importing this module in Deno (and browsers). Example:
import * as Iron from 'https://esm.sh/iron-webcrypto@0.2.6'
const obj = { a: 1, b: 2, c: [3, 4, 5], d: { e: 'f' } }
const password = 'some_not_random_password_that_is_also_long_enough'
const sealed = await Iron.seal(crypto, obj, password, Iron.defaults)
const unsealed = await Iron.unseal(crypto, sealed, password, Iron.defaults)
console.log(unsealed)
↩
FAQs
a cryptographic utility for sealing-unsealing a JSON object using symmetric key encryption with message integrity verification
The npm package iron-webcrypto receives a total of 1,067,379 weekly downloads. As such, iron-webcrypto popularity was classified as popular.
We found that iron-webcrypto demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.