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

38 lines
942 B
TypeScript
Raw Normal View History

2018-11-20 06:01:52 +01:00
interface IProof {
created?: string
creator?: string
type?: string
signatureValue?: string
}
2018-11-20 04:54:50 +01:00
export default class Proof {
2018-11-20 06:01:52 +01:00
2018-11-20 04:54:50 +01:00
public created: string
public creator: string
public type: string
public signatureValue: string
2018-11-20 06:01:52 +01:00
public constructor(data?: IProof) {
this.created = data.created
this.creator = data.creator
this.type = data.type
this.signatureValue = data.signatureValue
2018-11-20 04:54:50 +01:00
}
2018-11-20 06:01:52 +01:00
public toData(): IProof {
2018-11-20 04:54:50 +01:00
return {
2018-11-20 06:01:52 +01:00
created: this.created,
creator: this.creator,
type: this.type,
signatureValue: this.signatureValue,
} as IProof
2018-11-20 04:54:50 +01:00
}
2018-11-20 06:01:52 +01:00
2018-11-20 04:54:50 +01:00
public isValid(): boolean {
2018-11-20 06:01:52 +01:00
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
}
2018-11-20 04:54:50 +01:00
}