Skip to content

Commit

Permalink
Merge pull request #11 from blockchain-certificates/chore/lib
Browse files Browse the repository at this point in the history
Chore/lib
  • Loading branch information
Julien Fraichot authored Feb 4, 2021
2 parents 399b08a + 563df69 commit a38e13a
Show file tree
Hide file tree
Showing 53 changed files with 612 additions and 5,001 deletions.
19 changes: 0 additions & 19 deletions .babelrc

This file was deleted.

2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lib
node_modules
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
],
parserOptions: {
project: ['./tsconfig.json', './tsconfig.eslint.json']
project: ['./tsconfig.eslint.json']
},
rules: {
'semi': 'off',
Expand Down
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.nvmrc
.github/
.eslintrc.js
.eslintignore
tsconfig.*

.idea
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ before_script:
- npm run test
- npm run lint
script:
- npm run build
- npm run compile
after_success:
- npm run semantic-release
2,594 changes: 53 additions & 2,541 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 6 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
"name": "jsonld-signatures-merkleproof2019",
"version": "0.1.0",
"description": "A jsonld signature implementation to support MerkleProof2019 verification in Verifiable Credential context",
"main": "dist/MerkleProof2019.js",
"module": "dist/MerkleProof2019-es.js",
"typings": "dist/index.d.ts",
"main": "lib/cjs/MerkleProof2019.js",
"module": "lib/esm/MerkleProof2019.js",
"typings": "lib/index.d.ts",
"dependencies": {
"@blockcerts/explorer-lookup": "^1.0.1",
"@vaultie/lds-merkle-proof-2019": "0.0.8",
"core-js": "^3.7.0",
"jsonld": "^1.8.1",
Expand All @@ -14,13 +15,6 @@
"xmlhttprequest": "^1.8.0"
},
"devDependencies": {
"@babel/cli": "^7.12.1",
"@babel/preset-env": "^7.12.1",
"@babel/preset-typescript": "^7.12.1",
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@rollup/plugin-typescript": "^6.1.0",
"@types/jest": "^26.0.15",
"@types/sinon": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^4.6.1",
Expand All @@ -33,24 +27,18 @@
"eslint-plugin-standard": "^4.0.2",
"husky": "^4.3.0",
"jest": "^26.6.3",
"rollup": "^2.33.1",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.4.0",
"semantic-release": "^17.3.0",
"sinon": "^9.2.1",
"ts-jest": "^26.4.4",
"tslib": "^2.0.3",
"typescript": "^4.0.5"
},
"scripts": {
"copy:declaration": "cp src/index.d.ts dist/index.d.ts",
"build": "rollup -c && npm run transpile:node && npm run copy:declaration",
"copy:declaration": "cp src/index.d.ts lib/index.d.ts",
"compile": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && npm run copy:declaration",
"lint": "eslint . --ext .ts",
"test": "jest",
"test:watch": "jest --watch",
"transpile:node": "npm run transpile:node:ts && npm run clean:lib:ts",
"transpile:node:ts": "npx babel src -d lib --copy-files --extensions '.ts'",
"clean:lib:ts": "rimraf lib/\"**\"/*.ts",
"semantic-release": "semantic-release"
},
"husky": {
Expand Down
35 changes: 0 additions & 35 deletions rollup.config.js

This file was deleted.

9 changes: 4 additions & 5 deletions src/MerkleProof2019.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import { Decoder } from '@vaultie/lds-merkle-proof-2019';
import jsigs from 'jsonld-signatures';
import { lookForTx } from '@blockcerts/explorer-lookup';
import { DecodedProof, JSONLDProof } from './models/Proof';
import getTransactionId from './helpers/getTransactionId';
import isTransactionIdValid from './inspectors/isTransactionIdValid';
import lookForTx from './helpers/lookForTx';
import { ExplorerAPI } from './models/Explorers';
import { IBlockchainObject } from './constants/blockchains';
import getChain from './helpers/getChain';
import { TransactionData } from './models/TransactionData';
import computeLocalHash from './inspectors/computeLocalHash';
import ensureHashesEqual from './inspectors/ensureHashesEqual';
import ensureMerkleRootEqual from './inspectors/ensureMerkleRootEqual';
import { prepareExplorerAPIs } from './explorers';
const { LinkedDataProof } = jsigs.suites;

export interface MerkleProof2019Options {
Expand All @@ -35,7 +34,7 @@ export interface MerkleProof2019VerificationResult {
error?: string;
}

export class MerkleProof2019 extends LinkedDataProof {
export class MerkleProof2019 extends (LinkedDataProof as any) {
/**
* @param type {string} Provided by subclass.
* @param [issuer] {string} A key id URL to the paired public key.
Expand Down Expand Up @@ -130,7 +129,7 @@ export class MerkleProof2019 extends LinkedDataProof {
}

private setOptions (options: MerkleProof2019Options): void {
this.explorerAPIs = options.explorerAPIs || [];
this.explorerAPIs = options.explorerAPIs ?? [];
}

private validateTransactionId (): string {
Expand All @@ -142,7 +141,7 @@ export class MerkleProof2019 extends LinkedDataProof {
this.txData = await lookForTx({
transactionId: this.transactionId,
chain: this.chain?.code,
explorerAPIs: prepareExplorerAPIs(this.explorerAPIs)
explorerAPIs: this.explorerAPIs
});
}
}
22 changes: 0 additions & 22 deletions src/constants/config.ts

This file was deleted.

Loading

0 comments on commit a38e13a

Please sign in to comment.