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

multikey-webcrypto

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multikey-webcrypto - npm Package Compare versions

Comparing version 0.5.3 to 0.5.4

2

dist/index.js

@@ -46,3 +46,3 @@ "use strict";

// generation, that raises an error earlier in this case.
// But this keeps typescript happy...
// But this keeps the typescript code checker happy...
throw new Error("Unknown kty value for the JWK key");

@@ -49,0 +49,0 @@ }

@@ -11,4 +11,3 @@ "use strict";

const common_1 = require("./common");
const base58 = require("./encodings/base58/index");
const base64 = require("./encodings/base64");
const base_1 = require("@scure/base");
/****************************************************************************************/

@@ -34,6 +33,6 @@ /* The real converter functions */

if (key[0] === 'z') {
const unencoded_key = base58.decode(key.slice(1));
const plain_key = base_1.base58.decode(key.slice(1));
return {
preamble: [unencoded_key[0], unencoded_key[1]],
keyBinary: unencoded_key.slice(2),
preamble: [plain_key[0], plain_key[1]],
keyBinary: plain_key.slice(2),
};

@@ -45,3 +44,3 @@ }

};
// Get the the public values values...
// Get the public values...
const publicBinary = convertBinary(keys.publicKeyMultibase);

@@ -90,3 +89,3 @@ // ... and find out, based on the preamble, which curve is used and whether it is indeed public

const val_mk = new Uint8Array([...preamble, ...val]);
return 'z' + base58.encode(val_mk);
return 'z' + base_1.base58.encode(val_mk);
};

@@ -98,3 +97,3 @@ const decodeJWKField = (val) => {

else {
return base64.decode(val);
return base_1.base64urlnopad.decode(val);
}

@@ -101,0 +100,0 @@ };

@@ -15,3 +15,3 @@ "use strict";

const common_1 = require("./common");
const base64 = require("./encodings/base64");
const base_1 = require("@scure/base");
/**

@@ -59,4 +59,4 @@ * Convert the Crypto values from JWK to the equivalent Multikey Pairs' binary data.

const uncompressed = uncompressPublicKey(curve, xb);
const x = base64.encode(uncompressed.x);
const y = base64.encode(uncompressed.y);
const x = base_1.base64urlnopad.encode(uncompressed.x);
const y = base_1.base64urlnopad.encode(uncompressed.y);
const output = {

@@ -80,3 +80,3 @@ publicKey: {

y,
d: base64.encode(db),
d: base_1.base64urlnopad.encode(db),
key_ops: [

@@ -105,10 +105,2 @@ "sign"

}
// Utility function to convert hex string to Uint8Array
function hexToUint8Array(hex) {
const result = new Uint8Array(hex.length / 2);
for (let i = 0; i < hex.length; i += 2) {
result[i / 2] = parseInt(hex.substr(i, 2), 16);
}
return result;
}
/**

@@ -140,3 +132,3 @@ * Compress the public key. Could be done "manually" (look at the parity of the `y` value, and add a byte at the start of the `x`), but

const uncompressedKey = point.toRawBytes(false);
// The 'uncompressed key is a concatenation of the x and y values, plus an extra value at the start. The latter must be disposed off, and
// The uncompressed key is a concatenation of the x and y values, plus an extra value at the start. The latter must be disposed off, and
// the remaining array to be cut into two.

@@ -143,0 +135,0 @@ const keyLength = (curve === common_1.CryptoCurves.ECDSA_256) ? 32 : 48;

@@ -5,3 +5,3 @@ "use strict";

exports.multikeyBinaryToJWK = multikeyBinaryToJWK;
const base64 = require("./encodings/base64");
const base_1 = require("@scure/base");
/**

@@ -40,3 +40,3 @@ * Convert the Crypto values from JWK to the equivalent Multikey Pairs' binary data.

function multikeyBinaryToJWK(_curve, xb, db) {
const x = base64.encode(xb);
const x = base_1.base64urlnopad.encode(xb);
const output = {

@@ -58,3 +58,3 @@ publicKey: {

x,
d: base64.encode(db),
d: base_1.base64urlnopad.encode(db),
key_ops: [

@@ -61,0 +61,0 @@ "sign"

{
"name": "multikey-webcrypto",
"version": "0.5.3",
"date": "2024-11-12",
"version": "0.5.4",
"date": "2024-11-21",
"description": "Conversions to and from multikeys and WebCrypto, using the EC curves defined for Verifiable Credentials.",

@@ -6,0 +6,0 @@ "main": "dist/index.js",

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