Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

arweave

Package Overview
Dependencies
Maintainers
3
Versions
82
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.10.0 to 1.10.1

0

node/ar.d.ts

@@ -0,0 +0,0 @@ export default class Ar {

@@ -0,0 +0,0 @@ "use strict";

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

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Ar from "./ar";

6

node/common.js

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

api: this.api.getConfig(),
crypto: null,
crypto: null
};

@@ -110,5 +110,3 @@ }

arql(query) {
return this.api
.post("/arql", query)
.then((response) => response.data || []);
return this.api.post("/arql", query).then(response => response.data || []);
}

@@ -115,0 +113,0 @@ }

import Arweave from "./common";
export = Arweave;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

import { JWKInterface } from "../wallet";
export interface SignatureOptions {
saltLength?: number;
}
export default interface CryptoInterface {
generateJWK(): Promise<JWKInterface>;
sign(jwk: JWKInterface, data: Uint8Array): Promise<Uint8Array>;
sign(jwk: JWKInterface, data: Uint8Array, options?: SignatureOptions): Promise<Uint8Array>;
verify(publicModulus: string, data: Uint8Array, signature: Uint8Array): Promise<boolean>;

@@ -6,0 +9,0 @@ encrypt(data: Uint8Array, key: string | Uint8Array): Promise<Uint8Array>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=crypto-interface.js.map
/// <reference types="node" />
import { JWKInterface } from "../wallet";
import CryptoInterface from "./crypto-interface";
import CryptoInterface, { SignatureOptions } from "./crypto-interface";
export default class NodeCryptoDriver implements CryptoInterface {

@@ -10,3 +10,3 @@ readonly keyLength = 4096;

generateJWK(): Promise<JWKInterface>;
sign(jwk: object, data: Uint8Array): Promise<Uint8Array>;
sign(jwk: object, data: Uint8Array, { saltLength }?: SignatureOptions): Promise<Uint8Array>;
verify(publicModulus: string, data: Uint8Array, signature: Uint8Array): Promise<boolean>;

@@ -13,0 +13,0 @@ hash(data: Uint8Array, algorithm?: string): Promise<Uint8Array>;

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

}
sign(jwk, data) {
sign(jwk, data, { saltLength } = {}) {
return new Promise((resolve, reject) => {

@@ -43,3 +43,3 @@ resolve(crypto

padding: constants.RSA_PKCS1_PSS_PADDING,
saltLength: 0
saltLength,
}));

@@ -62,3 +62,2 @@ });

padding: constants.RSA_PKCS1_PSS_PADDING,
saltLength: 0
}, signature));

@@ -65,0 +64,0 @@ });

export declare function pemTojwk(pem: any, extras?: any): any;
export declare function jwkTopem(json: any): any;

@@ -0,0 +0,0 @@ "use strict";

/// <reference types="node" />
import { JWKInterface } from "../wallet";
import CryptoInterface from "./crypto-interface";
import CryptoInterface, { SignatureOptions } from "./crypto-interface";
export default class WebCryptoDriver implements CryptoInterface {

@@ -11,3 +11,3 @@ readonly keyLength = 4096;

generateJWK(): Promise<JWKInterface>;
sign(jwk: JWKInterface, data: Uint8Array): Promise<Uint8Array>;
sign(jwk: JWKInterface, data: Uint8Array, { saltLength }?: SignatureOptions): Promise<Uint8Array>;
hash(data: Uint8Array, algorithm?: string): Promise<Uint8Array>;

@@ -14,0 +14,0 @@ verify(publicModulus: string, data: Uint8Array, signature: Uint8Array): Promise<boolean>;

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

}
this.driver = window.crypto.subtle;
this.driver = crypto.subtle;
}

@@ -37,6 +37,6 @@ async generateJWK() {

}
async sign(jwk, data) {
async sign(jwk, data, { saltLength } = {}) {
let signature = await this.driver.sign({
name: "RSA-PSS",
saltLength: 0
saltLength
}, await this.jwkToCryptoKey(jwk), data);

@@ -58,3 +58,2 @@ return new Uint8Array(signature);

name: "RSA-PSS",
saltLength: 0
}, key, signature, data);

@@ -79,22 +78,17 @@ }

detectWebCrypto() {
if (!window || !window.crypto || !window.crypto.subtle) {
if (typeof crypto === "undefined") {
return false;
}
let subtle = window.crypto.subtle;
if (typeof subtle.generateKey != "function") {
const subtle = crypto === null || crypto === void 0 ? void 0 : crypto.subtle;
if (subtle === undefined) {
return false;
}
if (typeof subtle.importKey != "function") {
return false;
}
if (typeof subtle.exportKey != "function") {
return false;
}
if (typeof subtle.digest != "function") {
return false;
}
if (typeof subtle.sign != "function") {
return false;
}
return true;
const names = [
"generateKey",
"importKey",
"exportKey",
"digest",
"sign",
];
return names.every((name) => typeof subtle[name] === "function");
}

@@ -101,0 +95,0 @@ async encrypt(data, key) {

@@ -0,0 +0,0 @@ declare type DeepHashChunk = Uint8Array | DeepHashChunks;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { AxiosResponse } from "axios";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export interface Chunk {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Transaction from "./transaction";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Chunk, Proof } from "./merkle";

@@ -132,7 +132,9 @@ "use strict";

case 1:
let tagString = this.tags.reduce((accumulator, tag) => {
return (accumulator +
tag.get("name", { decode: true, string: true }) +
tag.get("value", { decode: true, string: true }));
}, "");
let tags = this.tags.reduce((accumulator, tag) => {
return ArweaveUtils.concatBuffers([
accumulator,
tag.get("name", { decode: true, string: false }),
tag.get("value", { decode: true, string: false }),
]);
}, new Uint8Array());
return ArweaveUtils.concatBuffers([

@@ -145,3 +147,3 @@ this.get("owner", { decode: true, string: false }),

this.get("last_tx", { decode: true, string: false }),
ArweaveUtils.stringToBuffer(tagString)
tags,
]);

@@ -148,0 +150,0 @@ case 2:

@@ -0,0 +0,0 @@ export declare type Base64UrlString = string;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export interface JWKPublicInterface {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=wallet.js.map

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

@@ -0,0 +0,0 @@ "use strict";

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

@@ -0,0 +0,0 @@ "use strict";

/// <reference types="node" />
import Api from "./lib/api";
import CryptoInterface from "./lib/crypto/crypto-interface";
import CryptoInterface, { SignatureOptions } from "./lib/crypto/crypto-interface";
import Transaction from "./lib/transaction";

@@ -32,3 +32,3 @@ import { JWKInterface } from "./lib/wallet";

}): Promise<string | Uint8Array>;
sign(transaction: Transaction, jwk: JWKInterface): Promise<void>;
sign(transaction: Transaction, jwk: JWKInterface, options?: SignatureOptions): Promise<void>;
verify(transaction: Transaction): Promise<boolean>;

@@ -35,0 +35,0 @@ post(transaction: Transaction | Buffer | string | object): Promise<{

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

}
async sign(transaction, jwk) {
async sign(transaction, jwk, options) {
let dataToSign = await transaction.getSignatureData();
let rawSignature = await this.crypto.sign(jwk, dataToSign);
let rawSignature = await this.crypto.sign(jwk, dataToSign, options);
let id = await this.crypto.hash(rawSignature);

@@ -145,0 +145,0 @@ transaction.setSignature({

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

@@ -0,0 +0,0 @@ "use strict";

{
"name": "arweave",
"version": "1.10.0",
"version": "1.10.1",
"description": "Arweave JS client library",

@@ -79,3 +79,3 @@ "main": "./node/index.js",

"asn1.js": "^5.4.1",
"axios": "^0.19.2",
"axios": "^0.21.1",
"base64-js": "^1.3.1",

@@ -82,0 +82,0 @@ "bignumber.js": "^8.1.1"

@@ -0,0 +0,0 @@ export default class Ar {

@@ -0,0 +0,0 @@ "use strict";

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

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Ar from "./ar";

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

api: this.api.getConfig(),
crypto: null,
crypto: null
};

@@ -110,5 +110,3 @@ }

arql(query) {
return this.api
.post("/arql", query)
.then((response) => response.data || []);
return this.api.post("/arql", query).then(response => response.data || []);
}

@@ -115,0 +113,0 @@ }

@@ -0,0 +0,0 @@ import Arweave from "./common";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

import { JWKInterface } from "../wallet";
export interface SignatureOptions {
saltLength?: number;
}
export default interface CryptoInterface {
generateJWK(): Promise<JWKInterface>;
sign(jwk: JWKInterface, data: Uint8Array): Promise<Uint8Array>;
sign(jwk: JWKInterface, data: Uint8Array, options?: SignatureOptions): Promise<Uint8Array>;
verify(publicModulus: string, data: Uint8Array, signature: Uint8Array): Promise<boolean>;

@@ -6,0 +9,0 @@ encrypt(data: Uint8Array, key: string | Uint8Array): Promise<Uint8Array>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=crypto-interface.js.map
/// <reference types="node" />
import { JWKInterface } from "../wallet";
import CryptoInterface from "./crypto-interface";
import CryptoInterface, { SignatureOptions } from "./crypto-interface";
export default class NodeCryptoDriver implements CryptoInterface {

@@ -10,3 +10,3 @@ readonly keyLength = 4096;

generateJWK(): Promise<JWKInterface>;
sign(jwk: object, data: Uint8Array): Promise<Uint8Array>;
sign(jwk: object, data: Uint8Array, { saltLength }?: SignatureOptions): Promise<Uint8Array>;
verify(publicModulus: string, data: Uint8Array, signature: Uint8Array): Promise<boolean>;

@@ -13,0 +13,0 @@ hash(data: Uint8Array, algorithm?: string): Promise<Uint8Array>;

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

}
sign(jwk, data) {
sign(jwk, data, { saltLength } = {}) {
return new Promise((resolve, reject) => {

@@ -43,3 +43,3 @@ resolve(crypto

padding: constants.RSA_PKCS1_PSS_PADDING,
saltLength: 0
saltLength,
}));

@@ -62,3 +62,2 @@ });

padding: constants.RSA_PKCS1_PSS_PADDING,
saltLength: 0
}, signature));

@@ -65,0 +64,0 @@ });

export declare function pemTojwk(pem: any, extras?: any): any;
export declare function jwkTopem(json: any): any;

@@ -0,0 +0,0 @@ "use strict";

/// <reference types="node" />
import { JWKInterface } from "../wallet";
import CryptoInterface from "./crypto-interface";
import CryptoInterface, { SignatureOptions } from "./crypto-interface";
export default class WebCryptoDriver implements CryptoInterface {

@@ -11,3 +11,3 @@ readonly keyLength = 4096;

generateJWK(): Promise<JWKInterface>;
sign(jwk: JWKInterface, data: Uint8Array): Promise<Uint8Array>;
sign(jwk: JWKInterface, data: Uint8Array, { saltLength }?: SignatureOptions): Promise<Uint8Array>;
hash(data: Uint8Array, algorithm?: string): Promise<Uint8Array>;

@@ -14,0 +14,0 @@ verify(publicModulus: string, data: Uint8Array, signature: Uint8Array): Promise<boolean>;

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

}
this.driver = window.crypto.subtle;
this.driver = crypto.subtle;
}

@@ -37,6 +37,6 @@ async generateJWK() {

}
async sign(jwk, data) {
async sign(jwk, data, { saltLength } = {}) {
let signature = await this.driver.sign({
name: "RSA-PSS",
saltLength: 0
saltLength
}, await this.jwkToCryptoKey(jwk), data);

@@ -58,3 +58,2 @@ return new Uint8Array(signature);

name: "RSA-PSS",
saltLength: 0
}, key, signature, data);

@@ -79,22 +78,17 @@ }

detectWebCrypto() {
if (!window || !window.crypto || !window.crypto.subtle) {
if (typeof crypto === "undefined") {
return false;
}
let subtle = window.crypto.subtle;
if (typeof subtle.generateKey != "function") {
const subtle = crypto === null || crypto === void 0 ? void 0 : crypto.subtle;
if (subtle === undefined) {
return false;
}
if (typeof subtle.importKey != "function") {
return false;
}
if (typeof subtle.exportKey != "function") {
return false;
}
if (typeof subtle.digest != "function") {
return false;
}
if (typeof subtle.sign != "function") {
return false;
}
return true;
const names = [
"generateKey",
"importKey",
"exportKey",
"digest",
"sign",
];
return names.every((name) => typeof subtle[name] === "function");
}

@@ -101,0 +95,0 @@ async encrypt(data, key) {

@@ -0,0 +0,0 @@ declare type DeepHashChunk = Uint8Array | DeepHashChunks;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { AxiosResponse } from "axios";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export interface Chunk {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Transaction from "./transaction";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Chunk, Proof } from "./merkle";

@@ -132,7 +132,9 @@ "use strict";

case 1:
let tagString = this.tags.reduce((accumulator, tag) => {
return (accumulator +
tag.get("name", { decode: true, string: true }) +
tag.get("value", { decode: true, string: true }));
}, "");
let tags = this.tags.reduce((accumulator, tag) => {
return ArweaveUtils.concatBuffers([
accumulator,
tag.get("name", { decode: true, string: false }),
tag.get("value", { decode: true, string: false }),
]);
}, new Uint8Array());
return ArweaveUtils.concatBuffers([

@@ -145,3 +147,3 @@ this.get("owner", { decode: true, string: false }),

this.get("last_tx", { decode: true, string: false }),
ArweaveUtils.stringToBuffer(tagString)
tags,
]);

@@ -148,0 +150,0 @@ case 2:

@@ -0,0 +0,0 @@ export declare type Base64UrlString = string;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export interface JWKPublicInterface {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=wallet.js.map

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

@@ -0,0 +0,0 @@ "use strict";

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

@@ -0,0 +0,0 @@ "use strict";

/// <reference types="node" />
import Api from "./lib/api";
import CryptoInterface from "./lib/crypto/crypto-interface";
import CryptoInterface, { SignatureOptions } from "./lib/crypto/crypto-interface";
import Transaction from "./lib/transaction";

@@ -32,3 +32,3 @@ import { JWKInterface } from "./lib/wallet";

}): Promise<string | Uint8Array>;
sign(transaction: Transaction, jwk: JWKInterface): Promise<void>;
sign(transaction: Transaction, jwk: JWKInterface, options?: SignatureOptions): Promise<void>;
verify(transaction: Transaction): Promise<boolean>;

@@ -35,0 +35,0 @@ post(transaction: Transaction | Buffer | string | object): Promise<{

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

}
async sign(transaction, jwk) {
async sign(transaction, jwk, options) {
let dataToSign = await transaction.getSignatureData();
let rawSignature = await this.crypto.sign(jwk, dataToSign);
let rawSignature = await this.crypto.sign(jwk, dataToSign, options);
let id = await this.crypto.hash(rawSignature);

@@ -145,0 +145,0 @@ transaction.setSignature({

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

@@ -0,0 +0,0 @@ "use strict";

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

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