Socket
Socket
Sign inDemoInstall

arweave

Package Overview
Dependencies
Maintainers
1
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.0.0 to 1.0.1

2

dist/node/arweave/arweave.d.ts

@@ -8,3 +8,3 @@ import { Ar } from "./ar";

import { TransactionInterface, Transaction } from "./lib/transaction";
import { JWKInterface } from "./lib/Wallet";
import { JWKInterface } from "./lib/wallet";
import { ArweaveUtils } from "./lib/utils";

@@ -11,0 +11,0 @@ interface Config<T = object> {

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

import { JWKInterface } from "../Wallet";
import { JWKInterface } from "../wallet";
export interface CryptoInterface {

@@ -3,0 +3,0 @@ generateJWK(): Promise<JWKInterface>;

/// <reference types="node" />
import { JWKInterface } from "../Wallet";
import { JWKInterface } from "../wallet";
import { CryptoInterface } from "./crypto-interface";

@@ -4,0 +4,0 @@ export declare class NodeCryptoDriver implements CryptoInterface {

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

import { JWKInterface } from "../Wallet";
import { JWKInterface } from "../wallet";
import { CryptoInterface } from "./crypto-interface";

@@ -3,0 +3,0 @@ export declare class WebCryptoDriver implements CryptoInterface {

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

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

import { Transaction } from "./lib/transaction";
import { JWKInterface } from './lib/Wallet';
import { JWKInterface } from './lib/wallet';
import { AxiosResponse } from "axios";

@@ -8,0 +8,0 @@ export declare class Transactions {

import { Api } from "./lib/api";
import { CryptoInterface } from "./lib/crypto/crypto-interface";
import { JWKInterface } from "./lib/Wallet";
import { JWKInterface } from "./lib/wallet";
export declare class Wallets {

@@ -5,0 +5,0 @@ private api;

@@ -8,3 +8,3 @@ import { Ar } from "./ar";

import { TransactionInterface, Transaction } from "./lib/transaction";
import { JWKInterface } from "./lib/Wallet";
import { JWKInterface } from "./lib/wallet";
import { ArweaveUtils } from "./lib/utils";

@@ -11,0 +11,0 @@ interface Config<T = object> {

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

import { JWKInterface } from "../Wallet";
import { JWKInterface } from "../wallet";
export interface CryptoInterface {

@@ -3,0 +3,0 @@ generateJWK(): Promise<JWKInterface>;

/// <reference types="node" />
import { JWKInterface } from "../Wallet";
import { JWKInterface } from "../wallet";
import { CryptoInterface } from "./crypto-interface";

@@ -4,0 +4,0 @@ export declare class NodeCryptoDriver implements CryptoInterface {

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

import { JWKInterface } from "../Wallet";
import { JWKInterface } from "../wallet";
import { CryptoInterface } from "./crypto-interface";

@@ -3,0 +3,0 @@ export declare class WebCryptoDriver implements CryptoInterface {

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

//# sourceMappingURL=Wallet.js.map
//# sourceMappingURL=wallet.js.map

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

import { Transaction } from "./lib/transaction";
import { JWKInterface } from './lib/Wallet';
import { JWKInterface } from './lib/wallet';
import { AxiosResponse } from "axios";

@@ -8,0 +8,0 @@ export declare class Transactions {

import { Api } from "./lib/api";
import { CryptoInterface } from "./lib/crypto/crypto-interface";
import { JWKInterface } from "./lib/Wallet";
import { JWKInterface } from "./lib/wallet";
export declare class Wallets {

@@ -5,0 +5,0 @@ private api;

{
"name": "arweave",
"version": "1.0.0",
"version": "1.0.1",
"description": "Arweave JS client library",

@@ -37,3 +37,3 @@ "main": "index.js",

"@types/mocha": "^5.2.5",
"@types/node": "^10.12.10",
"@types/node": "^10.12.18",
"chai": "^4.2.0",

@@ -40,0 +40,0 @@ "mocha": "^5.2.0",

@@ -8,7 +8,7 @@ import { Ar } from "./ar";

import { TransactionInterface, Transaction } from "./lib/transaction";
import { JWKInterface } from "./lib/Wallet";
import { JWKInterface } from "./lib/wallet";
import { ArweaveUtils } from "./lib/utils";
interface Config<T = object>{
interface Config<T = object> {
api: ApiConfig

@@ -19,3 +19,3 @@ crypto: CryptoInterface

export class Arweave {
public api: Api;

@@ -28,10 +28,10 @@

public network: Network;
public ar: Ar;
public crypto: CryptoInterface;
public utils: ArweaveUtils;
constructor(config: Config){
constructor(config: Config) {

@@ -56,5 +56,5 @@ this.crypto = config.crypto;

public async createTransaction(attributes: Partial<TransactionInterface>, jwk: JWKInterface){
public async createTransaction(attributes: Partial<TransactionInterface>, jwk: JWKInterface) {
if ( !attributes.data && !(attributes.target && attributes.quantity) ) {
if (!attributes.data && !(attributes.target && attributes.quantity)) {
throw new Error(`A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.`);

@@ -61,0 +61,0 @@ }

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

import { JWKInterface } from "../Wallet";
import { JWKInterface } from "../wallet";

@@ -3,0 +3,0 @@ export interface CryptoInterface {

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

import { JWKInterface } from "../Wallet";
import { JWKInterface } from "../wallet";
import { CryptoInterface } from "./crypto-interface";

@@ -3,0 +3,0 @@

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

import { JWKInterface, JWKPublicInterface } from "../Wallet";
import { JWKInterface, JWKPublicInterface } from "../wallet";
import { CryptoInterface } from "./crypto-interface";

@@ -3,0 +3,0 @@

@@ -6,3 +6,3 @@ import { Api } from "./lib/api";

import { ArweaveUtils } from './lib/utils';
import { JWKInterface } from './lib/Wallet';
import { JWKInterface } from './lib/wallet';
import { Wallets } from "./wallets";

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

import { Api } from "./lib/api";
import { CryptoInterface } from "./lib/crypto/crypto-interface";
import { JWKInterface } from "./lib/Wallet";
import { JWKInterface } from "./lib/wallet";
import { ArweaveUtils } from "./lib/utils";

@@ -12,3 +12,3 @@

constructor(api: Api, crypto: CryptoInterface){
constructor(api: Api, crypto: CryptoInterface) {
this.api = api;

@@ -35,7 +35,7 @@ this.crypto = crypto;

*/
function(data): string {
return data;
}
function (data): string {
return data;
}
]
}).then( response => {
}).then(response => {
return response.data;

@@ -53,3 +53,3 @@ });

public getLastTransactionID(address: string): Promise<string> {
return this.api.get(`wallet/${address}/last_tx`).then( response => {
return this.api.get(`wallet/${address}/last_tx`).then(response => {
return response.data;

@@ -59,7 +59,7 @@ });

public generate(){
public generate() {
return this.crypto.generateJWK();
}
public async jwkToAddress(jwk: JWKInterface): Promise<string>{
public async jwkToAddress(jwk: JWKInterface): Promise<string> {
return ArweaveUtils.bufferTob64Url(await this.crypto.hash(ArweaveUtils.b64UrlToBuffer(jwk.n)));

@@ -66,0 +66,0 @@ }

import * as chai from 'chai';
import * as Arweave from "../src/node";

@@ -4,0 +3,0 @@ const expect = chai.expect;

@@ -137,2 +137,6 @@ import * as chai from 'chai';

transaction.addTag('test-tag-1', 'test-value-1');
transaction.addTag('test-tag-2', 'test-value-2');
transaction.addTag('test-tag-3', 'test-value-3');
expect(transaction).to.be.an.instanceOf(Transaction);

@@ -158,2 +162,13 @@

//@ts-ignore
// Needs ts-ignoring as tags are readonly so chaning the tag like this isn't
// normally an allowed operation, but it's a test, so...
transaction.tags[1].value = 'dGVzdDI';
const verifiedWithModififedTags = await arweave.transactions.verify(transaction)
expect(verifiedWithModififedTags).to.be.a('boolean');
expect(verifiedWithModififedTags).to.be.false;
})

@@ -160,0 +175,0 @@

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 too big to display

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