SP server guide (JAVA)
This is the SP SDK(Java) Server Application guide document.
SP API guide document
Unlock KeyManager
Use the KeyManager class to get the secrete key.
String keyManagerFile = "key.wallet";
String keyManagerPass = "keywalletPassword";
IWKeyManager keyManager = new IWKeyManager(keyManagerFile, keyManagerPass);
keyManager.unLock(keyManagerPass, new OnUnLockListener() {
@Override
public void onSuccess() {
System.out.println("KeyManager Unlock onSuccess");
}
@Override
public void onFail(int errCode) {
System.out.println("KeyManager Unlock onFail:" + errCode);
}
@Override
public void onCancel() {
System.out.println("KeyManager Unlock onCancel");
}
});
Read DID document
SP DID document can get it through the IWDID File class.
Use getData() function to transfer to the Jason string.
String issuerDidFile = "sp.did";
IWDIDFile iwdidFile = new IWDIDFile(issuerDidFile);
String didDocJson = iwdidFile.getData();
System.out.println("didDocJson:" + didDocJson);
BlockChain node settings
The RPC address of the blockchain node can be set.
String blockChainNodeUrl = "https://testnet.omnione.net:8889";
ServerInfo serverInfo = new ServerInfo(blockChainNodeUrl);
Agent Server settings
The RPC address of the Agent Server INFO can be set.
String agentUrl = "https://testnet.omnione.net";
ServerInfo agentServerInfo = new ServerInfo(agentUrl);
Send Callback confirmation URL to mobile app
callBackUrl
: URL to VC 검증 restApiqueryParameter
: Key(txid), value(Unique key)PC web : create QR code image
mobile web : send URL Scheme
//qr code data source sample
{
"spProfileUrl": "http://[IP address]:8080/omniissuer/sp/spProfile?txid=GAuw...pguh",
"type": "VC",
"vcLevel": "0"
}
//url scheme sample
omnione://authentication?spurl=http://[IP주소]:8080/omniissuer/shop/spProfileSt?txid=GAuw...pguh
VC verification API
To request the validity verification regarding the mobile app, it should be requested by the JSON format of SpProfile type. SpProfile includes the submit URL(CallBackUrl) of the VC copy.
makeSpProfile: creates the entered data and SpProfile JSON
spVerify
:VC information copay verification API
SP profile
Profile
callBackUrl
: URL for submitting the VC copynonce
: Random value (txid)spName
: SP name
SpProfileParam class : SpProfile data
serverInfo
: Blockchain node server URLkeyManager
: Private key (secrete key) Wallet managermainKeyId
: The stored key on the KeyManager for signing.serviceCode
: SP service code(The registered information on the SP Console)profile
: Profile objectspDid
: SP's DID ID
SpApi.makeSpProfile
makeSpProfile (SpProfileParam spProfileParam)
Return String
spProfileJson
: SP profile JSON String
String callBackUrl = "http://sp.com/verify";
String nonce = "random value";
String spDid = iwdidFile.getData().getId();
Profile profile = new Profile();
profile.setCallBackUrl(callBackUrl);
profile.setSpName("Pay");
profile.setNonce(nonce);
SpProfileParam spProfileParam = new SpProfileParam(
serverInfo,
keyManager,
"key1",
serviceCode,
profile,
spDid);
String spProfileJson = SpApi.makeSpProfile(spProfileParam);
VC Verification
The API for final registration for VC on BlockChain
VC CallBack JSON Structure
vcEncHex
- Encrypted VC copy informationvcId
- VC IDsessionId
- Same value as the SpProfile nonce valueuserDID
- The user's DID ID
VcVerifyParam Class - Registeration data
serverInfo
-Blockchain node server URL URLagentServerInfo
- Agent server URLkeyManager
- private key (Secreate key) Wallet managermainKeyId
- Stored key on the KeyManager for signingvcEncHex
- Encrypted VC copy informationvcId
- VC IDsessionId
- Same value as the SpProfile nonce valueuserDID
- The user's DID IDdidDocuemntPath
- SP DID document file path
SpApi.spVerify Class - reset API
spVerify(vcVerifyParam)
VcResult class - result class
status
- Status information0 = VC creation incomplete
1 = VC creation completed
vcComplete
- Completed VC object
String vcEncHex = "";
String vcId = "";
String sessionId = "";
String userDid = "";
VcVerifyParam vcVerifyParam = new VcVerifyParam(
serverInfo,
agentServerInfo,
keyManager,
"key1",
vcEncHex,
vcId,
sessionId,
userDID,
didDocuemntPath);
VcResult vcResult = SpApi.spVerify(vcVerifyParam);
VerifiableClaim vcComplete = vcResult.getVcComplete();
String vcCompleteJson = vcComplete.toJson();
Last updated
Was this helpful?