1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

Remove --no-acl-contractflag.

This commit is contained in:
Pedro Gutiérrez 2019-03-18 13:04:59 +01:00 committed by Pedro Gutiérrez
parent b821d6c6e0
commit f3599a5d7f
6 changed files with 20 additions and 11 deletions

View File

@ -23,7 +23,7 @@ before_script:
- cd barge - cd barge
- export KEEPER_VERSION=v0.8.5 - export KEEPER_VERSION=v0.8.5
- export KEEPER_OWNER_ROLE_ADDRESS="0xe2DD09d719Da89e5a3D0F2549c7E24566e947260" - export KEEPER_OWNER_ROLE_ADDRESS="0xe2DD09d719Da89e5a3D0F2549c7E24566e947260"
- bash -x start_ocean.sh --latest --no-pleuston --local-spree-node --no-acl-contract 2>&1 > start_ocean.log & - bash -x start_ocean.sh --latest --no-pleuston --local-spree-node 2>&1 > start_ocean.log &
- cd .. - cd ..
- ./scripts/unlock-spree-accounts.sh 2>&1 > /dev/null & - ./scripts/unlock-spree-accounts.sh 2>&1 > /dev/null &

View File

@ -6,6 +6,6 @@
"secretStoreUri": "http://localhost:12001", "secretStoreUri": "http://localhost:12001",
"threshold": 0, "threshold": 0,
"password": "secret", "password": "secret",
"address": "0xa99d43d86a0758d5632313b8fa3972b6088a21bb", "address": "0x068Ed00cF0441e4829D9784fCBe7b9e26D4BD8d0",
"verbose": 0 "verbose": 0
} }

View File

@ -1,4 +1,5 @@
import { assert } from "chai" import { assert } from "chai"
import * as Web3 from "web3"
import * as fs from "fs" import * as fs from "fs"
import { config } from "../config" import { config } from "../config"
@ -18,12 +19,17 @@ describe("Consume Asset", () => {
let serviceAgreementSignatureResult: {agreementId: string, signature: string} let serviceAgreementSignatureResult: {agreementId: string, signature: string}
before(async () => { before(async () => {
ocean = await Ocean.getInstance(config) ocean = await Ocean.getInstance({
...config,
web3Provider: new Web3.providers
.HttpProvider("http://localhost:8545", 0, "0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e", "node0"),
})
// Accounts // Accounts
publisher = (await ocean.accounts.list())[0] publisher = new Account("0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e")
publisher.setPassword(process.env.ACCOUNT_PASSWORD) publisher.setPassword("node0")
consumer = (await ocean.accounts.list())[1] consumer = new Account("0x068Ed00cF0441e4829D9784fCBe7b9e26D4BD8d0")
consumer.setPassword("secret")
}) })
it("should regiester a asset", async () => { it("should regiester a asset", async () => {
@ -67,7 +73,7 @@ describe("Consume Asset", () => {
assert.isTrue(success) assert.isTrue(success)
}) })
it("should lock the payment", async () => { it("should lock the payment by the consumer", async () => {
const paid = await ocean.agreements.conditions const paid = await ocean.agreements.conditions
.lockReward( .lockReward(
serviceAgreementSignatureResult.agreementId, serviceAgreementSignatureResult.agreementId,
@ -78,7 +84,7 @@ describe("Consume Asset", () => {
assert.isTrue(paid, "The asset has not been paid correctly") assert.isTrue(paid, "The asset has not been paid correctly")
}) })
it("should grant the access", async () => { it("should grant the access by the publisher", async () => {
const granted = await ocean.agreements.conditions const granted = await ocean.agreements.conditions
.grantAccess(serviceAgreementSignatureResult.agreementId, ddo.id, consumer.getId(), publisher) .grantAccess(serviceAgreementSignatureResult.agreementId, ddo.id, consumer.getId(), publisher)

View File

@ -28,7 +28,8 @@ describe("Secret Store", () => {
assert.match(encryptedContent, /^0x[a-f0-9]{86}$/i) assert.match(encryptedContent, /^0x[a-f0-9]{86}$/i)
}) })
it("should decrypt a text", async () => { // Only works running Barge with `--no-acl-contract`
xit("should decrypt a text", async () => {
const decryptedContent = await ocean.secretStore.decrypt(did.getId(), encryptedContent, account) const decryptedContent = await ocean.secretStore.decrypt(did.getId(), encryptedContent, account)
assert.deepEqual(decryptedContent, content) assert.deepEqual(decryptedContent, content)

View File

@ -8,7 +8,7 @@ export class AccessSecretStoreCondition extends Condition {
} }
public hashValues(did: string, grantee: string) { public hashValues(did: string, grantee: string) {
return super.hashValues(zeroX(did), zeroX(grantee)) return super.hashValues(didZeroX(did), zeroX(grantee))
} }
public fulfill(agreementId: string, did: string, grantee: string, from?: string) { public fulfill(agreementId: string, did: string, grantee: string, from?: string) {

View File

@ -193,7 +193,9 @@ export default class OceanAssets {
} }
Logger.log("Decrypting files") Logger.log("Decrypting files")
const decryptedFiles = await SecretStoreProvider.getSecretStore(secretStoreConfig).decryptDocument(DID.parse(did).getId(), files) const decryptedFiles = await SecretStoreProvider
.getSecretStore(secretStoreConfig)
.decryptDocument(DID.parse(did).getId(), files)
Logger.log("Files decrypted") Logger.log("Files decrypted")
Logger.log("Consuming files") Logger.log("Consuming files")