diff --git a/configuration.json b/configuration.json index ff62636..5e11653 100644 --- a/configuration.json +++ b/configuration.json @@ -66,21 +66,23 @@ "field_name": "email" } ], - "entity1": "0x59e23b61f42877d14231f05996b9089a2f6081b5", - "didEntity1": "did:ala:quor:redT:59e23b61f42877d14231f05996b9089a2f6081b5", + "entity1": "0x4820ae942d23287c84e8c3b08d415c12e7617fb5", + "didEntity1": "did:ala:quor:redT:4820ae942d23287c84e8c3b08d415c12e7617fb5", "entity2": "0x6d26cdd054ad1f7dd51cfe28e449c4cd33bc3165", "didEntity2": "did:ala:quor:redT:6d26cdd054ad1f7dd51cfe28e449c4cd33bc3165", "entity3": "0x4e9363e45f3b8b6f0ef8d7cdbf4df1d1a36e0089", "didEntity3": "did:ala:quor:redT:4e9363e45f3b8b6f0ef8d7cdbf4df1d1a36e0089", - "subject1": "0x576a5823d80dc7974438c4eb6fc861921d525c3e", - "didSubject1": "did:ala:quor:redT:576a5823d80dc7974438c4eb6fc861921d525c3e", + "subject1": "0x501aacc575022971143af46a647dfbd40179582d", + "didSubject1": "did:ala:quor:redT:501aacc575022971143af46a647dfbd40179582d", "subject2": "0x02976e59938f023e5a868e520401648df6ce8d9d", "didSubject2": "did:ala:quor:redT:02976e59938f023e5a868e520401648df6ce8d9d", "issuerLevel": 2, + "issuedCredentialStatus": 0, "updateSubject1PresentationTo": 2, "updateEntity2PresentationTo": 1, "revokeEntity2Presentation": 3, "updateIssuerCredentialTo": 2, + "updateSubjectCredentialTo": 3, "subject1PresentationStatus": { "exist": true, "status": "2" diff --git a/exampleCredentials/1.addEntity1Credential.js b/exampleCredentials/1.addEntity1Credential.js index 9a578df..0a40bcb 100644 --- a/exampleCredentials/1.addEntity1Credential.js +++ b/exampleCredentials/1.addEntity1Credential.js @@ -94,11 +94,12 @@ fs.writeFileSync( JSON.stringify({ psmhash: credentialHash, jwt: signedJWTCredential }) ) -function addIssuerCredential() { +function updateIssuerCredential() { const issuerCredential = - transactionFactory.credentialRegistry.addIssuerCredential( + transactionFactory.credentialRegistry.updateIssuerCredential( web3, - credentialHash + credentialHash, + configData.issuedCredentialStatus ) console.log('(addIssuerCredential)The transaction is: ', issuerCredential) return issuerCredential @@ -123,7 +124,7 @@ function sendSigned(issuerCredentialSigned) { } async function main() { - const resultIssuerCredential = await addIssuerCredential() + const resultIssuerCredential = await updateIssuerCredential() const issuerCredentialSigned = await entity1Identity.getKnownTransaction( resultIssuerCredential diff --git a/exampleCredentials/3.addSubject1Credential.js b/exampleCredentials/3.addSubject1Credential.js index 1efe885..19d43b4 100644 --- a/exampleCredentials/3.addSubject1Credential.js +++ b/exampleCredentials/3.addSubject1Credential.js @@ -61,12 +61,12 @@ fs.writeFileSync( JSON.stringify({ psmhash: subjectCredentialHash, jwt: signedJWTCredential }) ) -function addSubjectCredential() { +function updateSubjectCredential() { const subjectCredential = - transactionFactory.credentialRegistry.addSubjectCredential( + transactionFactory.credentialRegistry.updateSubjectCredential( web3, subjectCredentialHash, - uri + configData.issuedCredentialStatus ) console.log('(addSubjectCredential)The transaction is: ', subjectCredential) return subjectCredential @@ -92,7 +92,7 @@ function sendSigned(subjectCredentialSigned) { } async function main() { - const resultSubjectCredential = await addSubjectCredential() + const resultSubjectCredential = await updateSubjectCredential() const subjectCredentialSigned = await subject1Identity.getKnownTransaction( resultSubjectCredential diff --git a/exampleCredentials/5.updateEntity1Credential.js b/exampleCredentials/5.updateEntity1Credential.js index 682d76a..7a71b5e 100644 --- a/exampleCredentials/5.updateEntity1Credential.js +++ b/exampleCredentials/5.updateEntity1Credential.js @@ -11,7 +11,7 @@ const Web3 = require('web3') const myBlockchainServiceIp = configData.nodeURL const web3 = new Web3(new Web3.providers.HttpProvider(myBlockchainServiceIp)) -const updateCredentialStatus = transactionFactory.credentialRegistry.updateCredentialStatus( +const updateCredentialStatus = transactionFactory.credentialRegistry.updateIssuerCredential( web3, credentialHash.psmhash, configData.updateIssuerCredentialTo diff --git a/exampleCredentials/6.deleteSubject1Credentials.js b/exampleCredentials/6.deleteSubject1Credentials.js index 0790ec9..9f1b51f 100644 --- a/exampleCredentials/6.deleteSubject1Credentials.js +++ b/exampleCredentials/6.deleteSubject1Credentials.js @@ -12,9 +12,10 @@ const myBlockchainServiceIp = configData.nodeURL const web3 = new Web3(new Web3.providers.HttpProvider(myBlockchainServiceIp)) const deleteCredentialStatus = - transactionFactory.credentialRegistry.deleteSubjectCredential( + transactionFactory.credentialRegistry.updateSubjectCredential( web3, - credentialHash.psmhash + credentialHash.psmhash, + configData.updateSubjectCredentialTo ) const keyDataSubject1 = fs.readFileSync( diff --git a/exampleCredentials/8.revokeEntity1CredentialDirectly.js b/exampleCredentials/8.revokeEntity1CredentialDirectly.js index 68fb8b7..4472884 100644 --- a/exampleCredentials/8.revokeEntity1CredentialDirectly.js +++ b/exampleCredentials/8.revokeEntity1CredentialDirectly.js @@ -119,7 +119,7 @@ const subjectCredentialHash = tokensFactory.tokens.PSMHash( ) //BUILD TRANSACTION updateCredentialStatus WITH transactionFactory LIBRARY -const updateCredentialStatus = transactionFactory.credentialRegistry.updateCredentialStatus( +const updateCredentialStatus = transactionFactory.credentialRegistry.updateIssuerCredential( web3, issuerCredentialHash, configData.updateIssuerCredentialTo diff --git a/exampleCredentials/PSMHashEntity1.json b/exampleCredentials/PSMHashEntity1.json index 7e830d8..05fc2cb 100644 --- a/exampleCredentials/PSMHashEntity1.json +++ b/exampleCredentials/PSMHashEntity1.json @@ -1 +1 @@ -{"psmhash":"0xe0d3d1ac343f15862d3c08fd213c9af2447be86d38c8cba53ee16c87bb78a0f7","jwt":"eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksiLCJraWQiOiJkaWQ6YWxhOnF1b3I6cmVkdDoxMmVlYUNDQTllRWJCNzhlQjk3ZDdjYWM2YiNrZXlzLTEiLCJqd2siOiIweDM1NmUzZmNlNDM1ZDg3MjkwNjJlNTJkMjYzYzBjNzA1YjNjNWUyMDFhOWE5NjA4Y2RiMDcwNzY0ZTZiOGRmMzBhZTg0MjNiNDM5Y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vKsi3BYy-1rwKo36nTv0Jg"} \ No newline at end of file diff --git a/exampleCredentials/PSMHashSubject1.json b/exampleCredentials/PSMHashSubject1.json index b49bd52..f5dba81 100644 --- a/exampleCredentials/PSMHashSubject1.json +++ b/exampleCredentials/PSMHashSubject1.json @@ -1 +1 @@ -{"psmhash":"0x3ecbe35372d223df6af30e53d92ff2aa40e0211b3fb9ee3fa947d14ecd4dbf5b","jwt":"eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NksiLCJraWQiOiJkaWQ6YWxhOnF1b3I6cmVkdDoxMmVlYUNDQTllRWJCNzhlQjk3ZDdjYWM2YiNrZXlzLTEifQ.eyJqdGkiOiJodHRwczovL3d3dy5lbXByZXNhLmNvbS9hbGFzdHJpYS9jcmVkZW50aWFscy8zNzM0IiwiaXNzIjoiZGlkOmFsYTpxdW9yOnJlZFQ6ZDFmNGNmZDk0YTBiM2Q5MmY3MzdmOWExNjY4NWZhNjllZDJjOWE4ZiIsInN1YiI6ImRpZDphbGE6cXVvcjpyZWR0OjB4MTJlZWFDQ0E5ZUViQjc4ZUI5N2Q3Y2FjNmIiLCJpYXQiOjE2NjYxMDYzMTIsImV4cCI6MTU2Mzc4MzM5MiwibmJmIjoxNTYzNzgyNzkyLCJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vYWxhc3RyaWEuZ2l0aHViLmlvL2lkZW50aXR5L2NyZWRlbnRpYWxzL3YxIiwiaHR0cHM6Ly93M2lkLm9yZy9kaWQvdjEiLCJKV1QiXSwidHlwZSI6WyJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIkFsYXN0cmlhVmVyaWZpYWJsZUNyZWRlbnRpYWwiXSwiY3JlZGVudGlhbFN1YmplY3QiOnsiU3R1ZGVudElEIjoiMTEyMzU4MTMiLCJsZXZlbE9mQXNzdXJhbmNlIjoiYmFzaWMifX19.xD3FcnrkgKiw3r1R63_jtRD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VDcmVkZW50aWFsIiwiRHJpdmluZ0xpY2Vuc2UiXSwiY3JlZGVudGlhbFN1YmplY3QiOnsiU3R1ZGVudElEIjoiMTEyMzU4MTMiLCJsZXZlbE9mQXNzdXJhbmNlIjoiYmFzaWMifX19.iB48MV-KBPZJRiWYdd2OMm98-G7merPfPtYudNkYUfS1BdmnJ7JKJLjtbPNg1yi5vKsi3BYy-1rwKo36nTv0Jg"} \ No newline at end of file diff --git a/examplePublicKey/3.isPublicKeyValidForCertainDate.js b/examplePublicKey/3.isPublicKeyValidForCertainDate.js index c0250f2..1061364 100644 --- a/examplePublicKey/3.isPublicKeyValidForCertainDate.js +++ b/examplePublicKey/3.isPublicKeyValidForCertainDate.js @@ -8,17 +8,17 @@ const configData = JSON.parse(rawdata) const myBlockchainServiceIp = configData.nodeURL const web3 = new Web3(new Web3.providers.HttpProvider(myBlockchainServiceIp)) -if (configData.entity3 === undefined) { +if (configData.entity1 === undefined) { console.error('You must create an Alastria ID') process.exit(1) } console.log('We retrive the current public key for entity3') -const entity3PubKeyHash = `${web3.utils.sha3(configData.entity3Pubk.substr(2))}` -const getPubKTx = transactionFactory.publicKeyRegistry.getPublicKeyStatusHash( +const entity1PubKeyHash = `${web3.utils.sha3(configData.entity1Pubk.substr(2))}` +const getPubKTx = transactionFactory.publicKeyRegistry.getPublicKeyStatus( web3, - configData.didEntity3, - entity3PubKeyHash + configData.didEntity1, + entity1PubKeyHash ) web3.eth .call(getPubKTx)