Socket
Socket
Sign inDemoInstall

arweave

Package Overview
Dependencies
Maintainers
5
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arweave - npm Package Compare versions

Comparing version 1.11.6 to 1.11.7

5

node/lib/crypto/node-driver.js

@@ -28,3 +28,2 @@ "use strict";

const crypto = __importStar(require("crypto"));
const constants = __importStar(require("constants"));
class NodeCryptoDriver {

@@ -65,3 +64,3 @@ constructor() {

key: this.jwkToPem(jwk),
padding: constants.RSA_PKCS1_PSS_PADDING,
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
saltLength,

@@ -81,3 +80,3 @@ }));

key: pem,
padding: constants.RSA_PKCS1_PSS_PADDING,
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
}, signature));

@@ -84,0 +83,0 @@ });

14

node/lib/crypto/webcrypto-driver.js

@@ -77,11 +77,11 @@ "use strict";

const key = await this.jwkToPublicCryptoKey(publicKey);
const verifyWith32 = this.driver.verify({
const digest = await this.driver.digest("SHA-256", data);
// salt-length is derived from a formula described here
// https://developer.mozilla.org/en-US/docs/Web/API/RsaPssParams
return await this.driver.verify({
name: "RSA-PSS",
saltLength: 32,
saltLength: Math.ceil((key.algorithm.modulusLength - 1) / 8) -
digest.byteLength -
2,
}, key, signature, data);
const verifyWith0 = this.driver.verify({
name: "RSA-PSS",
saltLength: 0,
}, key, signature, data);
return verifyWith32 || verifyWith0;
}

@@ -88,0 +88,0 @@ async jwkToCryptoKey(jwk) {

@@ -0,1 +1,2 @@

/// <reference path="../../../src/modules.d.ts" />
/// <reference types="node" />

@@ -2,0 +3,0 @@ import Api from "./lib/api";

"use strict";
/// <reference path="../modules.d.ts" />
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {

@@ -172,3 +173,3 @@ if (k2 === undefined) k2 = k;

async sign(transaction, jwk, options) {
if (!jwk && (typeof window === "undefined" || !window.arweaveWallet)) {
if (!jwk && typeof arweaveWallet !== "object") {
throw new Error(`A new Arweave transaction must provide the jwk parameter.`);

@@ -178,5 +179,5 @@ }

try {
const existingPermissions = await window.arweaveWallet.getPermissions();
const existingPermissions = await arweaveWallet.getPermissions();
if (!existingPermissions.includes("SIGN_TRANSACTION"))
await window.arweaveWallet.connect(["SIGN_TRANSACTION"]);
await arweaveWallet.connect(["SIGN_TRANSACTION"]);
}

@@ -186,3 +187,3 @@ catch (_a) {

}
const signedTransaction = await window.arweaveWallet.sign(transaction, options);
const signedTransaction = await arweaveWallet.sign(transaction, options);
transaction.setSignature({

@@ -189,0 +190,0 @@ id: signedTransaction.id,

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

// @ts-ignore
await window.arweaveWallet.connect(["ACCESS_ADDRESS"]);
await arweaveWallet.connect(["ACCESS_ADDRESS"]);
}

@@ -94,3 +94,3 @@ catch (_a) {

// @ts-ignore
return window.arweaveWallet.getActiveAddress();
return arweaveWallet.getActiveAddress();
}

@@ -97,0 +97,0 @@ else {

{
"name": "arweave",
"version": "1.11.6",
"version": "1.11.7",
"description": "Arweave JS client library",

@@ -5,0 +5,0 @@ "main": "./node/index.js",

@@ -6,4 +6,7 @@ import Arweave from "./common";

}
module globalThis {
var Arweave: unknown;
}
}
export * from "./common";
export default Arweave;

@@ -25,13 +25,12 @@ "use strict";

};
if (!window ||
!window.location ||
!window.location.protocol ||
!window.location.hostname) {
if (typeof location !== "object" ||
!location.protocol ||
!location.hostname) {
return defaults;
}
// window.location.protocol has a trailing colon (http:, https:, file: etc)
const currentProtocol = window.location.protocol.replace(":", "");
const currentHost = window.location.hostname;
const currentPort = window.location.port
? parseInt(window.location.port)
const currentProtocol = location.protocol.replace(":", "");
const currentHost = location.hostname;
const currentPort = location.port
? parseInt(location.port)
: currentProtocol == "https"

@@ -61,5 +60,10 @@ ? 443

};
window.Arweave = common_1.default;
if (typeof globalThis === "object") {
globalThis.Arweave = common_1.default;
}
else if (typeof self === "object") {
self.Arweave = common_1.default;
}
__exportStar(require("./common"), exports);
exports.default = common_1.default;
//# sourceMappingURL=index.js.map

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

const crypto = require("crypto");
const constants = require("constants");
class NodeCryptoDriver {

@@ -42,3 +41,3 @@ constructor() {

key: this.jwkToPem(jwk),
padding: constants.RSA_PKCS1_PSS_PADDING,
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
saltLength,

@@ -58,3 +57,3 @@ }));

key: pem,
padding: constants.RSA_PKCS1_PSS_PADDING,
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
}, signature));

@@ -61,0 +60,0 @@ });

@@ -54,11 +54,11 @@ "use strict";

const key = await this.jwkToPublicCryptoKey(publicKey);
const verifyWith32 = this.driver.verify({
const digest = await this.driver.digest("SHA-256", data);
// salt-length is derived from a formula described here
// https://developer.mozilla.org/en-US/docs/Web/API/RsaPssParams
return await this.driver.verify({
name: "RSA-PSS",
saltLength: 32,
saltLength: Math.ceil((key.algorithm.modulusLength - 1) / 8) -
digest.byteLength -
2,
}, key, signature, data);
const verifyWith0 = this.driver.verify({
name: "RSA-PSS",
saltLength: 0,
}, key, signature, data);
return verifyWith32 || verifyWith0;
}

@@ -65,0 +65,0 @@ async jwkToCryptoKey(jwk) {

@@ -0,1 +1,2 @@

/// <reference path="../../../src/modules.d.ts" />
/// <reference types="node" />

@@ -2,0 +3,0 @@ import Api from "./lib/api";

"use strict";
/// <reference path="../modules.d.ts" />
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }

@@ -146,3 +147,3 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {

async sign(transaction, jwk, options) {
if (!jwk && (typeof window === "undefined" || !window.arweaveWallet)) {
if (!jwk && typeof arweaveWallet !== "object") {
throw new Error(`A new Arweave transaction must provide the jwk parameter.`);

@@ -152,5 +153,5 @@ }

try {
const existingPermissions = await window.arweaveWallet.getPermissions();
const existingPermissions = await arweaveWallet.getPermissions();
if (!existingPermissions.includes("SIGN_TRANSACTION"))
await window.arweaveWallet.connect(["SIGN_TRANSACTION"]);
await arweaveWallet.connect(["SIGN_TRANSACTION"]);
}

@@ -160,3 +161,3 @@ catch (_a) {

}
const signedTransaction = await window.arweaveWallet.sign(transaction, options);
const signedTransaction = await arweaveWallet.sign(transaction, options);
transaction.setSignature({

@@ -163,0 +164,0 @@ id: signedTransaction.id,

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

// @ts-ignore
await window.arweaveWallet.connect(["ACCESS_ADDRESS"]);
await arweaveWallet.connect(["ACCESS_ADDRESS"]);
}

@@ -71,3 +71,3 @@ catch (_a) {

// @ts-ignore
return window.arweaveWallet.getActiveAddress();
return arweaveWallet.getActiveAddress();
}

@@ -74,0 +74,0 @@ else {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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