Skip to content

Commit ff0ca6a

Browse files
Merge pull request #1 from onix-labs/1.0.0
1.0.0
2 parents 0f198e0 + 04a2b9f commit ff0ca6a

File tree

7 files changed

+105
-3
lines changed

7 files changed

+105
-3
lines changed

build.gradle

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,20 @@ buildscript {
1414
junit_version = '5.3.1'
1515

1616
onixlabs_group = 'io.onixlabs'
17-
onixlabs_corda_core_release_version = '1.0.0-rc5'
17+
onixlabs_corda_core_release_version = '1.0.0'
1818

1919
cordapp_platform_version = 8
20-
cordapp_signing_enabled = true
2120
cordapp_contract_name = 'ONIXLabs Corda Identity Framework Contract'
2221
cordapp_workflow_name = 'ONIXLabs Corda Identity Framework Workflow'
2322
cordapp_vendor_name = 'ONIXLabs'
2423
cordapp_license = 'Apache License, Version 2.0'
2524
cordapp_version_id = 1
25+
26+
cordapp_signing_enabled = true
27+
cordapp_signing_alias = 'cordapp-signer'
28+
cordapp_signing_storetype = 'PKCS12'
29+
cordapp_signing_keystore = getProperty('jar.sign.keystore')
30+
cordapp_signing_password = getProperty('jar.sign.password')
2631
}
2732

2833
repositories {
@@ -40,7 +45,7 @@ buildscript {
4045
}
4146

4247
group 'io.onixlabs'
43-
version '1.0.0-rc7'
48+
version '1.0.0'
4449

4550
subprojects {
4651
repositories {

onixlabs-corda-identity-framework-contract/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ cordapp {
99
}
1010
signing {
1111
enabled = cordapp_signing_enabled
12+
options {
13+
keystore cordapp_signing_keystore
14+
alias cordapp_signing_alias
15+
storepass cordapp_signing_password
16+
keypass cordapp_signing_password
17+
storetype cordapp_signing_storetype
18+
}
1219
}
1320
}
1421

onixlabs-corda-identity-framework-contract/src/main/kotlin/io/onixlabs/corda/identityframework/contract/CordaClaimContract.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ open class CordaClaimContract : Contract {
6666
internal const val CONTRACT_RULE_OUTPUTS =
6767
"On claim issuing, only one claim state must be created."
6868

69+
internal const val CONTRACT_RULE_ISSUER_PARTICIPANT =
70+
"On claim issuing, the issuer of the created claim state must be a participant."
71+
72+
internal const val CONTRACT_RULE_HOLDER_PARTICIPANT =
73+
"On claim issuing, the holder of the created claim state must be a participant."
74+
6975
internal const val CONTRACT_RULE_SIGNERS =
7076
"On claim issuing, the issuer must sign the transaction."
7177
}
@@ -80,6 +86,12 @@ open class CordaClaimContract : Contract {
8086
internal const val CONTRACT_RULE_OUTPUTS =
8187
"On claim amending, only one claim state must be created."
8288

89+
internal const val CONTRACT_RULE_ISSUER_PARTICIPANT =
90+
"On claim amending, the issuer of the created claim state must be a participant."
91+
92+
internal const val CONTRACT_RULE_HOLDER_PARTICIPANT =
93+
"On claim amending, the holder of the created claim state must be a participant."
94+
8395
internal const val CONTRACT_RULE_STATE_REF =
8496
"On claim amending, the created claim state must point to the consumed claim state."
8597

@@ -143,6 +155,8 @@ open class CordaClaimContract : Contract {
143155

144156
val claimOutput = claimOutputs.single()
145157

158+
Issue.CONTRACT_RULE_ISSUER_PARTICIPANT using (claimOutput.issuer in claimOutput.participants)
159+
Issue.CONTRACT_RULE_HOLDER_PARTICIPANT using (claimOutput.holder in claimOutput.participants)
146160
Issue.CONTRACT_RULE_SIGNERS using (claimOutput.issuer.owningKey in signers)
147161

148162
onVerifyIssue(transaction, signers)
@@ -164,6 +178,8 @@ open class CordaClaimContract : Contract {
164178
val claimInput = claimInputs.single()
165179
val claimOutput = claimOutputs.single()
166180

181+
Amend.CONTRACT_RULE_ISSUER_PARTICIPANT using (claimOutput.issuer in claimOutput.participants)
182+
Amend.CONTRACT_RULE_HOLDER_PARTICIPANT using (claimOutput.holder in claimOutput.participants)
167183
Amend.CONTRACT_RULE_STATE_REF using (claimOutput.isPointingTo(claimInput))
168184
Amend.CONTRACT_RULE_CHANGES using (claimOutput.internalImmutableEquals(claimInput.state.data))
169185
Amend.CONTRACT_RULE_SIGNERS using (claimOutput.issuer.owningKey in signers)

onixlabs-corda-identity-framework-contract/src/test/kotlin/io/onixlabs/corda/identityframework/contract/MockData.kt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616

1717
package io.onixlabs.corda.identityframework.contract
1818

19+
import net.corda.core.contracts.BelongsToContract
1920
import net.corda.core.contracts.StateRef
21+
import net.corda.core.contracts.UniqueIdentifier
2022
import net.corda.core.crypto.SecureHash
23+
import net.corda.core.identity.AbstractParty
2124
import net.corda.core.identity.CordaX500Name
2225
import net.corda.testing.core.DUMMY_NOTARY_NAME
2326
import net.corda.testing.core.TestIdentity
@@ -31,3 +34,19 @@ val CLAIM_1 = CordaClaim(IDENTITY_A.party, IDENTITY_B.party, "example", "Hello,
3134
val CLAIM_2 = CordaClaim(IDENTITY_B.party, IDENTITY_B.party, "example", 123)
3235

3336
val EMPTY_REF = StateRef(SecureHash.zeroHash, 0)
37+
38+
@BelongsToContract(CordaClaimContract::class)
39+
class CustomCordaClaim(
40+
value: String = "Hello, World!",
41+
previousStateRef: StateRef? = null,
42+
override val participants: List<AbstractParty> = emptyList()
43+
) : CordaClaim<String>(IDENTITY_A.party, IDENTITY_B.party, "example", value, UniqueIdentifier(), previousStateRef) {
44+
45+
override fun amend(previousStateRef: StateRef, value: String): CordaClaim<String> {
46+
return CustomCordaClaim(value, previousStateRef)
47+
}
48+
49+
fun withIssuerAndHolder() = CustomCordaClaim(participants = listOf(issuer, holder))
50+
fun withoutIssuer() = CustomCordaClaim(participants = listOf(holder))
51+
fun withoutHolder() = CustomCordaClaim(participants = listOf(issuer))
52+
}

onixlabs-corda-identity-framework-contract/src/test/kotlin/io/onixlabs/corda/identityframework/contract/claims/CordaClaimContractAmendCommandTests.kt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,32 @@ class CordaClaimContractAmendCommandTests : ContractTest() {
6464
}
6565
}
6666

67+
@Test
68+
fun `On claim amending, the issuer of the created claim state must be a participant`() {
69+
services.ledger {
70+
transaction {
71+
val issuedClaim1 = issue(CustomCordaClaim().withIssuerAndHolder())
72+
input(issuedClaim1.ref)
73+
output(CordaClaimContract.ID, issuedClaim1.amend("Amended Value").withoutIssuer())
74+
command(keysOf(IDENTITY_A), CordaClaimContract.Amend)
75+
failsWith(CordaClaimContract.Amend.CONTRACT_RULE_ISSUER_PARTICIPANT)
76+
}
77+
}
78+
}
79+
80+
@Test
81+
fun `On claim amending, the holder of the created claim state must be a participant`() {
82+
services.ledger {
83+
transaction {
84+
val issuedClaim1 = issue(CustomCordaClaim().withIssuerAndHolder())
85+
input(issuedClaim1.ref)
86+
output(CordaClaimContract.ID, issuedClaim1.amend("Amended Value").withoutHolder())
87+
command(keysOf(IDENTITY_A), CordaClaimContract.Amend)
88+
failsWith(CordaClaimContract.Amend.CONTRACT_RULE_HOLDER_PARTICIPANT)
89+
}
90+
}
91+
}
92+
6793
@Test
6894
fun `On claim amending, the created claim state must point to the consumed claim state`() {
6995
services.ledger {

onixlabs-corda-identity-framework-contract/src/test/kotlin/io/onixlabs/corda/identityframework/contract/claims/CordaClaimContractIssueCommandTests.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,28 @@ class CordaClaimContractIssueCommandTests : ContractTest() {
5757
}
5858
}
5959

60+
@Test
61+
fun `On claim issuing, the issuer of the created claim state must be a participant`() {
62+
services.ledger {
63+
transaction {
64+
output(CordaClaimContract.ID, CustomCordaClaim().withoutIssuer())
65+
command(keysOf(IDENTITY_A), CordaClaimContract.Issue)
66+
failsWith(CordaClaimContract.Issue.CONTRACT_RULE_ISSUER_PARTICIPANT)
67+
}
68+
}
69+
}
70+
71+
@Test
72+
fun `On claim issuing, the holder of the created claim state must be a participant`() {
73+
services.ledger {
74+
transaction {
75+
output(CordaClaimContract.ID, CustomCordaClaim().withoutHolder())
76+
command(keysOf(IDENTITY_A), CordaClaimContract.Issue)
77+
failsWith(CordaClaimContract.Issue.CONTRACT_RULE_HOLDER_PARTICIPANT)
78+
}
79+
}
80+
}
81+
6082
@Test
6183
fun `On claim issuing, the issuer must sign the transaction`() {
6284
services.ledger {

onixlabs-corda-identity-framework-workflow/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ cordapp {
99
}
1010
signing {
1111
enabled = cordapp_signing_enabled
12+
options {
13+
keystore cordapp_signing_keystore
14+
alias cordapp_signing_alias
15+
storepass cordapp_signing_password
16+
keypass cordapp_signing_password
17+
storetype cordapp_signing_storetype
18+
}
1219
}
1320
}
1421

0 commit comments

Comments
 (0)