mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
remove ddo prof
This commit is contained in:
parent
8003bd133f
commit
2c73c6e06d
@ -157,4 +157,27 @@ export class DDO {
|
|||||||
}
|
}
|
||||||
this.proof = await this.generateProof(ocean, publicKey, password)
|
this.proof = await this.generateProof(ocean, publicKey, password)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates and adds a simple proof
|
||||||
|
* @param {Ocean} ocean Ocean instance.
|
||||||
|
* @param {string} publicKey Public key to be used on personal sign.
|
||||||
|
* @param {string} password Password if it's required.
|
||||||
|
* @return {Promise<Proof>} Proof object.
|
||||||
|
*/
|
||||||
|
public async addSimpleProof(ocean: Ocean, publicKey: string): Promise<void> {
|
||||||
|
if (this.proof) {
|
||||||
|
throw new Error('Proof already exists')
|
||||||
|
}
|
||||||
|
|
||||||
|
this.proof = {
|
||||||
|
created: new Date().toISOString().replace(/\.[0-9]{3}/, ''),
|
||||||
|
creator: publicKey,
|
||||||
|
type: 'AddressHash',
|
||||||
|
signatureValue: Web3Provider.getWeb3()
|
||||||
|
.utils.sha3(publicKey)
|
||||||
|
// TODO: security/detect-unsafe-regex
|
||||||
|
.replace(/^0x([a-f0-9]{64})(:!.+)?$/i, '0x$1')
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,11 +188,11 @@ export class Assets extends Instantiable {
|
|||||||
index: indexCount++
|
index: indexCount++
|
||||||
})) as Service[]
|
})) as Service[]
|
||||||
})
|
})
|
||||||
this.logger.log('Generating proof')
|
// this.logger.log('Generating proof')
|
||||||
observer.next(CreateProgressStep.GeneratingProof)
|
// observer.next(CreateProgressStep.GeneratingProof)
|
||||||
await ddo.addProof(this.ocean, publisher.getId(), publisher.getPassword())
|
await ddo.addSimpleProof(this.ocean, publisher.getId())
|
||||||
this.logger.log('Proof generated')
|
// this.logger.log('Proof generated')
|
||||||
observer.next(CreateProgressStep.ProofGenerated)
|
// observer.next(CreateProgressStep.ProofGenerated)
|
||||||
this.logger.log('Storing DDO')
|
this.logger.log('Storing DDO')
|
||||||
observer.next(CreateProgressStep.StoringDdo)
|
observer.next(CreateProgressStep.StoringDdo)
|
||||||
// const storedDdo = await this.ocean.metadatastore.storeDDO(ddo)
|
// const storedDdo = await this.ocean.metadatastore.storeDDO(ddo)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user