1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00
squid-js/src/libDDO/Proof.ts
2018-11-20 13:01:52 +08:00

38 lines
942 B
TypeScript

interface IProof {
created?: string
creator?: string
type?: string
signatureValue?: string
}
export default class Proof {
public created: string
public creator: string
public type: string
public signatureValue: string
public constructor(data?: IProof) {
this.created = data.created
this.creator = data.creator
this.type = data.type
this.signatureValue = data.signatureValue
}
public toData(): IProof {
return {
created: this.created,
creator: this.creator,
type: this.type,
signatureValue: this.signatureValue,
} as IProof
}
public isValid(): boolean {
return this.created && this.created.length > 0
&& this.creator && this.creator.length > 0
&& this.type && this.type.length > 0
&& this.signatureValue && this.signatureValue.length > 0
}
}