diff --git a/package-lock.json b/package-lock.json index 08bc0b9..e6ef00c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -70,9 +70,9 @@ } }, "@hapi/address": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.2.tgz", - "integrity": "sha512-O4QDrx+JoGKZc6aN64L04vqa7e41tIiLU+OvKdcYaEMP97UttL0f9GIi9/0A4WAMx0uBd6SidDIhktZhgOcN8Q==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", + "integrity": "sha512-QD1PhQk+s31P1ixsX0H0Suoupp3VMXzIVMSwobR3F3MSUO2YCV0B7xqLcUw/Bh8yuvd3LhpyqLQWTNcRmp6IdQ==", "dev": true }, "@hapi/ammo": { @@ -533,9 +533,9 @@ } }, "@types/node": { - "version": "12.12.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.6.tgz", - "integrity": "sha512-FjsYUPzEJdGXjwKqSpE0/9QEh6kzhTAeObA54rn6j3rR4C/mzpI9L0KNfoeASSPMMdxIsoJuCLDWcM/rVjIsSA==", + "version": "12.12.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.11.tgz", + "integrity": "sha512-O+x6uIpa6oMNTkPuHDa9MhMMehlxLAd5QcOvKRjAFsBVpeFWTOPnXbDvILvFgFFZfQ1xh1EZi1FbXxUix+zpsQ==", "dev": true }, "abort-controller": { @@ -2586,9 +2586,9 @@ "dev": true }, "des.js": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", - "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", + "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", "dev": true, "requires": { "inherits": "^2.0.1", @@ -2979,9 +2979,9 @@ } }, "es-to-primitive": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", - "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", "dev": true, "requires": { "is-callable": "^1.1.4", @@ -3066,12 +3066,6 @@ "dev": true } } - }, - "strip-json-comments": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", - "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", - "dev": true } } }, @@ -3462,14 +3456,14 @@ } }, "ethereumjs-block": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/ethereumjs-block/-/ethereumjs-block-2.2.0.tgz", - "integrity": "sha512-Ye+uG/L2wrp364Zihdlr/GfC3ft+zG8PdHcRtsBFNNH1CkOhxOwdB8friBU85n89uRZ9eIMAywCq0F4CwT1wAw==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ethereumjs-block/-/ethereumjs-block-2.2.1.tgz", + "integrity": "sha512-ze8I1844m5oKZL7hiHuezRcPzqdi4Iv0ssqQyuRaJ9Je0/YCYfXobJHvNLnex2ETgs5JypicdtLYrCNWdgcLvg==", "dev": true, "requires": { "async": "^2.0.1", "ethereumjs-common": "^1.1.0", - "ethereumjs-tx": "^1.2.2", + "ethereumjs-tx": "^2.1.1", "ethereumjs-util": "^5.0.0", "merkle-patricia-tree": "^2.1.2" }, @@ -3498,6 +3492,33 @@ "abstract-leveldown": "~2.6.0" } }, + "ethereumjs-tx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ethereumjs-tx/-/ethereumjs-tx-2.1.1.tgz", + "integrity": "sha512-QtVriNqowCFA19X9BCRPMgdVNJ0/gMBS91TQb1DfrhsbR748g4STwxZptFAwfqehMyrF8rDwB23w87PQwru0wA==", + "dev": true, + "requires": { + "ethereumjs-common": "^1.3.1", + "ethereumjs-util": "^6.0.0" + }, + "dependencies": { + "ethereumjs-util": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.0.tgz", + "integrity": "sha512-vb0XN9J2QGdZGIEKG2vXM+kUdEivUfU6Wmi5y0cg+LRhDYKnXIZ/Lz7XjFbHRR9VIKq2lVGLzGBkA++y2nOdOQ==", + "dev": true, + "requires": { + "@types/bn.js": "^4.11.3", + "bn.js": "^4.11.0", + "create-hash": "^1.1.2", + "ethjs-util": "0.1.6", + "keccak": "^2.0.0", + "rlp": "^2.2.3", + "secp256k1": "^3.0.1" + } + } + } + }, "ethereumjs-util": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz", @@ -3511,6 +3532,20 @@ "rlp": "^2.0.0", "safe-buffer": "^5.1.1", "secp256k1": "^3.0.1" + }, + "dependencies": { + "keccak": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", + "integrity": "sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw==", + "dev": true, + "requires": { + "bindings": "^1.2.1", + "inherits": "^2.0.3", + "nan": "^2.2.1", + "safe-buffer": "^5.1.0" + } + } } }, "isarray": { @@ -3519,18 +3554,6 @@ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", "dev": true }, - "keccak": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", - "integrity": "sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw==", - "dev": true, - "requires": { - "bindings": "^1.2.1", - "inherits": "^2.0.3", - "nan": "^2.2.1", - "safe-buffer": "^5.1.0" - } - }, "level-codec": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/level-codec/-/level-codec-7.0.1.tgz", @@ -3756,9 +3779,9 @@ }, "dependencies": { "@types/node": { - "version": "10.17.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.4.tgz", - "integrity": "sha512-F2pgg+LcIr/elguz+x+fdBX5KeZXGUOp7TV8M0TVIrDezYLFRNt8oMTyps0VQ1kj5WGGoR18RdxnRDHXrIFHMQ==", + "version": "10.17.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.5.tgz", + "integrity": "sha512-RElZIr/7JreF1eY6oD5RF3kpmdcreuQPjg5ri4oQ5g9sq7YWU8HkfB3eH8GwAwxf5OaCh0VPi7r4N/yoTGelrA==", "dev": true }, "bn.js": { @@ -3978,12 +4001,6 @@ "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", "dev": true }, - "fast-future": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/fast-future/-/fast-future-1.0.2.tgz", - "integrity": "sha1-hDWpqqAteSSNF9cE52JZMB2ZKAo=", - "dev": true - }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", @@ -4141,15 +4158,6 @@ "integrity": "sha1-kV4tbQI8Q9UiStn20qPEFW9XEvU=", "dev": true }, - "for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "dev": true, - "requires": { - "is-callable": "^1.1.3" - } - }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -5843,9 +5851,9 @@ "dev": true }, "has-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", "dev": true }, "has-to-string-tag-x": { @@ -6103,9 +6111,9 @@ "dev": true }, "import-fresh": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.1.0.tgz", - "integrity": "sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", "dev": true, "requires": { "parent-module": "^1.0.0", @@ -6611,16 +6619,16 @@ } }, "ipfs-log": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/ipfs-log/-/ipfs-log-4.3.6.tgz", - "integrity": "sha512-7lEW5tXITcmHHP9dT93mRI+burUm2WdEkjYQ+ERFSL3K9xH5aXMr96IQKnZpFoA6duIwquydlDsiYTXLh6g/Ag==", + "version": "github:orbitdb/ipfs-log#eb2d8f333a56090654938b77468b4d40692298fc", + "from": "github:orbitdb/ipfs-log#feat/identities", "dev": true, "requires": { "cids": "~0.7.1", "ipld-dag-pb": "^0.17.4", "json-stringify-deterministic": "^1.0.1", - "orbit-db-identity-provider": "~0.1.0", - "orbit-db-io": "~0.1.0", + "multihashing-async": "^0.7.0", + "orbit-db-identity-provider": "github:orbitdb/orbit-db-identity-provider#feat/keystore", + "orbit-db-io": "~0.1.1", "p-each-series": "^2.1.0", "p-map": "^1.1.1", "p-whilst": "^1.0.0" @@ -7303,6 +7311,12 @@ "integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg=", "dev": true }, + "is-node": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-node/-/is-node-1.0.2.tgz", + "integrity": "sha1-19ACdF733ru3R36YiVarCk/MtlM=", + "dev": true + }, "is-npm": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-3.0.0.tgz", @@ -7515,6 +7529,12 @@ "integrity": "sha512-TfzJd2JaJ/lg/gU+q5j9rLAjnfUNF9DUmXTP9w+GfmG79LjFOXFeM7hIFuXCBcZCivUDFwd9l1btTV9rhHumtQ==", "dev": true }, + "joycon": { + "version": "2.2.5", + "resolved": "https://registry.npmjs.org/joycon/-/joycon-2.2.5.tgz", + "integrity": "sha512-YqvUxoOcVPnCp0VU1/56f+iKSdvIRJYPznH22BdXV3xMk75SFXhWeJkZ8C9XxUWt1b5x2X1SxuFygW1U0FmkEQ==", + "dev": true + }, "js-sha3": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", @@ -9001,20 +9021,12 @@ "dev": true }, "mime-types": { - "version": "2.1.24", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", - "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", + "version": "2.1.25", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.25.tgz", + "integrity": "sha512-5KhStqB5xpTAeGqKBAMgwaYMnQik7teQN4IAzC7npDv6kzeU6prfkR67bc87J1kWMPGkoaZSq1npmexMgkmEVg==", "dev": true, "requires": { - "mime-db": "1.40.0" - }, - "dependencies": { - "mime-db": { - "version": "1.40.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", - "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==", - "dev": true - } + "mime-db": "1.42.0" } }, "mimic-fn": { @@ -9356,9 +9368,9 @@ "dev": true }, "nanoid": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.6.tgz", - "integrity": "sha512-2NDzpiuEy3+H0AVtdt8LoFi7PnqkOnIzYmJQp7xsEU6VexLluHQwKREuiz57XaQC5006seIadPrIZJhyS2n7aw==", + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.7.tgz", + "integrity": "sha512-fmS3qwDldm4bE01HCIRqNk+f255CNjnAoeV3Zzzv0KemObHKqYgirVaZA9DtKcjogicWjYcHkJs4D5A8CjnuVQ==", "dev": true }, "napi-macros": { @@ -9531,9 +9543,9 @@ "dev": true }, "object-inspect": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz", - "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", + "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", "dev": true }, "object-keys": { @@ -9683,62 +9695,62 @@ "dev": true }, "orbit-db": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/orbit-db/-/orbit-db-0.21.5.tgz", - "integrity": "sha512-DrEQfpisxS4v4bZnJw4bVelKftxYqyET8fVXTtD9iGWKuMUQjKQeYbtQSrwMaAqGPLXQsLdX1vAvo0/1LtaiLg==", + "version": "github:orbitdb/orbit-db#c4eb7a29f621f819258c774781fded88392b7825", + "from": "github:orbitdb/orbit-db#feat/identities", "dev": true, "requires": { "cids": "^0.7.1", "ipfs-pubsub-1on1": "~0.0.4", + "is-node": "^1.0.2", "localstorage-down": "^0.6.7", "logplease": "^1.2.14", "multihashes": "^0.4.12", - "orbit-db-access-controllers": "~0.2.0", - "orbit-db-cache": "~0.2.4", - "orbit-db-counterstore": "~1.5.0", - "orbit-db-docstore": "~1.5.0", - "orbit-db-eventstore": "~1.5.0", - "orbit-db-feedstore": "~1.5.0", - "orbit-db-identity-provider": "~0.1.0", - "orbit-db-io": "~0.1.0", - "orbit-db-keystore": "^0.2.1", - "orbit-db-kvstore": "~1.5.0", + "orbit-db-access-controllers": "github:orbitdb/orbit-db-access-controllers#feat/rm-provider", + "orbit-db-cache": "^0.3.0-rc4", + "orbit-db-counterstore": "github:orbitdb/orbit-db-counterstore#feat/identities", + "orbit-db-docstore": "github:orbitdb/orbit-db-docstore#feat/identities", + "orbit-db-eventstore": "github:orbitdb/orbit-db-eventstore#feat/identities", + "orbit-db-feedstore": "github:orbitdb/orbit-db-feedstore#feat/identities", + "orbit-db-identity-provider": "github:orbitdb/orbit-db-identity-provider#feat/keystore", + "orbit-db-io": "^0.1.1", + "orbit-db-keystore": "^0.3.0-rc3", + "orbit-db-kvstore": "github:orbitdb/orbit-db-kvstore#feat/identities", "orbit-db-pubsub": "~0.5.5", - "orbit-db-store": "~2.6.0" - } - }, - "orbit-db-access-controllers": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/orbit-db-access-controllers/-/orbit-db-access-controllers-0.2.3.tgz", - "integrity": "sha512-dP7eYdyzvfV0qQvAxhLiTHaBMqSfCtLOQG24NE6OzZiMXY+nxpgs5QCeQLD87CSL4jmYP24B+W/SDR3Jz1VP2Q==", - "dev": true, - "requires": { - "orbit-db-io": "~0.1.0", - "p-map-series": "^1.0.0" - } - }, - "orbit-db-cache": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/orbit-db-cache/-/orbit-db-cache-0.2.5.tgz", - "integrity": "sha512-e6/jsBk02AMwi4+c02mt5W7oI/GUMdpZhRORcOrnq4QWs5gbP1PkiXcji9IhWakXpMUfuqodldj1nqrBQjPF3Q==", - "dev": true, - "requires": { - "level-js": "~4.0.1", - "leveldown": "~5.0.3", - "logplease": "~1.2.15", - "mkdirp": "^0.5.1" + "orbit-db-storage-adapter": "^0.5.3", + "orbit-db-store": "github:orbitdb/orbit-db-store#feat/identities" }, "dependencies": { + "deferred-leveldown": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.1.0.tgz", + "integrity": "sha512-PvDY+BT2ONu2XVRgxHb77hYelLtMYxKSGuWuJJdVRXh9ntqx9GYTFJno/SKAz5xcd+yjQwyQeIZrUPjPvA52mg==", + "dev": true, + "requires": { + "abstract-leveldown": "~6.0.0", + "inherits": "^2.0.3" + } + }, "leveldown": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-5.0.3.tgz", - "integrity": "sha512-isfWtOQIXbGbQRI8nmU9FqCZM0klmqTAOFi0vF6G/D0O1ZgxLrSh6Xd4Zj9iVQfGt6+8jpYwkRbN07VLrxRM8w==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-5.1.1.tgz", + "integrity": "sha512-4n2R/vEA/sssh5TKtFwM9gshW2tirNoURLqekLRUUzuF+eUBLFAufO8UW7bz8lBbG2jw8tQDF3LC+LcUCc12kg==", "dev": true, "requires": { "abstract-leveldown": "~6.0.3", - "fast-future": "~1.0.2", "napi-macros": "~1.8.1", - "node-gyp-build": "~3.8.0" + "node-gyp-build": "~4.1.0" + } + }, + "levelup": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/levelup/-/levelup-4.1.0.tgz", + "integrity": "sha512-+Qhe2/jb5affN7BeFgWUUWVdYoGXO2nFS3QLEZKZynnQyP9xqA+7wgOz3fD8SST2UKpHQuZgjyJjTcB2nMl2dQ==", + "dev": true, + "requires": { + "deferred-leveldown": "~5.1.0", + "level-errors": "~2.0.0", + "level-iterator-stream": "~4.0.0", + "xtend": "~4.0.0" } }, "napi-macros": { @@ -9747,31 +9759,58 @@ "integrity": "sha512-Tr0DNY4RzTaBG2W2m3l7ZtFuJChTH6VZhXVhkGGjF/4cZTt+i8GcM9ozD+30Lmr4mDoZ5Xx34t2o4GJqYWDGcg==", "dev": true }, - "node-gyp-build": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-3.8.0.tgz", - "integrity": "sha512-bYbpIHyRqZ7sVWXxGpz8QIRug5JZc/hzZH4GbdT9HTZi6WmKCZ8GLvP8OZ9TTiIBvwPFKgtGrlWQSXDAvYdsPw==", - "dev": true + "orbit-db-keystore": { + "version": "0.3.0-rc3", + "resolved": "https://registry.npmjs.org/orbit-db-keystore/-/orbit-db-keystore-0.3.0-rc3.tgz", + "integrity": "sha512-VLsB8hy9wofVQ1rZXwKAg0PTD0JjV6IQIGjyopYgvr9jiSddLHCVlqkIduDhuHd+0TPy/2NFNXNDAvKtthOHrQ==", + "dev": true, + "requires": { + "elliptic": "^6.4.1", + "level-js": "~4.0.1", + "leveldown": "~5.1.1", + "levelup": "~4.1.0", + "libp2p-crypto": "^0.16.0", + "libp2p-crypto-secp256k1": "^0.3.0", + "lru": "^3.1.0", + "mkdirp": "^0.5.1", + "safe-buffer": "^5.1.2" + } } } }, + "orbit-db-access-controllers": { + "version": "github:orbitdb/orbit-db-access-controllers#f5c18f6b3d6a35f0ffb4a6c8615b9b98fc86ed46", + "from": "github:orbitdb/orbit-db-access-controllers#feat/rm-provider", + "dev": true, + "requires": { + "orbit-db-io": "~0.1.0", + "p-map-series": "^1.0.0" + } + }, + "orbit-db-cache": { + "version": "0.3.0-rc4", + "resolved": "https://registry.npmjs.org/orbit-db-cache/-/orbit-db-cache-0.3.0-rc4.tgz", + "integrity": "sha512-tLsEhCr6SNSzxRQcaD/uJaMutDBTBGKpesIM9+wWhmz3/TBL7zBVYZVZOBleYNsxK0tJNZQN9O4AEeNDflKz/A==", + "dev": true, + "requires": { + "logplease": "~1.2.15" + } + }, "orbit-db-counterstore": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/orbit-db-counterstore/-/orbit-db-counterstore-1.5.2.tgz", - "integrity": "sha512-TlzifqqsBk6sA5SsDpXVhsq4TC8YUQ/Pr9+osUxxKcfR17X1oEWGUgpRUNhT9LnZklPe9orvuEb0gk+Y3EsNdw==", + "version": "github:orbitdb/orbit-db-counterstore#c27d05871082a6381d566bb3e152e5605afe2c08", + "from": "github:orbitdb/orbit-db-counterstore#feat/identities", "dev": true, "requires": { "crdts": "~0.1.2", - "orbit-db-store": "~2.6.0" + "orbit-db-store": "github:orbitdb/orbit-db-store#feat/identities" } }, "orbit-db-docstore": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/orbit-db-docstore/-/orbit-db-docstore-1.5.1.tgz", - "integrity": "sha512-HzV93dJ6r5K0+elEXam31ZWxz2z6Gvil8jwCM27wceZbqrnjibzkCavIflknsosgA49o0y7ZbL6F1Z9JwI7PCQ==", + "version": "github:orbitdb/orbit-db-docstore#710c4e332436e0c9dcc21bf5d56ac0184acdc6f5", + "from": "github:orbitdb/orbit-db-docstore#feat/identities", "dev": true, "requires": { - "orbit-db-store": "~2.6.0", + "orbit-db-store": "github:orbitdb/orbit-db-store#feat/identities", "p-map": "~1.1.1" }, "dependencies": { @@ -9784,31 +9823,86 @@ } }, "orbit-db-eventstore": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/orbit-db-eventstore/-/orbit-db-eventstore-1.5.1.tgz", - "integrity": "sha512-ZPRe9jXaf7P5QcJWEJKOZi5WRDt4K62pbTk1wdoQPvZ9xJiB/dUaA7M0Twq4qosv2SfbKVCClUbTzqzreLqIeA==", + "version": "github:orbitdb/orbit-db-eventstore#a61e32599f26ace8b5b22c50bd3523a45ffce441", + "from": "github:orbitdb/orbit-db-eventstore#feat/identities", "dev": true, "requires": { - "orbit-db-store": "~2.6.0" + "orbit-db-store": "github:orbitdb/orbit-db-store#feat/identities" } }, "orbit-db-feedstore": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/orbit-db-feedstore/-/orbit-db-feedstore-1.5.1.tgz", - "integrity": "sha512-o9XYcrhb0+Cx+QgF4W9gynYUTDFLvJA/r94VJM9O1g53Aw9pA/106TGlX/1bo7oUpFFlIjDIWfawRPSWgw9yqw==", + "version": "github:orbitdb/orbit-db-feedstore#76783f444fc51a7bf14e8c4a77726b1ab8a19632", + "from": "github:orbitdb/orbit-db-feedstore#feat/identities", "dev": true, "requires": { - "orbit-db-eventstore": "~1.5.0" + "orbit-db-eventstore": "github:orbitdb/orbit-db-eventstore#feat/identities" } }, "orbit-db-identity-provider": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/orbit-db-identity-provider/-/orbit-db-identity-provider-0.1.7.tgz", - "integrity": "sha512-4V/RyLN3uXxzfYBhizcIy2NQmeOXpxx6l65PkExFs2reeULHgxuenbbTLxBOvP0nOnEE9L4U6JjNrJkbpyO20A==", + "version": "github:orbitdb/orbit-db-identity-provider#ad74d3e35178656034b482a6c5e33a409e9791a4", + "from": "github:orbitdb/orbit-db-identity-provider#feat/keystore", "dev": true, "requires": { "ethers": "^4.0.20", - "orbit-db-keystore": "~0.2.0" + "orbit-db-keystore": "~0.3.0" + }, + "dependencies": { + "deferred-leveldown": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.1.0.tgz", + "integrity": "sha512-PvDY+BT2ONu2XVRgxHb77hYelLtMYxKSGuWuJJdVRXh9ntqx9GYTFJno/SKAz5xcd+yjQwyQeIZrUPjPvA52mg==", + "dev": true, + "requires": { + "abstract-leveldown": "~6.0.0", + "inherits": "^2.0.3" + } + }, + "leveldown": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-5.1.1.tgz", + "integrity": "sha512-4n2R/vEA/sssh5TKtFwM9gshW2tirNoURLqekLRUUzuF+eUBLFAufO8UW7bz8lBbG2jw8tQDF3LC+LcUCc12kg==", + "dev": true, + "requires": { + "abstract-leveldown": "~6.0.3", + "napi-macros": "~1.8.1", + "node-gyp-build": "~4.1.0" + } + }, + "levelup": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/levelup/-/levelup-4.1.0.tgz", + "integrity": "sha512-+Qhe2/jb5affN7BeFgWUUWVdYoGXO2nFS3QLEZKZynnQyP9xqA+7wgOz3fD8SST2UKpHQuZgjyJjTcB2nMl2dQ==", + "dev": true, + "requires": { + "deferred-leveldown": "~5.1.0", + "level-errors": "~2.0.0", + "level-iterator-stream": "~4.0.0", + "xtend": "~4.0.0" + } + }, + "napi-macros": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-1.8.2.tgz", + "integrity": "sha512-Tr0DNY4RzTaBG2W2m3l7ZtFuJChTH6VZhXVhkGGjF/4cZTt+i8GcM9ozD+30Lmr4mDoZ5Xx34t2o4GJqYWDGcg==", + "dev": true + }, + "orbit-db-keystore": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/orbit-db-keystore/-/orbit-db-keystore-0.3.3.tgz", + "integrity": "sha512-NSRcpq+fUjf94UVud+EmHi1h7V6Me/E5f5ix7fji/2MHhCYPtTMTBgs2hg7y15EBjfv4QFQPOQ3nFJCtBvka3A==", + "dev": true, + "requires": { + "elliptic": "^6.4.1", + "level": "~5.0.1", + "leveldown": "~5.1.1", + "levelup": "~4.1.0", + "libp2p-crypto": "^0.16.0", + "libp2p-crypto-secp256k1": "^0.3.0", + "lru": "^3.1.0", + "mkdirp": "^0.5.1", + "safe-buffer": "^5.1.2" + } + } } }, "orbit-db-io": { @@ -9821,13 +9915,13 @@ } }, "orbit-db-keystore": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/orbit-db-keystore/-/orbit-db-keystore-0.2.4.tgz", - "integrity": "sha512-Uw6CDPu7xwB5MS7P0QurwIDsmz1V8SC+OEXzudAbJYTb0kXRomFpsvm1I7VCHgFe59laDIe4z5XXJ6iKEUn31g==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/orbit-db-keystore/-/orbit-db-keystore-0.3.3.tgz", + "integrity": "sha512-NSRcpq+fUjf94UVud+EmHi1h7V6Me/E5f5ix7fji/2MHhCYPtTMTBgs2hg7y15EBjfv4QFQPOQ3nFJCtBvka3A==", "dev": true, "requires": { "elliptic": "^6.4.1", - "level-js": "~4.0.1", + "level": "~5.0.1", "leveldown": "~5.1.1", "levelup": "~4.1.0", "libp2p-crypto": "^0.16.0", @@ -9879,12 +9973,11 @@ } }, "orbit-db-kvstore": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/orbit-db-kvstore/-/orbit-db-kvstore-1.5.1.tgz", - "integrity": "sha512-fCov8iLmUA0GIsZi6oRspsAy3Rh5yaTBTnuJ/gN6MPU0LWuhZwH3sq/WVsrEQI8uGU4or4SKypSFSp8PC/G3qA==", + "version": "github:orbitdb/orbit-db-kvstore#ec7f849365d3d9476b17df0d6e4ccb89d14a99c0", + "from": "github:orbitdb/orbit-db-kvstore#feat/identities", "dev": true, "requires": { - "orbit-db-store": "~2.6.0" + "orbit-db-store": "github:orbitdb/orbit-db-store#feat/identities" } }, "orbit-db-pubsub": { @@ -9898,15 +9991,24 @@ "p-series": "^1.1.0" } }, + "orbit-db-storage-adapter": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/orbit-db-storage-adapter/-/orbit-db-storage-adapter-0.5.3.tgz", + "integrity": "sha512-K/YDVcKkhzEnqK1WFtjcADTtNZdskBJyaTCUY+m0dCuf39VHsXO4kRq5htpT1wJ6yI9dlG6TysVh+duA3o+Xig==", + "dev": true, + "requires": { + "level": "^5.0.1", + "mkdirp": "^0.5.1" + } + }, "orbit-db-store": { - "version": "2.6.6", - "resolved": "https://registry.npmjs.org/orbit-db-store/-/orbit-db-store-2.6.6.tgz", - "integrity": "sha512-t5i0lHCPuUDN3wXWVjRnB1OK3BeRr4MsjlOwsa5i7PRzkFlWpoWsoYCrbPpavW0oaynqOsJ8F6dpIJYFbfDVZA==", + "version": "github:orbitdb/orbit-db-store#04880e2f1ceea1c729d63d04286a262410d56375", + "from": "github:orbitdb/orbit-db-store#feat/identities", "dev": true, "requires": { - "ipfs-log": "~4.3.2", + "ipfs-log": "github:orbitdb/ipfs-log#feat/identities", "logplease": "^1.2.14", - "orbit-db-io": "~0.1.0", + "orbit-db-io": "~0.1.1", "p-each-series": "^1.0.0", "p-map": "^3.0.0", "readable-stream": "~2.3.5" @@ -10019,9 +10121,9 @@ } }, "p-queue": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.2.0.tgz", - "integrity": "sha512-B2LXNONcyn/G6uz2UBFsGjmSa0e/br3jznlzhEyCXg56c7VhEpiT2pZxGOfv32Q3FSyugAdys9KGpsv3kV+Sbg==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.2.1.tgz", + "integrity": "sha512-wV8yC/rkuWpgu9LGKJIb48OynYSrE6lVl2Bx6r8WjbyVKrFAzzQ/QevAvwnDjlD+mLt8xy0LTDOU1freOvMTCg==", "dev": true, "requires": { "eventemitter3": "^4.0.0", @@ -10142,14 +10244,10 @@ } }, "parse-headers": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.2.tgz", - "integrity": "sha512-/LypJhzFmyBIDYP9aDVgeyEb5sQfbfY5mnDq4hVhlQ69js87wXfmEI5V3xI6vvXasqebp0oCytYFLxsBVfCzSg==", - "dev": true, - "requires": { - "for-each": "^0.3.3", - "string.prototype.trim": "^1.1.2" - } + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.3.tgz", + "integrity": "sha512-QhhZ+DCCit2Coi2vmAKbq5RGTRcQUOE2+REgv8vdyu7MnYx2eZztegqtTx99TZ86GTIwqiy3+4nQTWZ2tgmdCA==", + "dev": true }, "parse-json": { "version": "2.2.0", @@ -10369,23 +10467,23 @@ } }, "pino": { - "version": "5.13.5", - "resolved": "https://registry.npmjs.org/pino/-/pino-5.13.5.tgz", - "integrity": "sha512-NSArDZnjIXgzTLsYA5EhYwLiMe2OmGJ73760Wt5Vj44kUcuPJk4ub29BKtWXGAMwVmW1cQ7Q8jQaLjY/5Gxqcw==", + "version": "5.13.6", + "resolved": "https://registry.npmjs.org/pino/-/pino-5.13.6.tgz", + "integrity": "sha512-cYhvK4lopLnW/OtU3uRqBNsPiBt0Cdv97LGJg4yPGbGajlOjWWaODwD66q3Ynqnj6bSNw8HSofYcEOKZqh4Gcg==", "dev": true, "requires": { "fast-redact": "^2.0.0", "fast-safe-stringify": "^2.0.7", - "flatstr": "^1.0.9", - "pino-std-serializers": "^2.3.0", + "flatstr": "^1.0.12", + "pino-std-serializers": "^2.4.2", "quick-format-unescaped": "^3.0.3", "sonic-boom": "^0.7.5" } }, "pino-pretty": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-3.3.0.tgz", - "integrity": "sha512-aoQWRJscJrKG/YH8GKqvbYalp8rr0KDn/SUmt2XK7q3ovA8GTN6OqvomPan7soNXLUKuYJc4UQdh0Fx+15yQpw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-3.4.0.tgz", + "integrity": "sha512-0oEHicFdUCh2tFHQnTX7b9jph+S/UibLMuhBF0yFkt+7JGZGQejNkui27B9qPUofwmqKAf3FfLYvponPyNsQJw==", "dev": true, "requires": { "@hapi/bourne": "^1.3.2", @@ -10394,9 +10492,11 @@ "dateformat": "^3.0.3", "fast-safe-stringify": "^2.0.7", "jmespath": "^0.15.0", + "joycon": "^2.2.5", "pump": "^3.0.0", "readable-stream": "^3.4.0", - "split2": "^3.1.1" + "split2": "^3.1.1", + "strip-json-comments": "^3.0.1" }, "dependencies": { "pump": { @@ -10980,9 +11080,9 @@ } }, "qs": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.0.tgz", - "integrity": "sha512-27RP4UotQORTpmNQDX8BHPukOnBP3p1uUJY5UnDhaJB+rMt9iMsok724XL+UHU23bEFOHRMQ2ZhI99qOWUMGFA==", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.1.tgz", + "integrity": "sha512-Cxm7/SS/y/Z3MHWSxXb8lIFqgqBowP5JMlTUFyJN88y0SGQhVmZnqFK/PeuMX9LzUyWsqqhNxIyg0jlzq946yA==", "dev": true }, "query-string": { @@ -11140,13 +11240,19 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true } } }, "react-is": { - "version": "16.11.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.11.0.tgz", - "integrity": "sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw==", + "version": "16.12.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.12.0.tgz", + "integrity": "sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q==", "dev": true }, "read-pkg": { @@ -11862,9 +11968,9 @@ } }, "simple-peer": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/simple-peer/-/simple-peer-9.6.1.tgz", - "integrity": "sha512-/8IOtaXnnVhCkgHFBQKZ+hfx/s0+Ybo0Ijon7OrKUuEf8dEcRZJrrfjkNNgzogLM/mixI2EvnTSpOiKR6cts+w==", + "version": "9.6.2", + "resolved": "https://registry.npmjs.org/simple-peer/-/simple-peer-9.6.2.tgz", + "integrity": "sha512-EOKoImCaqtNvXIntxT1CBBK/3pVi7tMAoJ3shdyd9qk3zLm3QPiRLb/sPC1G2xvKJkJc5fkQjCXqRZ0AknwTig==", "dev": true, "requires": { "debug": "^4.0.1", @@ -12315,17 +12421,6 @@ "strip-ansi": "^5.1.0" } }, - "string.prototype.trim": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.0.tgz", - "integrity": "sha512-9EIjYD/WdlvLpn987+ctkLf0FfvBefOCuiEr2henD8X+7jfwPnyvTdmW8OJhj5p+M0/96mBdynLWkxUr+rHlpg==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.13.0", - "function-bind": "^1.1.1" - } - }, "string.prototype.trimleft": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz", @@ -12395,9 +12490,9 @@ } }, "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", + "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", "dev": true }, "subtext": { @@ -13398,9 +13493,9 @@ }, "dependencies": { "@types/node": { - "version": "10.17.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.4.tgz", - "integrity": "sha512-F2pgg+LcIr/elguz+x+fdBX5KeZXGUOp7TV8M0TVIrDezYLFRNt8oMTyps0VQ1kj5WGGoR18RdxnRDHXrIFHMQ==", + "version": "10.17.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.5.tgz", + "integrity": "sha512-RElZIr/7JreF1eY6oD5RF3kpmdcreuQPjg5ri4oQ5g9sq7YWU8HkfB3eH8GwAwxf5OaCh0VPi7r4N/yoTGelrA==", "dev": true }, "bn.js": { diff --git a/package.json b/package.json index 319f0b3..055cedc 100644 --- a/package.json +++ b/package.json @@ -40,9 +40,9 @@ "ipfs-repo": "~0.26.6", "ipfsd-ctl": "~0.42.4", "mocha": "^5.2.0", - "orbit-db": "~0.21.4", - "orbit-db-identity-provider": "~0.1.0", - "orbit-db-keystore": "~0.2.1", + "orbit-db": "orbitdb/orbit-db#feat/identities", + "orbit-db-identity-provider": "orbitdb/orbit-db-identity-provider#feat/keystore", + "orbit-db-keystore": "~0.3.3", "standard": "^14.1.0", "web3": "1.0.0-beta.37" }, diff --git a/src/access-controller-interface.js b/src/access-controller-interface.js index 712ae6e..7c3a244 100644 --- a/src/access-controller-interface.js +++ b/src/access-controller-interface.js @@ -37,7 +37,7 @@ class AccessController extends EventEmitter { be allowed in the database. Return true if the entry is allowed, false is not allowed */ - async canAppend (entry, identityProvider) {} + async canAppend (entry) {} /* Add and remove access */ async grant (access, identity) { return false } diff --git a/src/contract-access-controller.js b/src/contract-access-controller.js index cc283dd..1910fb7 100644 --- a/src/contract-access-controller.js +++ b/src/contract-access-controller.js @@ -50,19 +50,13 @@ class ContractAccessController extends AccessController { return { address: cid } } - async canAppend (entry, identityProvider) { + async canAppend (entry) { // Write the custom access control logic here if (!isValidEthAddress(this.web3, entry.identity.id)) { console.warn(`WARNING: "${entry.identity.id}" is not a valid eth address`) return Promise.resolve(false) } - const isPermitted = await this.contract.methods.isPermitted(entry.identity.id, this.web3.utils.fromAscii('write')).call() - if (isPermitted) { - const verifiedIdentity = await identityProvider.verifyIdentity(entry.identity) - // Allow access if identity verifies - return Promise.resolve(verifiedIdentity) - } - return Promise.resolve(false) + return this.contract.methods.isPermitted(entry.identity.id, this.web3.utils.fromAscii('write')).call() } async grant (capability, identifier, options = {}) { diff --git a/src/deposit-contract-access-controller.js b/src/deposit-contract-access-controller.js index 60581c9..17d8062 100644 --- a/src/deposit-contract-access-controller.js +++ b/src/deposit-contract-access-controller.js @@ -51,7 +51,7 @@ class DepositContractAccessController extends AccessController { return { address: cid } } - async canAppend (entry, identityProvider) { + async canAppend (entry) { // Write the custom access control logic here if (!isValidEthAddress(this.web3, entry.identity.id)) { console.warn(`WARNING: "${entry.identity.id}" is not a valid eth address`) diff --git a/src/ipfs-access-controller.js b/src/ipfs-access-controller.js index 410fc98..c097ef9 100644 --- a/src/ipfs-access-controller.js +++ b/src/ipfs-access-controller.js @@ -18,12 +18,11 @@ class IPFSAccessController extends AccessController { return this._write } - async canAppend (entry, identityProvider) { + async canAppend (entry) { // Allow if access list contain the writer's publicKey or is '*' const key = entry.identity.id if (this.write.includes(key) || this.write.includes('*')) { - // check identity is valid - return identityProvider.verifyIdentity(entry.identity) + return true } return false } diff --git a/src/legacy-ipfs-access-controller.js b/src/legacy-ipfs-access-controller.js index ca81af4..ee33955 100644 --- a/src/legacy-ipfs-access-controller.js +++ b/src/legacy-ipfs-access-controller.js @@ -19,7 +19,7 @@ class LegacyIPFSAccessController extends AccessController { return this._write } - async canAppend (entry, identityProvider) { + async canAppend (entry) { // Allow if access list contain the writer's publicKey or is '*' const publicKey = entry.key if (this.write.includes(publicKey) || diff --git a/src/orbitdb-access-controller.js b/src/orbitdb-access-controller.js index 250786a..d7386d7 100644 --- a/src/orbitdb-access-controller.js +++ b/src/orbitdb-access-controller.js @@ -23,14 +23,12 @@ class OrbitDBAccessController extends AccessController { } // Return true if entry is allowed to be added to the database - async canAppend (entry, identityProvider) { + async canAppend (entry) { // Write keys and admins keys are allowed const access = new Set([...this.get('write'), ...this.get('admin')]) // If the ACL contains the writer's public key or it contains '*' if (access.has(entry.identity.id) || access.has('*')) { - const verifiedIdentity = await identityProvider.verifyIdentity(entry.identity) - // Allow access if identity verifies - return verifiedIdentity + return true } return false diff --git a/src/utils/ensure-ac-address.js b/src/utils/ensure-ac-address.js index 63fb5d9..825b742 100644 --- a/src/utils/ensure-ac-address.js +++ b/src/utils/ensure-ac-address.js @@ -5,6 +5,6 @@ const ensureAddress = address => { const suffix = address.toString().split('/').pop() return suffix === '_access' ? address - : path.join(address, '/_access') + : (path.posix || path).join(address, '/_access') } module.exports = ensureAddress diff --git a/test/access-controller-handlers.test.js b/test/access-controller-handlers.test.js index d9ffe35..3509eda 100644 --- a/test/access-controller-handlers.test.js +++ b/test/access-controller-handlers.test.js @@ -4,7 +4,6 @@ const assert = require('assert') const rmrf = require('rimraf') const Web3 = require('web3') const OrbitDB = require('orbit-db') -const IdentityProvider = require('orbit-db-identity-provider') const Keystore = require('orbit-db-keystore') const AccessControllers = require('../') const ContractAccessController = require('../src/contract-access-controller.js') @@ -28,7 +27,7 @@ Object.keys(testAPIs).forEach(API => { describe(`orbit-db - Access Controller Handlers (${API})`, function () { this.timeout(config.timeout) - let web3, contract, ipfsd1, ipfsd2, ipfs1, ipfs2, id1, id2 + let web3, contract, ipfsd1, ipfsd2, ipfs1, ipfs2 let orbitdb1, orbitdb2 before(async () => { @@ -43,22 +42,24 @@ Object.keys(testAPIs).forEach(API => { ipfs1 = ipfsd1.api ipfs2 = ipfsd2.api - const keystore1 = Keystore.create(dbPath1 + '/keys') - const keystore2 = Keystore.create(dbPath2 + '/keys') + const keystore1 = new Keystore(dbPath1 + '/keys') + const keystore2 = new Keystore(dbPath2 + '/keys') - id1 = await IdentityProvider.createIdentity({ id: 'A', keystore: keystore1 }) - id2 = await IdentityProvider.createIdentity({ id: 'B', keystore: keystore2 }) + // id1 = await IdentityProvider.createIdentity({ id: 'A', keystore: keystore1 }) + // id2 = await IdentityProvider.createIdentity({ id: 'B', keystore: keystore2 }) orbitdb1 = await OrbitDB.createInstance(ipfs1, { AccessControllers: AccessControllers, directory: dbPath1, - identity: id1 + id: 'A', + keystore: keystore1 }) orbitdb2 = await OrbitDB.createInstance(ipfs2, { AccessControllers: AccessControllers, directory: dbPath2, - identity: id2 + id: 'B', + keystore: keystore2 }) }) diff --git a/test/contract-access-controller-integration.test.js b/test/contract-access-controller-integration.test.js index 5c8eec7..4545634 100644 --- a/test/contract-access-controller-integration.test.js +++ b/test/contract-access-controller-integration.test.js @@ -56,12 +56,11 @@ Object.keys(testAPIs).forEach(API => { ipfs1 = ipfsd1.api ipfs2 = ipfsd2.api - const keystore1 = Keystore.create(dbPath1 + '/keys') - const keystore2 = Keystore.create(dbPath2 + '/keys') + const keystore = new Keystore(dbPath1 + '/keys') IdentityProvider.addIdentityProvider(EthIdentityProvider) - - id1 = await IdentityProvider.createIdentity({ type: 'ethereum', keystore: keystore1 }) - id2 = await IdentityProvider.createIdentity({ type: 'ethereum', keystore: keystore2 }) + const identities = new IdentityProvider({ keystore }) + id1 = await identities.createIdentity({ type: 'ethereum' }) + id2 = await identities.createIdentity({ type: 'ethereum' }) web3 = new Web3(ganache.provider()) accounts = await web3.eth.getAccounts() @@ -71,13 +70,15 @@ Object.keys(testAPIs).forEach(API => { orbitdb1 = await OrbitDB.createInstance(ipfs1, { AccessControllers: AccessControllers, directory: dbPath1, - identity: id1 + identity: id1, + identities }) orbitdb2 = await OrbitDB.createInstance(ipfs2, { AccessControllers: AccessControllers, directory: dbPath2, - identity: id2 + identity: id2, + identities }) }) diff --git a/test/contract-access-controller.test.js b/test/contract-access-controller.test.js index c7d72ef..620b6aa 100644 --- a/test/contract-access-controller.test.js +++ b/test/contract-access-controller.test.js @@ -56,13 +56,12 @@ Object.keys(testAPIs).forEach(API => { ipfs1 = ipfsd1.api ipfs2 = ipfsd2.api - const keystore1 = Keystore.create(dbPath1 + '/keys') - const keystore2 = Keystore.create(dbPath2 + '/keys') + const keystore = new Keystore(dbPath1 + '/keys') IdentityProvider.addIdentityProvider(EthIdentityProvider) - - id1 = await IdentityProvider.createIdentity({ type: EthIdentityProvider.type, keystore: keystore1 }) - id2 = await IdentityProvider.createIdentity({ type: EthIdentityProvider.type, keystore: keystore2 }) + const identities = new IdentityProvider({ keystore }) + id1 = await identities.createIdentity({ type: EthIdentityProvider.type }) + id2 = await identities.createIdentity({ type: EthIdentityProvider.type }) web3 = new Web3(ganache.provider()) accounts = await web3.eth.getAccounts() @@ -70,13 +69,15 @@ Object.keys(testAPIs).forEach(API => { orbitdb1 = await OrbitDB.createInstance(ipfs1, { AccessControllers: AccessControllers, directory: dbPath1, - identity: id1 + identity: id1, + identities }) orbitdb2 = await OrbitDB.createInstance(ipfs2, { AccessControllers: AccessControllers, directory: dbPath2, - identity: id2 + identity: id2, + identities }) }) @@ -132,16 +133,16 @@ Object.keys(testAPIs).forEach(API => { // doesn't matter what we put here, only identity is used for the check } await accessController.grant('write', id1.id) - const canAppend = await accessController.canAppend(mockEntry, id1.provider) + const canAppend = await accessController.canAppend(mockEntry) assert.strictEqual(canAppend, true) }) it('grants access to multiple keys', async () => { - const canAppend1 = await accessController.canAppend({ identity: orbitdb1.identity }, orbitdb1.identity.provider) - const canAppend2 = await accessController.canAppend({ identity: orbitdb2.identity }, orbitdb2.identity.provider) + const canAppend1 = await accessController.canAppend({ identity: orbitdb1.identity }) + const canAppend2 = await accessController.canAppend({ identity: orbitdb2.identity }) await accessController.grant('write', orbitdb2.identity.id) - const canAppend3 = await accessController.canAppend({ identity: orbitdb2.identity }, orbitdb2.identity.provider) + const canAppend3 = await accessController.canAppend({ identity: orbitdb2.identity }) assert.strictEqual(canAppend1, true) assert.strictEqual(canAppend2, false) @@ -174,9 +175,9 @@ Object.keys(testAPIs).forEach(API => { }) it('has correct capabalities', async () => { - const canAppend1 = await accessController.canAppend({ identity: orbitdb1.identity }, orbitdb1.identity.provider) - const canAppend2 = await accessController.canAppend({ identity: orbitdb2.identity }, orbitdb2.identity.provider) - const canAppend3 = await accessController.canAppend({ identity: { id: 'someotherid' } }, orbitdb1.identity.provider) + const canAppend1 = await accessController.canAppend({ identity: orbitdb1.identity }) + const canAppend2 = await accessController.canAppend({ identity: orbitdb2.identity }) + const canAppend3 = await accessController.canAppend({ identity: { id: 'someotherid' } }) assert.strictEqual(canAppend1, true) assert.strictEqual(canAppend2, true) diff --git a/test/ipfs-access-controller-integration.test.js b/test/ipfs-access-controller-integration.test.js index 861a7c9..f50e1a3 100644 --- a/test/ipfs-access-controller-integration.test.js +++ b/test/ipfs-access-controller-integration.test.js @@ -39,21 +39,22 @@ Object.keys(testAPIs).forEach(API => { ipfs1 = ipfsd1.api ipfs2 = ipfsd2.api - const keystore1 = Keystore.create(dbPath1 + '/keys') - const keystore2 = Keystore.create(dbPath2 + '/keys') - - id1 = await IdentityProvider.createIdentity({ id: 'A', keystore: keystore1 }) - id2 = await IdentityProvider.createIdentity({ id: 'B', keystore: keystore2 }) + const keystore = new Keystore(dbPath1 + '/keys') + const identities = new IdentityProvider({ keystore }) + id1 = await identities.createIdentity({ id: 'A' }) + id2 = await identities.createIdentity({ id: 'B' }) orbitdb1 = await OrbitDB.createInstance(ipfs1, { AccessControllers: AccessControllers, directory: dbPath1, + identities: identities, identity: id1 }) orbitdb2 = await OrbitDB.createInstance(ipfs2, { AccessControllers: AccessControllers, directory: dbPath2, + identities: identities, identity: id2 }) }) diff --git a/test/ipfs-access-controller.test.js b/test/ipfs-access-controller.test.js index 5b11f55..399062e 100644 --- a/test/ipfs-access-controller.test.js +++ b/test/ipfs-access-controller.test.js @@ -40,22 +40,26 @@ Object.keys(testAPIs).forEach(API => { ipfs1 = ipfsd1.api ipfs2 = ipfsd2.api - const keystore1 = Keystore.create(dbPath1 + '/keys') - const keystore2 = Keystore.create(dbPath2 + '/keys') + const keystore1 = new Keystore(dbPath1 + '/keys') + const keystore2 = new Keystore(dbPath2 + '/keys') - id1 = await IdentityProvider.createIdentity({ id: 'A', keystore: keystore1 }) - id2 = await IdentityProvider.createIdentity({ id: 'B', keystore: keystore2 }) + const identities1 = new IdentityProvider({ keystore: keystore1 }) + const identities2 = new IdentityProvider({ keystore: keystore2 }) + id1 = await identities1.createIdentity({ id: 'A' }) + id2 = await identities2.createIdentity({ id: 'B' }) orbitdb1 = await OrbitDB.createInstance(ipfs1, { AccessControllers: AccessControllers, directory: dbPath1, - identity: id1 + identity: id1, + identities: identities1 }) orbitdb2 = await OrbitDB.createInstance(ipfs2, { AccessControllers: AccessControllers, directory: dbPath2, - identity: id2 + identity: id2, + identities: identities2 }) }) diff --git a/test/orbit-db-access-controller-integration.test.js b/test/orbit-db-access-controller-integration.test.js index 611881a..75cb30e 100644 --- a/test/orbit-db-access-controller-integration.test.js +++ b/test/orbit-db-access-controller-integration.test.js @@ -39,22 +39,25 @@ Object.keys(testAPIs).forEach(API => { ipfs1 = ipfsd1.api ipfs2 = ipfsd2.api - const keystore1 = Keystore.create(dbPath1 + '/keys') - const keystore2 = Keystore.create(dbPath2 + '/keys') - - id1 = await IdentityProvider.createIdentity({ id: 'A', keystore: keystore1 }) - id2 = await IdentityProvider.createIdentity({ id: 'B', keystore: keystore2 }) + const keystore1 = new Keystore(dbPath1 + '/keys') + const keystore2 = new Keystore(dbPath2 + '/keys') + const identities1 = new IdentityProvider({ keystore: keystore1 }) + const identities2 = new IdentityProvider({ keystore: keystore2 }) + id1 = await identities1.createIdentity({ id: 'A' }) + id2 = await identities2.createIdentity({ id: 'B' }) orbitdb1 = await OrbitDB.createInstance(ipfs1, { AccessControllers: AccessControllers, directory: dbPath1, - identity: id1 + identity: id1, + identities: identities1 }) orbitdb2 = await OrbitDB.createInstance(ipfs2, { AccessControllers: AccessControllers, directory: dbPath2, - identity: id2 + identity: id2, + identities: identities2 }) }) diff --git a/test/orbit-db-access-controller.test.js b/test/orbit-db-access-controller.test.js index 92d5f06..e475196 100644 --- a/test/orbit-db-access-controller.test.js +++ b/test/orbit-db-access-controller.test.js @@ -40,22 +40,25 @@ Object.keys(testAPIs).forEach(API => { ipfs1 = ipfsd1.api ipfs2 = ipfsd2.api - const keystore1 = Keystore.create(dbPath1 + '/keys') - const keystore2 = Keystore.create(dbPath2 + '/keys') - - id1 = await IdentityProvider.createIdentity({ id: 'A', keystore: keystore1 }) - id2 = await IdentityProvider.createIdentity({ id: 'B', keystore: keystore2 }) + const keystore1 = new Keystore(dbPath1 + '/keys') + const keystore2 = new Keystore(dbPath2 + '/keys') + const identities1 = new IdentityProvider({ keystore: keystore1 }) + const identities2 = new IdentityProvider({ keystore: keystore2 }) + id1 = await identities1.createIdentity({ id: 'A' }) + id2 = await identities2.createIdentity({ id: 'B' }) orbitdb1 = await OrbitDB.createInstance(ipfs1, { AccessControllers: AccessControllers, directory: dbPath1, - identity: id1 + identity: id1, + identities: identities1 }) orbitdb2 = await OrbitDB.createInstance(ipfs2, { AccessControllers: AccessControllers, directory: dbPath2, - identity: id2 + identity: id2, + identities: identities2 }) })