Package tbdex.sdk.protocol.models
Class Resource
-
- All Implemented Interfaces:
public class ResourceAn abstract class representing the structure and common functionality available on all Resources.
-
-
Field Summary
Fields Modifier and Type Field Description private final ResourceMetadatametadataprivate final ResourceDatadataprivate Stringsignature
-
Method Summary
Modifier and Type Method Description abstract ResourceMetadatagetMetadata()abstract ResourceDatagetData()abstract StringgetSignature()abstract UnitsetSignature(String signature)final Unitsign(BearerDid did)Signs the Resource using the specified BearerDid final Unitverify()Verifies the signature of the Resource. StringtoString()Uses Json to serialize the Resource as a json string. -
-
Method Detail
-
getMetadata
abstract ResourceMetadata getMetadata()
-
getData
abstract ResourceData getData()
-
getSignature
abstract String getSignature()
-
setSignature
abstract Unit setSignature(String signature)
-
sign
final Unit sign(BearerDid did)
Signs the Resource using the specified BearerDid
- Parameters:
did- The DID (Decentralized Identifier) used for signing.
-
verify
final Unit verify()
Verifies the signature of the Resource.
This function verifies the signature using the previously set signature property. It compares the signature against a hashed payload consisting of metadata and data.
-
-
-
-