-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from decentralgabe/feat/other-media-types
Update rendering to support other media types
- Loading branch information
Showing
19 changed files
with
10,555 additions
and
3,690 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Deploy static content to Pages | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["main"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Single deploy job since we're just deploying | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
# Upload entire repository | ||
path: '.' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
|
||
.idea | ||
.DS_Store | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,130 @@ | ||
import { eventHandler } from "./src/eventHandler"; | ||
|
||
self.addEventListener("message", eventHandler); | ||
import {getHtml} from './src/getHtml'; | ||
|
||
import { getPrivateKey } from './src/exampleKey'; | ||
import { getCoseExample } from './src/exampleCose'; | ||
import { getJwtExample } from './src/exampleJwt'; | ||
import { getSdJwtExample } from './src/exampleSdJwt'; | ||
|
||
|
||
|
||
async function processVcJoseCose() { | ||
// add styling for examples | ||
addVcJoseStyles(); | ||
const examples = Array.from(document.querySelectorAll(".vc-jose-cose")).filter((e) => !!e.innerText) | ||
for (const index in examples) { | ||
const example = examples[index] | ||
const json = JSON.parse(example.innerText.replace(/\/\/ .*$/gm, '')) | ||
const processedData = await processExample(index, json); | ||
example.outerHTML = processedData.html | ||
} | ||
} | ||
|
||
function addVcJoseStyles() { | ||
const styles = document.createElement('style'); | ||
|
||
styles.innerHTML += ` | ||
.vc-jose-cose-tabbed { | ||
overflow-x: hidden; | ||
margin: 0 0; | ||
} | ||
.vc-jose-cose-tabbed h1 { | ||
font-size: 1em; | ||
} | ||
.vc-jose-cose-tabbed [type="radio"] { | ||
display: none; | ||
} | ||
.vc-jose-cose-tabs { | ||
display: flex; | ||
align-items: stretch; | ||
list-style: none; | ||
padding: 0; | ||
border-bottom: 1px solid #ccc; | ||
} | ||
li.vc-jose-cose-tab { | ||
margin: unset; | ||
margin-left: 8px; | ||
} | ||
.vc-jose-cose-tab>label { | ||
display: block; | ||
margin-bottom: -1px; | ||
padding: .4em .5em; | ||
border: 1px solid #ccc; | ||
border-top-right-radius: .4em; | ||
border-top-left-radius: .4em; | ||
background: #eee; | ||
color: #666; | ||
cursor: pointer; | ||
transition: all 0.3s; | ||
} | ||
.vc-jose-cose-tab:hover label { | ||
border-left-color: #333; | ||
border-top-color: #333; | ||
border-right-color: #333; | ||
color: #333; | ||
} | ||
.vc-jose-cose-tab-content { | ||
display: none; | ||
} | ||
.vc-jose-cose-tabbed [type="radio"]:nth-of-type(1):checked~.vc-jose-cose-tabs .vc-jose-cose-tab:nth-of-type(1) label, | ||
.vc-jose-cose-tabbed [type="radio"]:nth-of-type(2):checked~.vc-jose-cose-tabs .vc-jose-cose-tab:nth-of-type(2) label, | ||
.vc-jose-cose-tabbed [type="radio"]:nth-of-type(3):checked~.vc-jose-cose-tabs .vc-jose-cose-tab:nth-of-type(3) label { | ||
border-bottom-color: #fff; | ||
background: #fff; | ||
color: #222; | ||
} | ||
.vc-jose-cose-tabbed [type="radio"]:nth-of-type(1):checked~.vc-jose-cose-tab-content:nth-of-type(1), | ||
.vc-jose-cose-tabbed [type="radio"]:nth-of-type(2):checked~.vc-jose-cose-tab-content:nth-of-type(2), | ||
.vc-jose-cose-tabbed [type="radio"]:nth-of-type(3):checked~.vc-jose-cose-tab-content:nth-of-type(3) { | ||
display: block; | ||
} | ||
.sd-jwt-header, .jwt-header { | ||
color: red | ||
} | ||
.sd-jwt-payload, .jwt-payload { | ||
color: green | ||
} | ||
.sd-jwt-signature, .jwt-signature { | ||
color: blue | ||
} | ||
.sd-jwt-disclosure { | ||
color: purple | ||
} | ||
.sd-jwt-compact, .jwt-compact { | ||
background-color: rgba(0,0,0,.03); | ||
} | ||
.cose-text, .jose-text { | ||
font-family: monospace; | ||
} | ||
`; | ||
|
||
document.head.appendChild(styles); | ||
} | ||
|
||
export async function processExample(index, json) { | ||
const privateKey = await getPrivateKey(); | ||
const coseExample = await getCoseExample(privateKey, json); | ||
const jwtExample = await getJwtExample(privateKey, json); | ||
const sdJwtExample = await getSdJwtExample(privateKey, json); | ||
const html = getHtml({index, coseExample, jwtExample, sdJwtExample}); | ||
return {html}; | ||
} | ||
|
||
window.respecVcJoseCose = { | ||
processVcJoseCose | ||
} |
Oops, something went wrong.