Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
microstar-crypto
Advanced tools
Cryptography library for Microstar. Wraps tweetnacl, performing type conversions and simplifying public key management.
s library wraps tweetnacl, doing a few things.
box
(public key encryption), secretbox
(symmetric encryption), and sign
(cryptographic signatures). Each of these takes a different kind of key, but they can all be generated from a box
secret key. Microstar-crypto does this generation automatically so that you only need to handle and store one private key. Additionally, box
and sign
use separate public keys. Microstar-crypto concatenates these into one string, and then extracts the correct public key depending on method.Using tweetnacl
by itself:
var keys = {
box: {
secretKey: Uint8Array, // 32 bytes
publicKey: Uint8Array // 32 bytes
},
sign: {
secretKey: Uint8Array, // 32 bytes
publicKey: Uint8Array // 64 bytes
},
secretbox: {
secretKey: Uint8Array // 32 bytes
}
}
Using microstar-crypto;
var keys = {
publicKey: String, // 88 characters
secretKey: String // 44 characters
}
Generates a keypair. Called with a secretKey it will generate the corresponding public key. Without, it will generate both keys from scratch.
mCrypto.keys(function (err, keys) {
// keys = {
// publicKey: String, // 88 characters
// secretKey: String // 44 characters
// }
})
Encrypts a string using a public key. Returns a string.
mCrypto.box(string, nonce, alicePublicKey, bobSecretKey, function (err, box) {
// box = String // encrypted
})
mCrypto.box.open(box, nonce, bobPublicKey, aliceSecretKey, function (err, string) {
// string = String // plaintext
})
Encrypts a string symmetrically with one secret key. Returns a string.
mCrypto.secretbox(string, nonce, secretKey, function (err, box) {
// box = String // encrypted
})
mCrypto.secretbox.open(box, nonce, secretKey, function (err, string) {
// string = String // plaintext
})
Signs a string, returning a signature as a string. This uses tweetnacl.sign.detached
under the hood.
mCrypto.sign(string, secretKey, function (err, signature) {
// signature = String
})
mCrypto.sign.verify(string, signature, publicKey, function (err, valid) {
// valid = Boolean
})
FAQs
Cryptography library for Microstar. Wraps tweetnacl, performing type conversions and simplifying public key management.
We found that microstar-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.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.