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

Add authenticate method to account.

This commit is contained in:
Pedro Gutiérrez 2019-05-20 11:33:15 +02:00
parent b32f708385
commit 95d668666b
3 changed files with 19 additions and 1 deletions

View File

@ -68,7 +68,7 @@ describe("Authentication Token", () => {
assert.isFalse(acc2Stored)
assert.isFalse(await account2.isTokenStored())
await ocean.auth.store(account2)
await account2.authenticate()
acc2Stored = await ocean.auth.isStored(account2)
assert.isTrue(acc2Stored)

View File

@ -25,6 +25,17 @@ describe("Consume Asset (Brizo)", () => {
consumer = (await ocean.accounts.list())[1]
})
after(() => {
try {
localStorage.clear()
} catch { }
})
it("should authenticate the accounts", async () => {
await publisher.authenticate()
await consumer.authenticate()
})
it("should regiester an asset", async () => {
const steps = []
ddo = await ocean.assets.create(metadata as any, publisher)

View File

@ -65,6 +65,13 @@ export default class Account extends Instantiable {
return this.ocean.auth.isStored(this)
}
/**
* Authenticate the account.
*/
public authenticate() {
return this.ocean.auth.store(this)
}
/**
* Balance of Ocean Token.
* @return {Promise<number>}