
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Provides the RFC 3394 key wrapping (also known as aes-key-wrap), written in TypeScrypt.
This package provides the RFC 3394 key wrapping (also known as aes-key-wrap).
It's written in TypeScrypt.
This package implements the aes-key-wrap (key wrapping and unwrapping), following this heise article, based on the specification by nist.
Following key/kek lengths are supported:
Mixed lengths (128-bit key with 256-bit kek, for example) are not supported, currently, but they don't make any sense either, since a chain with a weaker link does not become stronger by adding a stronger link.
With aes-key-wrap you can wrap (encrypt) a key, used to encrypt data, using a so-called kek (usally a key, derived from a password).
*KEK = Key encryption key (key, used to encrypt another key)
npm i aeskeywrap
// Replace ... with a comma-separated list of the functions, you need
import { ... } from 'aeskeywrap';
<!-- Load the file from jsDelivr -->
<script src="https://cdn.jsdelivr.net/npm/aeskeywrap@1.2.2/dist/aeskeywrap.js"></script>
<!-- or load the file from unpkg -->
<script src="https://unpkg.com/aeskeywrap@1.2.2/dist/aeskeywrap.js"></script>
<!-- or download the file and host it yourself -->
<script src="/js/aeskeywrap.js"></script>
<script>
// Replace ... with a comma-separated list of the functions, you need
const { ... } = aeskeywrap;
</script>
// key, kek and wrappedKey are Unit8Arrays
const wrappedKey = wrapKey(key, kek);
// key, kek and wrappedKey are Unit8Arrays
const key = unwrapKey(wrappedKey, kek);
// convert Uint8Array to base64 string
const wrappedKeyBase64 = toString(wrappedKey, 'base64')
// convert Uint8Array to hex string
const wrappedKeyHex = toString(wrappedKey, 'hex')
// convert Uint8Array to base64 string
const wrappedKey = fromString(wrappedKeyBase64, 'base64')
// convert Uint8Array to hex string
const wrappedKey_ = fromString(wrappedKeyhex, 'hex')
const wrappedKey = wrapKeyToString(key, kek, 'base64');
const key = unwrapKeyFromString(wrappedKeyBase64, kek, 'base64');
You can use all encodings, available at buffer.toString() function.
Currently this includes:
There are 3 possible errors.
Each error only contains a message, specifying the error type.
These are the 3 different messages (they are very self-explanatory):
Unauthentic data. Wrong kek?Invalid data length(s). kek must be 16, 24 or 32 bytes, key must be same length.Invalid data length(s). kek must be 16, 24 or 32 bytes, wrappedKey must be 8 bytes longerThere are 2 different reasons for unauthentic data:
The message Unauthentic data. Wrong kek? will never change (design decision). Therefore, it can be reliably used to determine whether the process failed due to unauthentic data.
Unit Tests based on official test vectors
This project is licensed under the MIT License
FAQs
Provides the RFC 3394 key wrapping (also known as aes-key-wrap), written in TypeScrypt.
We found that aeskeywrap demonstrated a not healthy version release cadence and project activity because the last version was released 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.