
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
@bicycle-codes/ephemeral-crypto
Advanced tools
Cryptography used by ephemeral.page. Works in browsers and node.
This is generally useful as a dead simple way of using symmetric keys in a browser or node.
Thanks to Fission, the original author for much of this code.
npm i -S @bicycle-codes/ephemeral-crypto
encryptMessage
Encrypt the given message object, and return an array of [ encryptedMessage, { key }]
, where key
is a new AES key, encoded as base64url
.
async function encryptMessage (
msg:{ content:string }
):Promise<[{ content:string }, { key }]>
import { encryptMessage } from '@bicycle-codes/ephemeral-crypto'
const [encryptedMsg, { key }] = await encryptMessage({
content: 'hello world'
})
console.log(encryptedMessage)
// => { content: '5eAcA6+jnBfbuCx8L...' }
decryptMessage
Decrypt the given message with the given key. Suitable for decrypting a message that was encrypted by this library. Key is an AES key, base64url
encoded.
async function decryptMessage (
msg:{ content:string },
keyString:string // <-- base64url
):Promise<{ content:string }>
import { test } from '@nichoth/tapzero'
import { decryptMessage } from '@bicycle-codes/ephemeral-crypto'
test('decrypt the message', async t => {
const decrypted = await decryptMessage(message, key)
t.equal(decrypted.content, 'hello world',
'should decrypt to the right text')
})
[!NOTE]
This uses forks ofone-webcrypto
anduint8arrays
so that we own the entire dependency graph.
FAQs
In-browser cryptography
The npm package @bicycle-codes/ephemeral-crypto receives a total of 0 weekly downloads. As such, @bicycle-codes/ephemeral-crypto popularity was classified as not popular.
We found that @bicycle-codes/ephemeral-crypto 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.