- Print
- DarkLight
- PDF
Steps and allowed operators
On the attestation rules there are different operations available.
Figure 1 - attestation rule
You can compare strings, numbers, variable and booleans.
The only attention point is to compare the same types, the enclave cannot compare numbers with strings.
Here are some operations that can be completed:
Operators | Allowed operands | Note |
---|---|---|
==, != | {N:N} {T:T} {A:A} {B:B} | Same datatype only |
Contains, does not contain | {A:N} {A:T} {A:B} | Array and element |
is in, is not in | {N:A} {T:A} {B:A} | Element and array |
<, >, <=, >= | {N:N} | Numerical operator |
Compare Arrays
To compare arrays it is possible to use the following 4 Rule's operators:
- Contains
- Not contains
- In
- Not in
With the first two, the array is the source
with the second two the array is the Target:
Logical Operators
In Silent Data [Oracle] the logical operators can be used on the UI to complete the following examples.
With the buttons AND and OR you can use the different logical operators. with the GROUP button, you can create nested logical operations. To remove a nested operation use the DELETE button.
Example number 1: A>0 && B>0 && (C>0 || D>0)
By saving your Job you can see the JSON format of your Job Configuration
//ATTESTATION with logical operators - A>0 && B>0 && (C>0 || D>0)
{
"type": "ATTESTATION",
"rules": {
"type": "AND",
"conditions": [
{
"source": "${STEPS[1].data.variableA}",
"operator": ">",
"target": 0
},
{
"source": "${STEPS[1].data.variableB}",
"operator": ">",
"target": 0
},
{
"type": "OR",
"conditions": [
{
"source": "${STEPS[1].data.variableC}",
"operator": ">",
"target": 0
},
{
"source": "${STEPS[1].data.variableD}",
"operator": ">",
"target": 0
}
]
}
]
}
}
Example number 2: (A>0 || B>0) && (C>0 || D>0)
By saving your Job you can see the JSON format of your Job Configuration
//ATTESTATION with logical operators - (A>0 || B>0) && (C>0 || D>0)
{
"type": "ATTESTATION",
"rules": {
"type": "AND",
"conditions": [
{
"type": "OR",
"conditions": [
{
"source": "${STEPS[1].data.variableA}",
"operator": ">",
"target": 0
},
{
"source": "${STEPS[1].data.variableB}",
"operator": ">",
"target": 0
}
]
},
{
"type": "OR",
"conditions": [
{
"source": "${STEPS[1].data.variableC}",
"operator": ">",
"target": 0
},
{
"source": "${STEPS[1].data.variableD}",
"operator": ">",
"target": 0
}
]
}
]
}
}
Example number 3: (A>0 || B>0) && (C>0 && (D>0||E>0))
By saving your Job you can see the JSON format of your Job Configuration
//ATTESTATION with logical operators - (A>0 || B>0) && (C>0 && (D>0||E>0))
{
"type": "ATTESTATION",
"rules": {
"type": "AND",
"conditions": [
{
"type": "OR",
"conditions": [
{
"source": "${STEPS[1].data.variableA}",
"operator": ">",
"target": 0
},
{
"source": "${STEPS[1].data.variableB}",
"operator": ">",
"target": 0
}
]
},
{
"type": "AND",
"conditions": [
{
"source": "${STEPS[1].data.variableC}",
"operator": ">",
"target": 0
},
{
"type": "OR",
"conditions": [
{
"source": "${STEPS[1].data.variableD}",
"operator": ">",
"target": 0
},
{
"source": "${STEPS[1].data.variableE}",
"operator": ">",
"target": 0
}
]
}
]
}
]
}
}