puppeteer | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
- Topic: Blockchain SDK API
- Author: Kim Jeong-heon, Kim Min-yong
- Date: 2024-08-29
- Version: v1.0.0
Version | Date | Changes |
---|---|---|
v1.0.0 | 2024-08-29 | Initial version |
- 1. DID Document Registration
- 2. DID Document Retrieval
- 3. DID Document Status Change
- 4. VC Metadata Registration
- 5. VC Metadata Retrieval
- 6. VC Status Change
FabricContractApi
registDidDoc
Initial registration of a DID document or updating a DID document excluding its status
Parameter | Type | Description | M/O | Notes |
---|---|---|---|---|
invokedDocument | InvokedDocument | Document for DID registration and update request | M | |
roleType | RoleType | Enum for provider type | M | See Data Specification |
void
// Function declaration in Java
void registDidDoc(InvokedDocument invokedDocument, RoleType roleType) throws BlockchainException;
void registDidDocTest() throws Exception {
// encoding did document
String document = "z29KbMzaxCukd5iyCozP3CQEHiR...CkRAC8usDbDrsvxPc5";
Provider controller = Provider.builder()...build();
Proof proof = Proof.builder()...build();
InvokedDocument invokedDocument = InvokedDocument.builder()
.didDoc(document)
.controller(controller)
.proof(proof)
.nonce("12345")
.build();
// Set up blockchain network information and create API object
FabricContractApi contractApi = (FabricContractApi) ContractFactory.FABRIC.create("junit-platform.properties");
// call
contractApi.registDidDoc(invokedDocument, RoleType.TAS);
}
FabricContractApi
getDidDoc
Retrieve a specific DID document
Parameter | Type | Description | M/O | Notes |
---|---|---|---|---|
didKeyUrl | string | DID key identifier URL | M |
Type | Description | M/O | Notes |
---|---|---|---|
DidDocAndStatus | DidDocAndStatus object | M | As of v0.0.1, it is specified as a FabricResponse object DidDocAndStatus will be reflected later |
// Function declaration in Java
DidDocAndStatus getDidDoc(String didKeyUrl) throws BlockChainException;
void getDidDocTest() throws Exception {
String didKeyUrl = "did:odi:das/segment?versionId=1#public-key-0";
// Set up blockchain network information and create api object
FabricContractApi contractApi = (FabricContractApi) ContractFactory.FABRIC.create("junit-platform.properties");
// call
DidDocAndStatus didDocAndStatus = contractApi.getDidDoc(didKeyUrl);
}
FabricContractApi
updateDidDocStatus
Change the status of a specific DID document
For detailed information about the DID document lifecycle, refer to the table below (the parameter terminatedTime is required when changing the status to 'TERMINATED').
Status Value | Name | Description |
---|---|---|
ACTIVATED | Active | • Can transition to DEACTIVATED or REVOKED status |
DEACTIVATED | Inactive | • Can transition to ACTIVATED or REVOKED status |
REVOKED | Revoked | • Can transition to TERMINATED status |
TERMINATED | Terminated | • Cannot transition to any other status • Termination start date is required |
Parameter | Type | Description | M/O | Remarks |
---|---|---|---|---|
didKeyUrl | string | DID key identifier URL | M | |
didDocStatus | DidDocStatus | DID document status Enum | M |
Type | Description | M/O | Notes |
---|---|---|---|
DidDocument | DidDoc object | M |
// Function declaration in Java
DidDocument updateDidDocStatus(String didUrl, DidDocStatus didDocStatus) throws BlockChainException;
void updateDidDocStatusTest() throws Exception {
String didKeyUrl = "did:odi:das/segment?versionId=1#public-key-0";
// Set up blockchain network information and create API object
FabricContractApi contractApi = (FabricContractApi) ContractFactory.FABRIC.create("junit-platform.properties");
// Call
DidDoc didDoc = contractApi.updateDidDoc(didKeyUrl, DidDocStatus.TERMINATED, LocalDateTime.now());
}
void updateDidDocStatusTest() throws Exception {
String didKeyUrl = "did:odi:tas?versionId=1";
// Set up blockchain network information and create API object
FabricContractApi contractApi = (FabricContractApi) ContractFactory.FABRIC.create("junit-platform.properties");
// Call
DidDoc didDoc = contractApi.updateDidDoc(didKeyUrl, DidDocStatus.DEACTIVATED);
}
Parameter | Type | Description | M/O | Notes |
---|---|---|---|---|
didKeyUrl | string | DID key identifier URL | M | |
didDocStatus | DidDocStatus | DID document status Enum | M | |
terminatedTime | LocalDateTime | Start time of termination | M |
Type | Description | M/O | Notes |
---|---|---|---|
DidDocument | DidDoc object | M |
// Function declaration in Java
DidDocument updateDidDocStatus(String didUrl, DidDocStatus didDocStatus, LocalDateTime terminatedTime) throws BlockChainException;
void updateDidDocStatusTest() throws Exception {
String didKeyUrl = "did:odi:tas?versionId=1";
// Set up blockchain network information and create API object
FabricContractApi contractApi = (FabricContractApi) ContractFactory.FABRIC.create("junit-platform.properties");
// Call
DidDoc didDoc = contractApi.updateDidDoc(didKeyUrl, DidDocStatus.TERMINATED, LocalDateTime.now());
}
FabricContractApi
registVcMetadata
VC metadata registration
Parameter | Type | Description | M/O | Notes |
---|---|---|---|---|
vcMeta | VcMeta | VC metadata | M |
void
// Function declaration in Java
void registVcMetadata(VcMeta vcMeta) throws BlockChainException;
void registVcMetadataTest() throws Exception {
ProviderDetail issuer = ProviderDetail.builder()...build();
Credential credentialSchema = CredentialSchema.builder()...build();
VcMeta vcMeta = VcMeta.builder()
.id("vcId")
.status(VcStatus.ACTIVE.getRawValue())
.issuer(issuer)
.credentialSchema(credentialSchema)...build();
// Set blockchain network information and create API object
FabricContractApi contractApi = (FabricContractApi) ContractFactory.FABRIC.create("application.properties");
// Call
contractApi.registVcMetadata(vcMeta);
}
FabricContractApi
getVcMetadata
Specific VC metadata Retrieval
Parameter | Type | Description | M/O | Notes |
---|---|---|---|---|
vcId | string | VC ID | M |
Type | Description | M/O | Notes |
---|---|---|---|
VcMeta | VcMeta Object | M |
// Function declaration in Java
VcMeta getVcMetadata(String vcId) throws BlockChainException;
void getVcMetadataTest() throws Exception {
String vcId = "vcId";
// Set up blockchain network information and create API object
FabricContractApi contractApi = (FabricContractApi) ContractFactory.FABRIC.create("junit-platform.properties");
// Call
VcMeta vcMeta = contractApi.getVcMetadata(vcId);
}
FabricContractApi
updateVcStatus
Change the status of a specific VC
Parameter | Type | Description | M/O | Notes |
---|---|---|---|---|
vcId | string | VC ID | M | |
vcStatus | VcStatus | VC status Enum | M |
VC Status Enum
- ACTIVE
- INACTIVE
- REVOKED
void
// Function declaration in Java
void updateVcStatus(String vcId, VcStatus vcStatus) throws BlockChainException;
void updateVcStatusTest() throws Exception {
String vcId = "vcId";
// Set blockchain network information and create API object
FabricContractApi contractApi = (FabricContractApi) ContractFactory.FABRIC.create("junit-platform.properties");
// Call
contractApi.updateVcStatus(vcId, VcStatus.INACTIVE);
}