Skip to content

Commit

Permalink
chore: change to hastrust for /manufacturer
Browse files Browse the repository at this point in the history
  • Loading branch information
A9-dev committed Sep 3, 2024
1 parent 06a8e54 commit 5119d3d
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { tableCellClasses } from "@mui/material/TableCell";
import { styled } from "@mui/material/styles";
import DoDisturbIcon from "@mui/icons-material/DoDisturb";
import CheckIcon from "@mui/icons-material/Check";
import { useEffect } from "react";

const StyledTableRow = styled(TableRow)(({ theme }) => ({
"&:nth-of-type(even)": {
Expand Down Expand Up @@ -126,18 +125,14 @@ export default function ManufacturerInfoTable({ manufacturerData }) {
<StyledTableCell align="right">
<Chip
icon={
manufacturerData.CanIssueManufacturerTrust ? (
manufacturerData.HasTrust ? (
<CheckIcon />
) : (
<DoDisturbIcon />
)
}
label={manufacturerData.CanIssueManufacturerTrust.toString()}
color={
manufacturerData.CanIssueManufacturerTrust
? "success"
: "error"
}
label={manufacturerData.HasTrust.toString()}
color={manufacturerData.HasTrust ? "success" : "error"}
/>
</StyledTableCell>
</StyledTableRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const Page = ({ params }) => {
},
],

CanIssueManufacturerTrust: false,
HasTrust: false,
});

const [permissionedUsers, setPermissionedUsers] = useState([]);
Expand Down
6 changes: 5 additions & 1 deletion packages/cahn_demo/server/emailToPublicKeys.json
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
{}
{
"henry@nquiringminds.com": [
"+Wyk2K/P5tDL+GlgV7UdY/CGU/5Jx38rp3JPk1v7JVI="
]
}
2 changes: 1 addition & 1 deletion packages/cahn_demo/server/output/output.pl
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,6 @@
),

% Format the output
format(atom(ManufacturerData), '{"CreatedAtManufacturer": "~w", "ManufacturerId": "~w", "Manufacturer": "~w", "DeviceTypes": ~w, "CanIssueManufacturerTrust": ~w}',
format(atom(ManufacturerData), '{"CreatedAtManufacturer": "~w", "ManufacturerId": "~w", "Manufacturer": "~w", "DeviceTypes": ~w, "HasTrust": ~w}',
[CreatedAtManufacturer, ManufacturerId, Manufacturer, DeviceTypeDataList, CanIssueManufacturerTrust]).

6 changes: 2 additions & 4 deletions packages/cahn_demo/server/output/output_db.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
created(1725284556.401133).
assert(device_type_trust("henry@nquiringminds.com",1725284541476,"EvilPhone-id")).
assert(manufacturer_trust(1725284533884,"EvilInc-id","henry@nquiringminds.com")).
created(1725348180.9507234).
assert(user(false,_,false,1725348171449,"henry@nquiringminds.com","henry-user")).
assert(device_type(1723716151033,"TrustPhone-id","TrustPhone")).
assert(device_type(1723716151033,"VulnerableCamera-id","VulnerableCamera")).
assert(device_type(1723716151033,"EvilPhone-id","EvilPhone")).
Expand Down Expand Up @@ -30,4 +29,3 @@
assert(sbom(1723716151033,"VulnerableCameraSBOM-id","VulnerableCamera SBOM information")).
assert(manufacturer(1723716151033,"EvilInc-id","EvilInc")).
assert(manufacturer(1723716151033,"TrustCorp-id","TrustCorp")).
assert(user(true,true,true,1725284526714,"henry@nquiringminds.com","henry-user")).
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"@context":["https://www.w3.org/ns/credentials/v2"],"id":"urn:uuid:2bc4c672-90d5-42aa-a2c3-52142c07e515","type":["VerifiableCredential","UserCredential"],"name":null,"description":null,"issuer":"urn:uuid:585df7b5-8891-4630-9f5d-a5659f3abe04","validFrom":"2024-08-28T14:15:50.307579Z","validUntil":null,"credentialStatus":null,"credentialSchema":{"id":"https://github.com/nqminds/ClaimCascade/blob/claim_verifier/packages/claim_verifier/user.yaml","type":"JsonSchema"},"credentialSubject":{"type":"fact","schemaName":"user","id":"083cef13-d875-4327-9809-664c4e87f2dc","timestamp":1716287268891,"fact":{"id":"henry@nquiringminds.com","username":"henry-user","created_at":1725348171449,"can_issue_device_trust":false,"can_issue_manufacturer_trust":false}}}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"type": "rule",
"id": "b1c3d5e4-f5g6-7h89-i0j1-2k3l4m5n6o7p",
"timestamp": 1724315344564,
"rule": "output_manufacturer_data(ManufacturerId, ManufacturerData) :-\n manufacturer(CreatedAtManufacturer, ManufacturerId, Manufacturer),\n\n % Retrieve device type data for devices manufactured by this manufacturer\n findall(DeviceTypeData, (\n manufactured(_CreatedAtManufactured, DeviceTypeId, ManufacturerId),\n\n % Retrieve device type information\n (device_type(CreatedAtDeviceType, DeviceTypeId, DeviceType) ->\n true\n ;\n (CreatedAtDeviceType = unknown, DeviceType = unknown)\n ),\n\n format(atom(DeviceTypeData), '{\"DeviceTypeId\": \"~w\", \"CreatedAtDeviceType\": \"~w\", \"DeviceType\": \"~w\"}', \n [DeviceTypeId, CreatedAtDeviceType, DeviceType])\n ), DeviceTypeDataList),\n\n % Check if there is a user that can issue manufacturer trust\n ( \n once((manufacturer_trust(_, ManufacturerId, UserId), user(_, true, _, _, UserId, _))) ->\n CanIssueManufacturerTrust = true\n ; \n CanIssueManufacturerTrust = false\n ),\n\n % Format the output\n format(atom(ManufacturerData), '{\"CreatedAtManufacturer\": \"~w\", \"ManufacturerId\": \"~w\", \"Manufacturer\": \"~w\", \"DeviceTypes\": ~w, \"CanIssueManufacturerTrust\": ~w}', \n [CreatedAtManufacturer, ManufacturerId, Manufacturer, DeviceTypeDataList, CanIssueManufacturerTrust])."
"rule": "output_manufacturer_data(ManufacturerId, ManufacturerData) :-\n manufacturer(CreatedAtManufacturer, ManufacturerId, Manufacturer),\n\n % Retrieve device type data for devices manufactured by this manufacturer\n findall(DeviceTypeData, (\n manufactured(_CreatedAtManufactured, DeviceTypeId, ManufacturerId),\n\n % Retrieve device type information\n (device_type(CreatedAtDeviceType, DeviceTypeId, DeviceType) ->\n true\n ;\n (CreatedAtDeviceType = unknown, DeviceType = unknown)\n ),\n\n format(atom(DeviceTypeData), '{\"DeviceTypeId\": \"~w\", \"CreatedAtDeviceType\": \"~w\", \"DeviceType\": \"~w\"}', \n [DeviceTypeId, CreatedAtDeviceType, DeviceType])\n ), DeviceTypeDataList),\n\n % Check if there is a user that can issue manufacturer trust\n ( \n once((manufacturer_trust(_, ManufacturerId, UserId), user(_, true, _, _, UserId, _))) ->\n CanIssueManufacturerTrust = true\n ; \n CanIssueManufacturerTrust = false\n ),\n\n % Format the output\n format(atom(ManufacturerData), '{\"CreatedAtManufacturer\": \"~w\", \"ManufacturerId\": \"~w\", \"Manufacturer\": \"~w\", \"DeviceTypes\": ~w, \"HasTrust\": ~w}', \n [CreatedAtManufacturer, ManufacturerId, Manufacturer, DeviceTypeDataList, CanIssueManufacturerTrust])."
}
}

0 comments on commit 5119d3d

Please sign in to comment.