New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tabcat/peer-account-crypto

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tabcat/peer-account-crypto - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

3

package.json
{
"name": "@tabcat/peer-account-crypto",
"version": "0.0.1",
"version": "0.0.2",
"description": "crypto library for node and browser. uses webcrypto or node-webcrypto-ossl for primatives",

@@ -31,2 +31,3 @@ "repository": {

"dependencies": {
"asn1.js": "^5.2.0",
"node-webcrypto-ossl": "^1.0.48"

@@ -33,0 +34,0 @@ },

@@ -11,3 +11,3 @@

static async genKey (length = 128) {
static async generateKey (length = 128) {
const cryptoKey = await webcrypto.get().subtle.generateKey(

@@ -14,0 +14,0 @@ {

@@ -13,3 +13,3 @@

exports.import = async (jwk) => {
exports.importKey = async (jwk) => {
if (

@@ -82,3 +82,3 @@ (!jwk || !jwk.pub || !jwk.pub.crv) ||

exports.generate = async function (curve = 'P-256') {
exports.generateKey = async function (curve = 'P-256') {
validateCurveType(Object.keys(bits), curve)

@@ -95,3 +95,3 @@ const pair = await webcrypto.get().subtle.generateKey(

const priv = await webcrypto.get().subtle.exportKey('jwk', pair.privateKey)
return exports.import({ pub, priv })
return exports.importKey({ pub, priv })
}

@@ -98,0 +98,0 @@

@@ -11,3 +11,3 @@

exports.aes = require('./aes')
exports.utils = require('./util')
exports.util = require('./util')
exports.randomBytes = require('./util').randomBytes

@@ -6,4 +6,2 @@

const webcrypto = new Webcrypto()
exports.get = () => {
return webcrypto
}
exports.get = () => webcrypto

@@ -8,3 +8,3 @@

const { str2ab, ab2str } = crypto.utils
const { str2ab, ab2str } = crypto.util

@@ -34,6 +34,6 @@ describe('crypto.aes', function () {

describe('.genKey', function () {
describe('.generateKey', function () {
it('generates an instance of AesKey with default length 128', async () => {
const length = 128
aesKey = await aes.genKey()
aesKey = await aes.generateKey()
assert.strictEqual(aesKey._cryptoKey.algorithm.length, length)

@@ -45,3 +45,3 @@ await useAesKey()

const length = 256
aesKey = await aes.genKey(length)
aesKey = await aes.generateKey(length)
assert.strictEqual(aesKey._cryptoKey.algorithm.length, length)

@@ -48,0 +48,0 @@ await useAesKey()

@@ -27,4 +27,4 @@

)
const ecdh1 = await ecdh.import(jwk1)
const ecdh2 = await ecdh.import(jwk2)
const ecdh1 = await ecdh.importKey(jwk1)
const ecdh2 = await ecdh.importKey(jwk2)
await useEcdh(ecdh1, ecdh2)

@@ -40,4 +40,4 @@ })

)
const ecdh1 = await ecdh.import(jwk1)
const ecdh2 = await ecdh.import(jwk2)
const ecdh1 = await ecdh.importKey(jwk1)
const ecdh2 = await ecdh.importKey(jwk2)
await useEcdh(ecdh1, ecdh2)

@@ -47,7 +47,7 @@ })

describe('.generate', function () {
describe('.generateKey', function () {
it('generates a new ecdh key pair with default curve P-256', async () => {
const curve = 'P-256'
const ecdh1 = await ecdh.generate()
const ecdh2 = await ecdh.generate()
const ecdh1 = await ecdh.generateKey()
const ecdh2 = await ecdh.generateKey()
assert.strictEqual(ecdh1.jwk.priv.crv, curve)

@@ -59,4 +59,4 @@ await useEcdh(ecdh1, ecdh2)

const curve = 'P-521'
const ecdh1 = await ecdh.generate(curve)
const ecdh2 = await ecdh.generate(curve)
const ecdh1 = await ecdh.generateKey(curve)
const ecdh2 = await ecdh.generateKey(curve)
assert.strictEqual(ecdh1.jwk.priv.crv, curve)

@@ -63,0 +63,0 @@ await useEcdh(ecdh1, ecdh2)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc