diff --git a/.gitignore b/.gitignore index 896b566763..f6877dc99d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.config.json .nyc_output/ dist/ .DS_Store diff --git a/package-lock.json b/package-lock.json index f0e672c0f4..3426c0b031 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1524,6 +1524,89 @@ "requires": { "inquirer": "^6.2.0", "npmlog": "^4.1.2" + }, + "dependencies": { + "ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "inquirer": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz", + "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==", + "dev": true, + "requires": { + "ansi-escapes": "^3.2.0", + "chalk": "^2.4.2", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^2.0.0", + "lodash": "^4.17.12", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^6.4.0", + "string-width": "^2.1.0", + "strip-ansi": "^5.1.0", + "through": "^2.3.6" + } + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + } } }, "@lerna/publish": { @@ -2007,6 +2090,12 @@ "@types/node": ">= 8" } }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "dev": true + }, "@types/events": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", @@ -2358,10 +2447,21 @@ "dev": true }, "ansi-escapes": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", - "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", - "dev": true + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz", + "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==", + "dev": true, + "requires": { + "type-fest": "^0.11.0" + }, + "dependencies": { + "type-fest": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz", + "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ==", + "dev": true + } + } }, "ansi-regex": { "version": "3.0.0", @@ -3296,12 +3396,12 @@ "dev": true }, "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", "dev": true, "requires": { - "restore-cursor": "^2.0.0" + "restore-cursor": "^3.1.0" } }, "cli-width": { @@ -3453,6 +3553,12 @@ "strip-json-comments": "3.0.1" }, "dependencies": { + "ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", + "dev": true + }, "chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -3464,6 +3570,15 @@ "supports-color": "^5.3.0" } }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, "cz-conventional-changelog": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/cz-conventional-changelog/-/cz-conventional-changelog-3.0.1.tgz", @@ -3479,6 +3594,15 @@ "word-wrap": "^1.0.3" } }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, "glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", @@ -3493,18 +3617,64 @@ "path-is-absolute": "^1.0.0" } }, + "inquirer": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.0.tgz", + "integrity": "sha512-scfHejeG/lVZSpvCXpsB4j/wQNPM5JC8kiElOI0OUTwmc1RTpXr4H32/HOlQHcZiYl2z2VElwuCVDRG8vFmbnA==", + "dev": true, + "requires": { + "ansi-escapes": "^3.2.0", + "chalk": "^2.4.2", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^2.0.0", + "lodash": "^4.17.12", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^6.4.0", + "string-width": "^2.1.0", + "strip-ansi": "^5.1.0", + "through": "^2.3.6" + } + }, "lodash": { "version": "4.17.15", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, "minimist": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, "strip-bom": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", @@ -5303,9 +5473,9 @@ "dev": true }, "figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", "dev": true, "requires": { "escape-string-regexp": "^1.0.5" @@ -6591,35 +6761,124 @@ } }, "inquirer": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.0.tgz", - "integrity": "sha512-scfHejeG/lVZSpvCXpsB4j/wQNPM5JC8kiElOI0OUTwmc1RTpXr4H32/HOlQHcZiYl2z2VElwuCVDRG8vFmbnA==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.1.0.tgz", + "integrity": "sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg==", "dev": true, "requires": { - "ansi-escapes": "^3.2.0", - "chalk": "^2.4.2", - "cli-cursor": "^2.1.0", + "ansi-escapes": "^4.2.1", + "chalk": "^3.0.0", + "cli-cursor": "^3.1.0", "cli-width": "^2.0.0", "external-editor": "^3.0.3", - "figures": "^2.0.0", - "lodash": "^4.17.12", - "mute-stream": "0.0.7", - "run-async": "^2.2.0", - "rxjs": "^6.4.0", - "string-width": "^2.1.0", - "strip-ansi": "^5.1.0", + "figures": "^3.0.0", + "lodash": "^4.17.15", + "mute-stream": "0.0.8", + "run-async": "^2.4.0", + "rxjs": "^6.5.3", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", "through": "^2.3.6" }, "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true + }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" } } } @@ -7707,9 +7966,9 @@ } }, "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, "minimalistic-assert": { @@ -8513,12 +8772,12 @@ } }, "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", "dev": true, "requires": { - "mimic-fn": "^1.0.0" + "mimic-fn": "^2.1.0" } }, "opener": { @@ -9442,12 +9701,12 @@ "dev": true }, "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", "dev": true, "requires": { - "onetime": "^2.0.0", + "onetime": "^5.1.0", "signal-exit": "^3.0.2" } }, diff --git a/package.json b/package.json index 43e8693596..e6d58cf738 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "@hyperledger-labs/bif", "private": true, "scripts": { + "configure": "lerna clean --yes && lerna bootstrap && npm run build && node ./tools/generate-api-server-config.js", "tsc": "lerna exec --stream --ignore '*/*cockpit' -- tsc --project ./tsconfig.json", "clean": "lerna exec --stream --ignore '*/*cockpit' -- del-cli dist/**", "build": "npm-run-all --parallel build:frontend build:backend", @@ -39,6 +40,7 @@ "eslint-plugin-node": "9.1.0", "eslint-plugin-promise": "4.1.1", "eslint-plugin-standard": "4.0.0", + "inquirer": "7.1.0", "lerna": "3.20.2", "npm-run-all": "4.1.5", "secp256k1": "4.0.0", diff --git a/packages/bif-cmd-api-server/package-lock.json b/packages/bif-cmd-api-server/package-lock.json index 0f87850a1d..e275e324ae 100644 --- a/packages/bif-cmd-api-server/package-lock.json +++ b/packages/bif-cmd-api-server/package-lock.json @@ -1,6 +1,6 @@ { "name": "@hyperledger-labs/bif-cmd-api-server", - "version": "0.0.1", + "version": "0.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -23,6 +23,7 @@ "version": "1.19.0", "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.0.tgz", "integrity": "sha512-W98JrE0j2K78swW4ukqMleo8R7h/pFETjM2DQ90MF6XK2i4LO4W3gQ71Lt4w3bfm2EvVSyWHplECvB5sK22yFQ==", + "dev": true, "requires": { "@types/connect": "*", "@types/node": "*" @@ -32,6 +33,7 @@ "version": "3.4.33", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.33.tgz", "integrity": "sha512-2+FrkXY4zllzTNfJth7jOqEHC+enpLeGslEhpnTAkg21GkRrWV4SsAtqchtT4YS9/nODBU2/ZfsBY2X4J/dX7A==", + "dev": true, "requires": { "@types/node": "*" } @@ -39,12 +41,14 @@ "@types/convict": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/@types/convict/-/convict-4.2.1.tgz", - "integrity": "sha512-2cd51m3i0yeY1i3dKxcqJKeS5Q4jZnjP37OseoNeIX1OM0AhmGPuuYmwJ9OqtsU35YrREQxdb2VeX5sM3cwGMQ==" + "integrity": "sha512-2cd51m3i0yeY1i3dKxcqJKeS5Q4jZnjP37OseoNeIX1OM0AhmGPuuYmwJ9OqtsU35YrREQxdb2VeX5sM3cwGMQ==", + "dev": true }, "@types/cors": { "version": "2.8.6", "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.6.tgz", "integrity": "sha512-invOmosX0DqbpA+cE2yoHGUlF/blyf7nB0OGYBBiH27crcVm5NmFaZkLP4Ta1hGaesckCi5lVLlydNJCxkTOSg==", + "dev": true, "requires": { "@types/express": "*" } @@ -53,6 +57,7 @@ "version": "4.17.3", "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.3.tgz", "integrity": "sha512-I8cGRJj3pyOLs/HndoP+25vOqhqWkAZsWMEmq1qXy/b/M3ppufecUwaK2/TVDVxcV61/iSdhykUjQQ2DLSrTdg==", + "dev": true, "requires": { "@types/body-parser": "*", "@types/express-serve-static-core": "*", @@ -63,6 +68,7 @@ "version": "4.17.2", "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.2.tgz", "integrity": "sha512-El9yMpctM6tORDAiBwZVLMcxoTMcqqRO9dVyYcn7ycLWbvR8klrDn8CAOwRfZujZtWD7yS/mshTdz43jMOejbg==", + "dev": true, "requires": { "@types/node": "*", "@types/range-parser": "*" @@ -71,12 +77,14 @@ "@types/mime": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.1.tgz", - "integrity": "sha512-FwI9gX75FgVBJ7ywgnq/P7tw+/o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw==" + "integrity": "sha512-FwI9gX75FgVBJ7ywgnq/P7tw+/o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw==", + "dev": true }, "@types/multer": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/@types/multer/-/multer-1.4.2.tgz", "integrity": "sha512-pVcPwuC0FbVcLhopJHx8Ro3WSXjvVvEpJMfy+DFAL/3DwNYAQH+hf/Vq+PqoS5kM4mng7L/4upzXhP/12yWh4w==", + "dev": true, "requires": { "@types/express": "*" } @@ -84,17 +92,20 @@ "@types/node": { "version": "13.9.1", "resolved": "https://registry.npmjs.org/@types/node/-/node-13.9.1.tgz", - "integrity": "sha512-E6M6N0blf/jiZx8Q3nb0vNaswQeEyn0XlupO+xN6DtJ6r6IT4nXrTry7zhIfYvFCl3/8Cu6WIysmUBKiqV0bqQ==" + "integrity": "sha512-E6M6N0blf/jiZx8Q3nb0vNaswQeEyn0XlupO+xN6DtJ6r6IT4nXrTry7zhIfYvFCl3/8Cu6WIysmUBKiqV0bqQ==", + "dev": true }, "@types/range-parser": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.3.tgz", - "integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==" + "integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==", + "dev": true }, "@types/secp256k1": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-3.5.3.tgz", "integrity": "sha512-NGcsPDR0P+Q71O63e2ayshmiZGAwCOa/cLJzOIuhOiDvmbvrCIiVtEpqdCJGogG92Bnr6tw/6lqVBsRMEl15OQ==", + "dev": true, "requires": { "@types/node": "*" } @@ -103,11 +114,18 @@ "version": "1.13.3", "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.3.tgz", "integrity": "sha512-oprSwp094zOglVrXdlo/4bAHtKTAxX6VT8FOZlBKrmyLbNvE1zxZyJ6yikMVtHIvwP45+ZQGJn+FdXGKTozq0g==", + "dev": true, "requires": { "@types/express-serve-static-core": "*", "@types/mime": "*" } }, + "@types/uuid": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-7.0.2.tgz", + "integrity": "sha512-8Ly3zIPTnT0/8RCU6Kg/G3uTICf9sRwYOpUzSIM3503tLIKcnJPRuinHhXngJUy2MntrEf6dlpOHXJju90Qh5w==", + "dev": true + }, "accepts": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", @@ -958,6 +976,11 @@ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, + "uuid": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.2.tgz", + "integrity": "sha512-vy9V/+pKG+5ZTYKf+VcphF5Oc6EFiu3W8Nv3P3zIh0EqVI80ZxOzuPfe9EHjkFNvf8+xuTHVeei4Drydlx4zjw==" + }, "validator": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/validator/-/validator-11.1.0.tgz", diff --git a/packages/bif-cmd-api-server/package.json b/packages/bif-cmd-api-server/package.json index f4cc85f721..6b2c381d3c 100755 --- a/packages/bif-cmd-api-server/package.json +++ b/packages/bif-cmd-api-server/package.json @@ -45,22 +45,27 @@ }, "homepage": "https://github.com/hyperledger-labs/blockchain-integration-framework#readme", "dependencies": { - "@hyperledger-labs/bif-cockpit": "^0.0.1", - "@hyperledger-labs/bif-core-api": "^0.0.1", - "@hyperledger-labs/bif-plugin-kv-storage-memory": "^0.0.1", - "@types/convict": "^4.2.1", - "@types/cors": "^2.8.6", - "@types/express": "^4.17.3", - "@types/multer": "^1.4.2", - "@types/secp256k1": "^3.5.3", - "body-parser": "^1.19.0", - "convict": "^5.2.0", - "cors": "^2.8.5", + "@hyperledger-labs/bif-cockpit": "0.2.0", + "@hyperledger-labs/bif-core-api": "0.2.0", + "@hyperledger-labs/bif-plugin-keychain-memory": "0.2.0", + "@hyperledger-labs/bif-plugin-kv-storage-memory": "0.2.0", + "body-parser": "1.19.0", + "convict": "5.2.0", + "cors": "2.8.5", "express": "4.17.1", - "express-openapi-validator": "^3.10.0", - "js-sha3": "^0.8.0", - "node-fetch": "^3.0.0-beta.4", - "secp256k1": "^4.0.0", - "sha3": "^2.1.2" + "express-openapi-validator": "3.10.0", + "js-sha3": "0.8.0", + "node-fetch": "3.0.0-beta.4", + "secp256k1": "4.0.0", + "sha3": "2.1.2", + "uuid": "7.0.2" + }, + "devDependencies": { + "@types/convict": "4.2.1", + "@types/cors": "2.8.6", + "@types/express": "4.17.3", + "@types/multer": "1.4.2", + "@types/secp256k1": "3.5.3", + "@types/uuid": "7.0.2" } } diff --git a/packages/bif-cmd-api-server/src/main/typescript/config/config-service.ts b/packages/bif-cmd-api-server/src/main/typescript/config/config-service.ts index 0dcda7f828..0eff364409 100644 --- a/packages/bif-cmd-api-server/src/main/typescript/config/config-service.ts +++ b/packages/bif-cmd-api-server/src/main/typescript/config/config-service.ts @@ -1,8 +1,11 @@ -import convict, { Schema, Config } from 'convict'; +import { randomBytes } from 'crypto'; +import convict, { Schema, Config, SchemaObj } from 'convict'; import secp256k1 from 'secp256k1'; +import { v4 as uuidV4 } from 'uuid'; export interface IBifApiServerOptions { configFile: string; + bifNodeId: string; cockpitHost: string; cockpitPort: number; cockpitWwwRoot: string; @@ -11,8 +14,12 @@ export interface IBifApiServerOptions { apiCorsDomainCsv: string; storagePluginPackage: string; storagePluginOptionsJson: string; + keychainPluginPackage: string; + keychainPluginOptionsJson: string; publicKey: string; privateKey: string; + keychainSuffixPublicKey: string; + keychainSuffixPrivateKey: string; } export class ConfigService { @@ -49,6 +56,14 @@ export class ConfigService { env: 'CONFIG_FILE', arg: 'config-file', }, + bifNodeId: { + doc: 'Identifier of this particular BIF node. Must be unique among the total set of BIF nodes running in any ' + + 'given BIF deployment. Can be any string of characters such as a UUID or an Int64', + format: ConfigService.formatNonBlankString, + default: null as any, + env: 'BIF_NODE_ID', + arg: 'bif-node-id', + }, cockpitHost: { doc: 'The host to bind the Cockpit webserver to. Secure default is: 127.0.0.1. Use 0.0.0.0 to bind for any host.', format: 'ipaddress', @@ -94,13 +109,33 @@ export class ConfigService { storagePluginPackage: { doc: 'The NodeJS package name that will be dynamically imported. ' + 'You have to make sure that this is installed prior to starting the API server. ' + - 'Defaults to the in-memory storage plugin that is NOT for production use.', - format: '*', + 'Use "@hyperledger-labs/bif-plugin-kv-storage-memory" here for development' + + 'or demo environments with only a single node you can use ' + + 'the built-in stub that stores everything in-memory, un-encrypted:', + format: ConfigService.formatNonBlankString, env: 'STORAGE_PLUGIN_PACKAGE', arg: 'storage-plugin-package', - default: '@hyperledger-labs/bif-plugin-kv-storage-memory' + default: null as any }, storagePluginOptionsJson: { + doc: 'JSON string representing the options object that will be passed in to the keychain plugin during initialization.', + env: 'KEYCHAIN_PLUGIN_OPTIONS_JSON', + arg: 'keychain-plugin-options-json', + format: '*', + default: '{}' + }, + keychainPluginPackage: { + doc: 'The NodeJS package name that will be dynamically imported. ' + + 'You have to make sure that this is installed prior to starting the API server. ' + + 'Use "@hyperledger-labs/bif-plugin-keychain-memory" here for development' + + 'or demo environments with only a single node you can use ' + + 'the built-in stub that stores everything in-memory, un-encrypted:', + format: '*', + env: 'KEYCHAIN_PLUGIN_PACKAGE', + arg: 'keychain-plugin-package', + default: null as any + }, + keychainPluginOptionsJson: { doc: 'JSON string representing the options object that will be passed in to the storage plugin during initialization.', env: 'STORAGE_PLUGIN_OPTIONS_JSON', arg: 'storage-plugin-options-json', @@ -111,11 +146,7 @@ export class ConfigService { doc: 'Public key of this BIF node (the API server)', env: 'PUBLIC_KEY', arg: 'public-key', - format: (val) => { - if (typeof val === 'undefined' || val === null || val === '') { - throw new Error('must be a non-empty string'); - } - }, + format: ConfigService.formatNonBlankString, default: null as any, }, privateKey: { @@ -123,16 +154,67 @@ export class ConfigService { doc: 'Private key of this BIF node (the API server)', env: 'PRIVATE_KEY', arg: 'private-key', - format: (val) => { - if (typeof val === 'undefined' || val === null || val === '') { - throw new Error('must be a non-empty string'); - } - }, + format: ConfigService.formatNonBlankString, default: null as any, + }, + keychainSuffixPrivateKey: { + doc: 'The key under which to store/retrieve the private key from the keychain of this BIF node (API server)' + + 'The complete lookup key is constructed from the ${BIF_NODE_ID}${KEYCHAIN_SUFFIX_PRIVATE_KEY} template.', + env: 'KEYCHAIN_SUFFIX_PRIVATE_KEY', + arg: 'keychain-suffix-private-key', + format: '*', + default: 'BIF_NODE_PRIVATE_KEY', + }, + keychainSuffixPublicKey: { + doc: 'The key under which to store/retrieve the public key from the keychain of this BIF node (API server)' + + 'The complete lookup key is constructed from the ${BIF_NODE_ID}${KEYCHAIN_SUFFIX_PRIVATE_KEY} template.', + env: 'KEYCHAIN_SUFFIX_PUBLIC_KEY', + arg: 'keychain-suffix-public-key', + format: '*', + default: 'BIF_NODE_PUBLIC_KEY', } }; } + private static formatNonBlankString(value: unknown) { + if (typeof value === 'undefined' || value === null || value === '') { + throw new Error('must be a non-empty string'); + } + } + + generateExampleConfig(): IBifApiServerOptions { + const schema = ConfigService.getConfigSchema(); + + // FIXME most of this lowever level crypto code should be in a commons package that's universal + let privateKeyBytes + do { + privateKeyBytes = randomBytes(32) + } while (!secp256k1.privateKeyVerify(privateKeyBytes)); + + const publicKeyBytes = secp256k1.publicKeyCreate(privateKeyBytes); + const privateKey = Buffer.from(privateKeyBytes).toString('hex'); + const publicKey = Buffer.from(publicKeyBytes).toString('hex'); + + return { + configFile: '.config.json', + bifNodeId: uuidV4(), + publicKey, + privateKey, + apiCorsDomainCsv: (schema.apiCorsDomainCsv as SchemaObj).default, + apiHost: (schema.apiHost as SchemaObj).default, + apiPort: (schema.apiPort as SchemaObj).default, + cockpitHost: (schema.cockpitHost as SchemaObj).default, + cockpitPort: (schema.cockpitPort as SchemaObj).default, + cockpitWwwRoot: (schema.cockpitWwwRoot as SchemaObj).default, + keychainPluginPackage: '@hyperledger-labs/bif-plugin-keychain-memory', + keychainPluginOptionsJson: (schema.keychainPluginOptionsJson as SchemaObj).default, + keychainSuffixPublicKey: (schema.keychainSuffixPublicKey as SchemaObj).default, + keychainSuffixPrivateKey: (schema.keychainSuffixPrivateKey as SchemaObj).default, + storagePluginPackage: '@hyperledger-labs/bif-plugin-kv-storage-memory', + storagePluginOptionsJson: (schema.storagePluginOptionsJson as SchemaObj).default, + }; + } + getOrCreate(): Config { if (!ConfigService.config) { const schema: Schema = ConfigService.getConfigSchema(); @@ -142,15 +224,27 @@ export class ConfigService { ConfigService.config.loadFile(configFilePath); } ConfigService.config.validate(); - const privateKey = ConfigService.config.get('privateKey'); - const privateKeyBytes = Uint8Array.from(Buffer.from(privateKey, 'hex')); - const publicKey = ConfigService.config.get('publicKey'); - const expectedPublicKeyBytes = secp256k1.publicKeyCreate(privateKeyBytes); - const expectedPublicKey = Buffer.from(expectedPublicKeyBytes).toString('hex'); - if (publicKey !== expectedPublicKey) { - throw new Error(`Public key does not match private key. Configured=${publicKey} Expected=${expectedPublicKey}`); - } + this.validateKeyPairMatch(); } return ConfigService.config; } + + /** + * Validation that prevents operators from mistakenly deploying a public key + * that they may not have the private key for or vica versa. + * + * @throws If the private key and the public key are not part of the same key pair. + */ + validateKeyPairMatch(): void { + // FIXME most of this lowever level crypto code should be in a commons package that's universal + const privateKey = ConfigService.config.get('privateKey'); + const privateKeyBytes = Uint8Array.from(Buffer.from(privateKey, 'hex')); + const publicKey = ConfigService.config.get('publicKey'); + const expectedPublicKeyBytes = secp256k1.publicKeyCreate(privateKeyBytes); + const expectedPublicKey = Buffer.from(expectedPublicKeyBytes).toString('hex'); + if (publicKey !== expectedPublicKey) { + throw new Error(`Public key does not match private key. Configured=${publicKey} Expected=${expectedPublicKey}`); + } + } + } \ No newline at end of file diff --git a/packages/bif-cockpit/package-lock.json b/packages/bif-cockpit/package-lock.json index ad3058b47c..ac9346c232 100644 --- a/packages/bif-cockpit/package-lock.json +++ b/packages/bif-cockpit/package-lock.json @@ -1,6 +1,6 @@ { "name": "@hyperledger-labs/bif-cockpit", - "version": "0.0.1", + "version": "0.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/bif-core-api/src/main/typescript/plugin/keychain/i-plugin-keychain.ts b/packages/bif-core-api/src/main/typescript/plugin/keychain/i-plugin-keychain.ts new file mode 100644 index 0000000000..ac8d2c94b8 --- /dev/null +++ b/packages/bif-core-api/src/main/typescript/plugin/keychain/i-plugin-keychain.ts @@ -0,0 +1,6 @@ +import { IPluginKVStorage } from "../storage/key-value/i-plugin-kv-storage"; + +export interface IPluginKeychain extends IPluginKVStorage { + rotateEncryptionKeys(): Promise; + getEncryptionAlgorithm(): string; +} diff --git a/packages/bif-core-api/src/main/typescript/public-api.ts b/packages/bif-core-api/src/main/typescript/public-api.ts index b7b8523801..256aa41f8b 100755 --- a/packages/bif-core-api/src/main/typescript/public-api.ts +++ b/packages/bif-core-api/src/main/typescript/public-api.ts @@ -1,2 +1,3 @@ export { IPluginKVStorage } from './plugin/storage/key-value/i-plugin-kv-storage'; +export { IPluginKeychain } from './plugin/keychain/i-plugin-keychain'; export { PluginFactory } from './plugin/plugin-factory'; diff --git a/packages/bif-plugin-keychain-memory/README.md b/packages/bif-plugin-keychain-memory/README.md new file mode 100644 index 0000000000..e13d205cca --- /dev/null +++ b/packages/bif-plugin-keychain-memory/README.md @@ -0,0 +1,9 @@ +# `@hyperledger-labs/bif-plugin-keychain-memory` + +> TODO: description + +## Usage + +``` +// TODO: DEMONSTRATE API +``` diff --git a/packages/bif-plugin-keychain-memory/package.json b/packages/bif-plugin-keychain-memory/package.json new file mode 100644 index 0000000000..0279c9029d --- /dev/null +++ b/packages/bif-plugin-keychain-memory/package.json @@ -0,0 +1,51 @@ +{ + "name": "@hyperledger-labs/bif-plugin-keychain-memory", + "version": "0.2.0", + "description": "Dummy keychain implementation doing NO encryption and storing everything in-memory. Only suitable for development and testing.", + "main": "dist/bif-plugin-kv-storage-memory.node.umd.js", + "mainMinified": "dist/bif-plugin-kv-storage-memory.node.umd.min.js", + "browser": "dist/bif-plugin-kv-storage-memory.web.umd.js", + "browserMinified": "dist/bif-plugin-kv-storage-memory.web.umd.min.js", + "module": "dist/lib/main/typescript/index.js", + "types": "dist/types/main/typescript/index.d.ts", + "files": [ + "dist/*" + ], + "publishConfig": { + "access": "public" + }, + "engines": { + "node": ">=10", + "npm": ">=6" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/hyperledger-labs/blockchain-integration-framework.git" + }, + "keywords": [ + "Hyperledger", + "Blockchain", + "Interoperability", + "Integration" + ], + "author": { + "name": "Peter Somogyvari", + "email": "peter.somogyvari@accenture.com", + "url": "https://accenture.com" + }, + "contributors": [ + { + "name": "Please add yourself to the list of contributors", + "email": "your.name@example.com", + "url": "https://example.com" + } + ], + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/hyperledger-labs/blockchain-integration-framework/issues" + }, + "homepage": "https://github.com/hyperledger-labs/blockchain-integration-framework#readme", + "dependencies": { + "@hyperledger-labs/bif-core-api": "^0.2.0" + } +} diff --git a/packages/bif-plugin-keychain-memory/src/main/typescript/index.ts b/packages/bif-plugin-keychain-memory/src/main/typescript/index.ts new file mode 100755 index 0000000000..7e1a213e3e --- /dev/null +++ b/packages/bif-plugin-keychain-memory/src/main/typescript/index.ts @@ -0,0 +1 @@ +export * from './public-api'; diff --git a/packages/bif-plugin-keychain-memory/src/main/typescript/plugin-factory-keychain.ts b/packages/bif-plugin-keychain-memory/src/main/typescript/plugin-factory-keychain.ts new file mode 100644 index 0000000000..2086b53fa8 --- /dev/null +++ b/packages/bif-plugin-keychain-memory/src/main/typescript/plugin-factory-keychain.ts @@ -0,0 +1,10 @@ +import { PluginFactory } from '@hyperledger-labs/bif-core-api'; +import { IPluginKeychainOptions, PluginKeychainMemory } from './plugin-keychain-memory'; + +export class PluginFactoryKeychain extends PluginFactory { + + async create(options: IPluginKeychainOptions = { backend: new Map() }): Promise { + return new PluginKeychainMemory(options); + } + +} diff --git a/packages/bif-plugin-keychain-memory/src/main/typescript/plugin-keychain-memory.ts b/packages/bif-plugin-keychain-memory/src/main/typescript/plugin-keychain-memory.ts new file mode 100644 index 0000000000..f3d41d8491 --- /dev/null +++ b/packages/bif-plugin-keychain-memory/src/main/typescript/plugin-keychain-memory.ts @@ -0,0 +1,40 @@ +import { IPluginKeychain } from '@hyperledger-labs/bif-core-api'; + +export interface IPluginKeychainOptions { + backend: Map; +} + +export class PluginKeychainMemory implements IPluginKeychain { + constructor(public readonly options: IPluginKeychainOptions) { + if (!options) { + throw new Error(`PluginKeychainMemory#ctor options falsy.`); + } + if (!options.backend) { + options.backend = new Map(); + } + } + + async rotateEncryptionKeys(): Promise { + throw new Error("Method not implemented."); + } + + public getEncryptionAlgorithm(): string { + return 'no-encryption-used-by-this-plugin'; + } + + async get(key: string): Promise { + return this.options.backend.get(key); + } + + async has(key: string): Promise { + return this.options.backend.has(key); + } + + async set(key: string, value: T): Promise { + this.options.backend.set(key, value); + } + + async delete(key: string): Promise { + this.options.backend.delete(key); + } +} diff --git a/packages/bif-plugin-keychain-memory/src/main/typescript/public-api.ts b/packages/bif-plugin-keychain-memory/src/main/typescript/public-api.ts new file mode 100755 index 0000000000..b3c1a4e00a --- /dev/null +++ b/packages/bif-plugin-keychain-memory/src/main/typescript/public-api.ts @@ -0,0 +1,2 @@ +export { PluginKeychainMemory } from './plugin-keychain-memory'; +export { PluginFactoryKeychain } from './plugin-factory-keychain'; diff --git a/packages/bif-plugin-keychain-memory/src/test/typescript/integration/api-surface.ts b/packages/bif-plugin-keychain-memory/src/test/typescript/integration/api-surface.ts new file mode 100644 index 0000000000..4177a23aa0 --- /dev/null +++ b/packages/bif-plugin-keychain-memory/src/test/typescript/integration/api-surface.ts @@ -0,0 +1,10 @@ +// tslint:disable-next-line: no-var-requires +const tap = require('tap'); +import { PluginKeychainMemory } from '../../../main/typescript/public-api'; + +tap.pass('Test file can be executed'); + +tap.test('Library can be loaded', (assert: any) => { + assert.plan(1); + assert.ok(PluginKeychainMemory); +}); diff --git a/packages/bif-plugin-keychain-memory/src/test/typescript/integration/tap-parallel-not-ok b/packages/bif-plugin-keychain-memory/src/test/typescript/integration/tap-parallel-not-ok new file mode 100755 index 0000000000..e69de29bb2 diff --git a/packages/bif-plugin-keychain-memory/src/test/typescript/unit/api-surface.ts b/packages/bif-plugin-keychain-memory/src/test/typescript/unit/api-surface.ts new file mode 100644 index 0000000000..361ff18896 --- /dev/null +++ b/packages/bif-plugin-keychain-memory/src/test/typescript/unit/api-surface.ts @@ -0,0 +1,10 @@ +// tslint:disable-next-line: no-var-requires +const tap = require('tap'); +import * as publicApi from '../../../main/typescript/public-api'; + +tap.pass('Test file can be executed'); + +tap.test('Library can be loaded', (assert: any) => { + assert.plan(1); + assert.ok(publicApi); +}); diff --git a/packages/bif-plugin-keychain-memory/tsconfig.json b/packages/bif-plugin-keychain-memory/tsconfig.json new file mode 100644 index 0000000000..d90c929ef9 --- /dev/null +++ b/packages/bif-plugin-keychain-memory/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "./dist/lib/", /* Redirect output structure to the directory. */ + "declarationDir": "dist/types", + }, + "include": [ + "./src" + ] +} \ No newline at end of file diff --git a/packages/bif-plugin-kv-storage-memory/package.json b/packages/bif-plugin-kv-storage-memory/package.json index 64ef82f9b0..6045510ec5 100755 --- a/packages/bif-plugin-kv-storage-memory/package.json +++ b/packages/bif-plugin-kv-storage-memory/package.json @@ -43,6 +43,6 @@ }, "homepage": "https://github.com/hyperledger-labs/blockchain-integration-framework#readme", "dependencies": { - "@hyperledger-labs/bif-core-api": "^0.0.1" + "@hyperledger-labs/bif-core-api": "^0.2.0" } } diff --git a/tools/generate-api-server-config.js b/tools/generate-api-server-config.js new file mode 100644 index 0000000000..9c73e89dc9 --- /dev/null +++ b/tools/generate-api-server-config.js @@ -0,0 +1,39 @@ +const fs = require('fs'); +const inquirer = require('inquirer'); +const { ConfigService } = require('../packages/bif-cmd-api-server/dist/lib/main/typescript/config/config-service'); + +const main = async () => { + const configService = new ConfigService(); + const config = configService.generateExampleConfig(); + const configJson = JSON.stringify(config, null, 4).concat('\n'); + + if (fs.existsSync(config.configFile)) { + const answers = await inquirer.prompt([ + { + name: 'overwritePreviousConfig', + type: 'confirm', + message: `Configuration file ${config.configFile} already exists. Overwrite it? (No)`, + default: false + } + ]); + if (answers.overwritePreviousConfig) { + fs.writeFileSync(config.configFile, configJson); + console.log(`Written generated config to: ${config.configFile}`); + } else { + console.log(`You opted to not overwrite the previous configuration file at ${config.configFile}, skipping...`); + } + } else { + fs.writeFileSync(config.configFile, configJson); + console.log(`Written generated config to: ${config.configFile}`); + } + const apiServerCmd = `node ./packages/bif-cmd-api-server/dist/lib/main/typescript/cmd/bif-api.js --config-file=${config.configFile}`; + console.log(`You can start the BIF API server with ${config.configFile} by executing this from the project root:`); + console.log(apiServerCmd); +}; + +main() + .then(() => process.exit(0)) + .catch((ex) => { + console.error(ex); + process.exit(1); + });