Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
fixing streamlit (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
nitro-neal authored Jan 5, 2023
1 parent b281b74 commit 8669899
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
2 changes: 2 additions & 0 deletions build/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ services:
- "8081:8501"
depends_on:
- web
networks:
- ssi_network
jaeger:
image: jaegertracing/all-in-one:latest
ports:
Expand Down
33 changes: 31 additions & 2 deletions gui/streamlit.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@

st.subheader("Choose a schema to issue a Verifiable Credential against:")


@st.cache
def load_schemas():
schemas = requests.get('https://schema.org/version/latest/schemaorg-current-https.jsonld').json()
Expand Down Expand Up @@ -89,11 +88,41 @@ def load_schemas():
data = st.text_area("Data for credential (depends on schema):", value=json.dumps(data), height=None, max_chars=None,
key=None, help=None)

# TODO: Add dynamic schema payload from dropdown
if st.button("Create Schema"):
sch = {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "postal address",
"type": "object",
"properties": {
"addressLocality": {
"type": "string"
},
"postalCode": {
"type": "string"
},
"streetAddress": {
"type": "string"
}
},
"additionalProperties": False
}

payload = {
"author": did['did']['id'],
"name": "name",
"schema": sch
}

schema_output = requests.put('http://web:3000/v1/schemas', data=json.dumps(payload)).json()
st.write(schema_output)
st.session_state.schema_id = schema_output['id']

if st.button("Issue Verifiable Credential"):
payload = {
"Issuer": did['did']['id'],
"Subject": did['did']['id'],
"Schema": "https://schema.org/" + schema.split(":")[1],
"Schema": st.session_state.schema_id,
"Data": json.loads(data),
"Expiry": str(expiry) + "T00:00:00+00:00"
}
Expand Down

0 comments on commit 8669899

Please sign in to comment.