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
|
|
|
}
|