Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
51caa45
initialize package with http-server for testing
jchartrand Dec 22, 2025
dc5900e
add rollup build
jchartrand Dec 22, 2025
8e35db2
update page
jchartrand Dec 22, 2025
3e5425a
push dist for now to allow Github pages to work
jchartrand Dec 22, 2025
7d9bb1a
add rollup node package resolver
jchartrand Dec 22, 2025
4efc33e
add test credential
jchartrand Dec 22, 2025
3c46f5a
add node resolver to rollup config
jchartrand Dec 22, 2025
7063a1e
add verifier-core call
jchartrand Dec 22, 2025
db91031
switch test cred to an object
jchartrand Dec 23, 2025
a51de7c
switch to using webpack bundle
jchartrand Dec 23, 2025
b0f86df
switch to webpack from rollup
jchartrand Dec 23, 2025
3d12abc
clean out dist
jchartrand Dec 23, 2025
0a47b4b
add webpack dev server
jchartrand Dec 23, 2025
86bd4ee
force single webpack bundle
jchartrand Dec 23, 2025
a6f3ba7
switch to DB vc for signature verification
jchartrand Dec 29, 2025
4c5858b
trigger verification from button
jchartrand Dec 29, 2025
16f5a80
display signature result
jchartrand Dec 29, 2025
94dcea8
show/hide containers instead of dynamically adding
jchartrand Dec 29, 2025
cde9770
rework spinners, checks, and layout
jchartrand Dec 30, 2025
ee6ad50
push bundle for Pages deployment
jchartrand Dec 30, 2025
f0b7398
add vc url/json resolver
jchartrand Dec 31, 2025
a57b078
add expiry handling
jchartrand Dec 31, 2025
9b4565f
add better expiration date messages
jchartrand Dec 31, 2025
60f10f9
add red X on failure
jchartrand Dec 31, 2025
a9a4972
dynamically draw red x
jchartrand Dec 31, 2025
ed58c2e
fix alignment
jchartrand Dec 31, 2025
fcd6d86
rebuild for Pages
jchartrand Dec 31, 2025
064140b
add separate status check to avoid CORS preflight errors
jchartrand Dec 31, 2025
4d007f6
build for Pages
jchartrand Dec 31, 2025
321c647
fix overlaid cross and checkmark
jchartrand Dec 31, 2025
17ce165
add issuer lookup
jchartrand Jan 1, 2026
ad3130e
rebuild for pages
jchartrand Jan 1, 2026
ad7c8f9
set up playwright and first test
jchartrand Jan 2, 2026
90190c7
add more tests
jchartrand Jan 2, 2026
ca59757
display credential details if signature and issuer are valid
jchartrand Jan 2, 2026
bac6830
fix invalid signature handling
jchartrand Jan 2, 2026
821028e
update build for github Pages
jchartrand Jan 2, 2026
8f24313
styling
jchartrand Jan 3, 2026
76cc0ca
fix styling
jchartrand Jan 3, 2026
3f209c8
rework credential display
jchartrand Jan 6, 2026
bf1e905
rework styling
jchartrand Jan 6, 2026
5c2519e
display cleanup
jchartrand Jan 6, 2026
ace42bc
more styling
jchartrand Jan 6, 2026
c18a0a5
add wait spinner for fetches
jchartrand Jan 6, 2026
964cc02
rework promises to display progress
jchartrand Jan 6, 2026
242c827
big rework of shadow DOM selection
jchartrand Jan 6, 2026
342bbf2
build for Pages deployment
jchartrand Jan 6, 2026
58c5f22
add drag and drop option
jchartrand Jan 7, 2026
fcf7e3a
remove listeners on close
jchartrand Jan 7, 2026
e36b614
add reset option
jchartrand Jan 7, 2026
0579d97
build for pages
jchartrand Jan 7, 2026
fb2265d
fix pointer to bundle for Pages
jchartrand Jan 7, 2026
9e391ac
remove old data on reset
jchartrand Jan 7, 2026
1f8d6ee
add details dialog
jchartrand Jan 7, 2026
de22b51
remove focus from modal
jchartrand Jan 7, 2026
572249a
font, color, alignment changes
jchartrand Jan 8, 2026
84707e2
first crack at readme
jchartrand Jan 8, 2026
adffec6
add slot header content to page
jchartrand Jan 8, 2026
5a73930
reorganize styles
jchartrand Jan 8, 2026
1acaf97
remove header in favour of slot content
jchartrand Jan 8, 2026
6a0383a
add public verify method to element
jchartrand Jan 8, 2026
782043e
update README
jchartrand Jan 8, 2026
b7a178b
add event listener to html
jchartrand Jan 8, 2026
7af7e76
fire custom event when component is ready
jchartrand Jan 8, 2026
1157e3b
switch sample vc to include holder name
jchartrand Jan 8, 2026
d77d012
reset spinners after clicking verify-another button
jchartrand Jan 8, 2026
bf53839
add verification from req param
jchartrand Jan 8, 2026
2850cab
build for Pages
jchartrand Jan 8, 2026
df29c74
add named slots for header and prepositional phrases
jchartrand Jan 9, 2026
badcf5f
bundle for Pages deployment
jchartrand Jan 9, 2026
04f722c
remove issuer-registry-client package
jchartrand Jan 9, 2026
9f40dbc
update index.html files with did list template
jchartrand Jan 9, 2026
714e8bd
add local did list
jchartrand Jan 9, 2026
0def916
add test did to local list
jchartrand Jan 9, 2026
b9a6b34
fix query selector on local did list template
jchartrand Jan 9, 2026
456de4c
remove old issuer lookup
jchartrand Jan 9, 2026
0fd9a01
add default did list
jchartrand Jan 9, 2026
9ca5135
update readme with did template instructions
jchartrand Jan 9, 2026
99c89b9
fix default did list
jchartrand Jan 9, 2026
39d5f92
fix issuerName property accessor
jchartrand Jan 9, 2026
a503c08
switch to new issuer lookup
jchartrand Jan 9, 2026
2ffd332
rebuild for Pages deployment
jchartrand Jan 9, 2026
d88bfea
add test did to default list
jchartrand Jan 9, 2026
ef4b01f
update sub labels
jchartrand Jan 9, 2026
279a015
rebuild for Pages
jchartrand Jan 9, 2026
476e6bd
fix missing tag bracket
jchartrand Jan 9, 2026
7d8b998
rebuild for Pages
jchartrand Jan 9, 2026
6a54fb9
fix delay
jchartrand Jan 9, 2026
94ca175
build for Pages deployment
jchartrand Jan 9, 2026
2d5c6aa
add test did to list
jchartrand Jan 9, 2026
46482e3
fix revocation message
jchartrand Jan 9, 2026
a945865
rebuild for Pages
jchartrand Jan 9, 2026
1bb96fb
font styling
jchartrand Jan 12, 2026
b87b397
install marked for criteria markdown display
jchartrand Jan 12, 2026
4a779ae
add dialog sections
jchartrand Jan 12, 2026
57dbec2
add test did to local list
jchartrand Jan 12, 2026
d97f9d6
rework dialog
jchartrand Jan 12, 2026
3cda0d4
build for pages
jchartrand Jan 12, 2026
834bb32
fix scroll on dialog
jchartrand Jan 12, 2026
98c6618
fix markdown styling
jchartrand Jan 12, 2026
b47dd70
reset field display when displaying another credential
jchartrand Jan 12, 2026
d9bc237
fix spinner color on second verification
jchartrand Jan 12, 2026
df004fb
build for Pages
jchartrand Jan 12, 2026
19c89f7
move test credential into tests
jchartrand Jan 13, 2026
e4fea34
format issuance date
jchartrand Jan 13, 2026
d7b6195
extend pause before showing button
jchartrand Jan 13, 2026
ad6cb3c
build for Pages
jchartrand Jan 13, 2026
5757ebd
adjust pauses during verification
jchartrand Jan 13, 2026
066fe0b
fix listeners declaration to allow reassignement
jchartrand Jan 13, 2026
546231e
rename package for npm publish
jchartrand Jan 13, 2026
c07a8d9
export the component class
jchartrand Jan 13, 2026
c2a3379
build for pages
jchartrand Jan 13, 2026
d04e0ff
minor change to comments
jchartrand Jan 13, 2026
b0c34a6
update for npm publish
jchartrand Jan 15, 2026
1eac31d
add public method to set did list
jchartrand Jan 15, 2026
9c0ba78
update readme with setIssuerDids explanation
jchartrand Jan 16, 2026
bac4520
fix issuer did errors
jchartrand Jan 16, 2026
2b812f9
add setIssuerDids example to html file
jchartrand Jan 16, 2026
244b7f4
reset all values before new verification
jchartrand Jan 16, 2026
8f5d86e
bump version for npm publish
jchartrand Jan 16, 2026
ddb8d95
fix object check
jchartrand Jan 16, 2026
530f864
version bump
jchartrand Jan 16, 2026
4a15277
update README
jchartrand Jan 20, 2026
d68b351
switch to DCC branded colours
jchartrand Jan 20, 2026
6bf3268
update html example
jchartrand Jan 20, 2026
1f87aa3
build for pages deployment
jchartrand Jan 20, 2026
d146e48
update html examples
jchartrand Jan 20, 2026
c0a71db
fix DCC colours
jchartrand Jan 20, 2026
7bab317
build for deployment
jchartrand Jan 20, 2026
e2825f9
fix event on drag and drop
jchartrand Jan 20, 2026
566889e
change drag and drop hover
jchartrand Jan 20, 2026
d0d6012
update error message color
jchartrand Jan 20, 2026
3541963
make text darker on file hover
jchartrand Jan 20, 2026
90a58d9
fix text area placeholder text color
jchartrand Jan 20, 2026
35b55bf
add screenshot with slot mapping
jchartrand Jan 20, 2026
fc19ddb
update README
jchartrand Jan 20, 2026
1371e4e
update readme
jchartrand Jan 20, 2026
9ab495b
build for deployment
jchartrand Jan 20, 2026
c1b7299
fix expiry test
jchartrand Jan 22, 2026
d26c34c
fix revoked/expired test
jchartrand Jan 22, 2026
b36ed20
add option to disable pauses for testing
jchartrand Jan 22, 2026
22ac1e2
update README with disable-pause explanation
jchartrand Jan 22, 2026
14ea1e4
remove console logging
jchartrand Jan 22, 2026
8a5f445
add test for bad status list
jchartrand Jan 22, 2026
6d7931b
fix error handling on bad status list
jchartrand Jan 22, 2026
44df49d
build for deployment
jchartrand Jan 22, 2026
6348d20
add test for bad credential
jchartrand Jan 22, 2026
75d56c3
switch invalid url to invalid cred test
jchartrand Jan 22, 2026
7ceed3a
add tampered test
jchartrand Jan 22, 2026
e08e1a4
add bad url test
jchartrand Jan 22, 2026
c62321d
add lcw experience issuer did to public demo
jchartrand Jan 23, 2026
88681b8
add lcw experience issuer did to local instance
jchartrand Jan 23, 2026
9017895
add alignment styles
jchartrand Jan 29, 2026
88f0f50
add alignment section
jchartrand Jan 29, 2026
cbfce20
clear alignments on reset
jchartrand Jan 29, 2026
cc8a6d0
add alignments from vc
jchartrand Jan 29, 2026
870714c
build for Pages deployment
jchartrand Jan 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 3 additions & 76 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ coverage
# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

Expand All @@ -41,12 +35,6 @@ build/Release
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

Expand All @@ -62,78 +50,17 @@ web_modules/
# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.*
!.env.example

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Sveltekit cache directory
.svelte-kit/

# vitepress build output
**/.vitepress/dist

# vitepress cache directory
**/.vitepress/cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# Firebase cache directory
.firebase/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v3
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Vite logs files
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

playwright-report/
test-results/
167 changes: 166 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,167 @@
# veri-good
web component for verifying Verifiable Credentials

A [Web Component](https://developer.mozilla.org/en-US/docs/Web/API/Web_components) providing entirely in-browser verification of [Verifiable Credentials](https://www.w3.org/TR/vc-data-model-2.0/).

'In-browser' meaning that the credential is not sent to the server. It never leaves the web browser, and so remains entirely private.

Web components are custom HTML tags that work natively with all modern browsers, and can therefore be dropped into any HTML page, like this simple example:

```
<html>
<body>
<div> put whatever you want around the veri-good tag, like this div </div>

<veri-good></veri-good>

<script type="module" src="=bundle.js"></script>

</body>
</html>
```

You'll need to have saved that bundle.js (which is in the dist directory of this repository) to your server so it
can be downloaded by the web browser.

If you are using a bundler (webpack, rollup, etc.) install from npm:

`npm i @digitalcredentials/veri-good`

and import somewhere like your main entry file (to ensure it gets imported and run):

`import '@digitalcredentials/veri-good'`

Note that we aren't importing anything that gets assigned to a variable. We simply want the import to pull in the code
and run it, which builds the component and registers it with the web browser.

We also provide a separate package that wraps the web component in a react element:

* [@digitalcredentials/veri-good-react github repo](http://github.com/digitalcredentials/veri-good-react)
* [@digitalcredentials/veri-good-react npm package](https://www.npmjs.com/package/@digitalcredentials/veri-good-react)

### Issuer List

The signing [DID (Decentralized Identifier)](https://w3c.github.io/did/) for each credential is looked up in a list of DIDs that you register with the veri-good component. The lookup confirms that the credential was signed by someone you recognize (like yourself).

> [!IMPORTANT]
> Providing this list is critical. The verifier outright rejects any credentials that aren't in the list.

You can set your issuer list in a template inside the `veri-good` tag like so:

```
<body>
<veri-good>
<template id="issuer-dids">
{
"did:web:digitalcredentials.github.io:testDID": {
"issuerName": "Department of Chemistry",
"url": "https://chemistry.uni.edu"
},
"did:key:z6MkjoriXdbyWD25YXTed114F8hdJrLXQ567xxPHAUKxpKkS": {
"issuerName": "Department of Economics",
"url": "https://econ.uni.edu"
}
}
</template>
</veri-good>
<script type="module" src="=bundle.js"></script>
</body>
```

Use the same json structure for your own list.

The issuerName is displayed when verifying a credential issued by that DID.

You can also programmatically set the did list like so:

```
<body>
<veri-good registry-list="https://digitalcredentials.github.io/dcc-known-registries/known-did-registries.json"></veri-good>
<script type="module" src="=bundle.js"></script>
<script>
const verifier = document.querySelector('veri-good')
verifier.addEventListener('veri-good-is-ready', (e) => {
verifier.setIssuerDids(`{
"did:web:digitalcredentials.github.io:testDID": {
"issuerName": "Department of Chemistry",
"url": "https://chemistry.uni.edu"
}}`)
});
</script>
</body>
```

Notice that we have to wait for the web component to finish intializing and fire the 'veri-good-is-ready' event before we can call the 'setIssuerDids' method on it.

You can of course also (and more likely) call setIssuerDids in your own javascript that you bundle up with webpack or the like. In other words, you don't have to call 'setIssuerDids' from a script tag in the html.

### Programmatic Verification

You can programmatically set the VC to be verified by calling the 'verify' method on the element, like so:

```
<body>
<veri-good registry-list="https://digitalcredentials.github.io/dcc-known-registries/known-did-registries.json"></veri-good>
<script type="module" src="=bundle.js"></script>
<script>
const verifier = document.querySelector('veri-good')
verifier.addEventListener('veri-good-is-ready', (e) => {
verifier.verify("https://digitalcredentials.github.io/vc-test-fixtures/verifiableCredentials/v1/bothSignatureTypes/didKey/legacy-noStatus-noExpiry-basicOBv3.json")
});
</script>
</body>
```

Notice that we again (as with the setIssuerDids method) have to wait for the web component to finish intializing and fire the 'veri-good-is-ready' event before we can call the 'verify' method on it.

As with the `setIssuerDids` method, you can of course also call `verify` in your own javascript that you bundle up with webpack or the like.

You might use the 'verify' call for cases like:

* immediately verifying a credential whose url has been passed in as a request parameter on your html page.
* verifying a credential that the end user selects from a list of credentials on the page, like say in a web wallet

### Customization

#### Slots

There are three 'slots' in the web component into which you can place custom html content:

* header
* wasAwarded
* awardedBy

Use them by including your custom content inside the `<veri-good>` tag like so:

```
<veri-good registry-list="https://digitalcredentials.github.io/dcc-known-registries/known-did-registries.json">
<div slot="header">
<div style="margin:.2em">University of Wonderful</div>
<div style="font-size:1.2em">Course Credential Verification</div>
</div>
<div slot="wasAwarded">earned</div>
<div slot="awardedBy">awarded by</div>
</veri-good>
```

Note the `slot=` attributes. They must be specified with the given values (header, wasAwarded, awardedBy), just as they are used above. They can, however, be used with elements other than divs. The web component basically takes an element with a 'slot' attribute and drops that element, including its children, into a matching predefined slot in the veri-good component.

The three slots map into the verifier like so:

![slot mapping](docs/slots.png)

You'll of course likely have to play with the css for your slots.

If you don't provide content for the slots, they default to the values show in the screenshot.


## Development

### disable-pauses

To make the playwright tests faster, set the atttribute 'disable-pauses' like so:

```
<veri-good disable-pauses></veri-good>
```

This removes all pauses on the spinners and messages.
Loading