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

38 lines
1.0 KiB
TypeScript
Raw Normal View History

2018-11-01 11:04:59 +01:00
import Authentication from "./Authentication"
import PublicKey from "./PublicKey"
import Service from "./Service"
export default class DDO {
public static serialize(ddo: DDO): string {
return JSON.stringify(ddo, null, 2)
}
public static deserialize(ddoString: string): DDO {
const ddo = JSON.parse(ddoString)
return ddo as DDO
}
public "@context": string = "https://w3id.org/future-method/v1"
public id: string
public publicKey: PublicKey[]
public authentication: Authentication[]
public service: Service[]
// @ts-ignore
private assa: string
public constructor(ddo?: {
2018-11-01 12:47:48 +01:00
id?: string,
publicKey?: PublicKey[],
authentication?: Authentication[],
service?: Service[],
2018-11-01 11:04:59 +01:00
}) {
2018-11-01 12:47:48 +01:00
this.id = ddo ? ddo.id ? ddo.id : null : null
this.publicKey = ddo ? ddo.publicKey ? ddo.publicKey : [] : []
this.authentication = ddo ? ddo.authentication ? ddo.authentication : [] : []
this.service = ddo ? ddo.service ? ddo.service : [] : []
2018-11-01 11:04:59 +01:00
}
}