Skip to content

Commit

Permalink
Improved MRV sender for testing purposes;
Browse files Browse the repository at this point in the history
  • Loading branch information
Neurone committed Sep 10, 2024
1 parent e79edf7 commit 2327ecb
Show file tree
Hide file tree
Showing 8 changed files with 223 additions and 131 deletions.
22 changes: 22 additions & 0 deletions docker-compose-minimal-prebuilt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ services:
command: "--setParameter allowDiskUseByDefault=true"
expose:
- 27017

mongo-express:
image: mongo-express:1.0.2-20
expose:
- 8081
environment:
ME_CONFIG_MONGODB_SERVER: mongo
ME_CONFIG_MONGODB_PORT: 27017
ME_CONFIG_SITE_BASEURL: /mongo-admin # default credentials: admin/pass
depends_on:
- mongo

cache:
image: registry.redict.io/redict:7.3.0
Expand Down Expand Up @@ -211,6 +222,17 @@ services:
- 6555
- 5007

mrv-sender:
build:
context: .
dockerfile: ./mrv-sender/Dockerfile
init: true
ports:
- "5008:5008"
expose:
- 3005
- 5008

web-proxy:
build:
context: .
Expand Down
55 changes: 55 additions & 0 deletions mrv-sender/examples/test_irec.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"url": "http://api-gateway:3002/external",
"hederaAccountId": "0.0.4460386",
"installer": "did:hedera:testnet:5rKAhDF63SxqaRn1zDKVRjHFf3prtH5f2EzfCTrhqCMP_0.0.4459393",
"did": "did:hedera:testnet:2tGuMfAUQUQcjupm5oGwhwZWQ57LiJv8Ru9yYZZPZGBg_0.0.4460409",
"type": "2d8a13d8-5ff1-49bf-8be5-b92e851ad2b8&1.0.0",
"schema": {
"@context": {
"@version": 1.1,
"@vocab": "https://w3id.org/traceability/#undefinedTerm",
"id": "@id",
"type": "@type",
"2d8a13d8-5ff1-49bf-8be5-b92e851ad2b8&1.0.0": {
"@id": "#2d8a13d8-5ff1-49bf-8be5-b92e851ad2b8&1.0.0",
"@context": {
"field0": { "@type": "https://www.schema.org/text" },
"field1": { "@type": "https://www.schema.org/text" },
"field2": { "@type": "https://www.schema.org/text" },
"accountId": { "@type": "https://www.schema.org/text" },
"policyId": { "@type": "https://www.schema.org/text" }
}
}
}
},
"context": {
"type": "2d8a13d8-5ff1-49bf-8be5-b92e851ad2b8&1.0.0",
"@context": ["ipfs://QmYVbXektYbyh3BXwP5twHPy3ZN973NCMifPLTrcPBpZUZ"]
},
"didDocument": {
"@context": "https://www.w3.org/ns/did/v1",
"id": "did:hedera:testnet:2tGuMfAUQUQcjupm5oGwhwZWQ57LiJv8Ru9yYZZPZGBg_0.0.4460409",
"verificationMethod": [
{
"id": "did:hedera:testnet:2tGuMfAUQUQcjupm5oGwhwZWQ57LiJv8Ru9yYZZPZGBg_0.0.4460409#did-root-key",
"type": "Ed25519VerificationKey2018",
"controller": "did:hedera:testnet:2tGuMfAUQUQcjupm5oGwhwZWQ57LiJv8Ru9yYZZPZGBg_0.0.4460409",
"publicKeyBase58": "BZQL88PpKWKgfStZ6ZM7Rc6vjtT1ZuFkvBZSNof3yXrH",
"privateKeyBase58": "2PCZaKiXt2e9aVA4p2BRFEhK5gsEN7aZnQNfibtLGMzfqsaGRFLy9AaBRgxzsgrLaBDL7tbXseZgrDFzG2dnxjR3"
},
{
"id": "did:hedera:testnet:2tGuMfAUQUQcjupm5oGwhwZWQ57LiJv8Ru9yYZZPZGBg_0.0.4460409#did-root-key-bbs",
"type": "Bls12381G2Key2020",
"controller": "did:hedera:testnet:2tGuMfAUQUQcjupm5oGwhwZWQ57LiJv8Ru9yYZZPZGBg_0.0.4460409",
"publicKeyBase58": "tG8KFqo4o7Cte46pgJcXgzj5ewbQADM7irpJAYX6FhRzeiMrXkX2K63nQ8BePoTsjg5Hrj8jV8mwQQ94Pqn6X9uDzpCeHytEdxis52qn5CoLiAxD8g2UWMXbSW2vgtFYZzV"
}
],
"authentication": [
"did:hedera:testnet:2tGuMfAUQUQcjupm5oGwhwZWQ57LiJv8Ru9yYZZPZGBg_0.0.4460409#did-root-key"
],
"assertionMethod": ["#did-root-key", "#did-root-key-bbs"]
},
"policyId": "644aacc2e2c1db8b2ae0fcf6",
"policyTag": "Tag_1682615440701",
"ref": "did:hedera:testnet:2tGuMfAUQUQcjupm5oGwhwZWQ57LiJv8Ru9yYZZPZGBg_0.0.4460409"
}
13 changes: 10 additions & 3 deletions mrv-sender/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,25 @@

<head>
<meta charset="utf-8" />
<title>Title</title>
<title>MRV Sender</title>
<script type="application/javascript" src="script.js"></script>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="style.css" />
</head>

<body>
<div class="container">
<div>
<p>Select a configuration file (i.e. examples/test_irec.config.json). <br />You can load multiple
configurations at the same time.</p>
</div>
<input id="file-input" type="file" name="name" style="display: none" accept=".config.json" />
<div id="config" class="config">
<div class="circle"></div>
</div>
<div>
<p>Once the configuration is ready, press the play button to generate and send a VC every 60 seconds</p>
</div>
<div id="results"></div>
<input id="file-input" type="file" name="name" style="display: none;" accept=".config" />
</div>
</body>

Expand Down
4 changes: 1 addition & 3 deletions mrv-sender/public/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,6 @@ function renderConfigFiles(config, index) {
function startStop(event) {
const btn = event.target;
const index = btn.getAttribute("index");
const status = btn.getAttribute("status");
const config = configs[index];
if (config.start) {
config.start = false;
Expand All @@ -395,7 +394,6 @@ function startStop(event) {
function showHide(event) {
const btn = event.target;
const index = btn.getAttribute("index");
const status = btn.getAttribute("status");
const config = configs[index];
if (config.show) {
config.show = false;
Expand Down Expand Up @@ -436,7 +434,7 @@ async function generateAndSendMRV(config) {

async function getTemplates() {
try {
const result = await fetch(location.href + 'templates', {
const result = await fetch(location.href + 'templates/', {
method: 'GET', // *GET, POST, PUT, DELETE, etc.
mode: 'cors', // no-cors, *cors, same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
Expand Down
File renamed without changes.
Loading

0 comments on commit 2327ecb

Please sign in to comment.