Skip to content

Commit e3c52c6

Browse files
author
Corey B
committed
fix: correct did:web resolution logic and file placement for GitHub Pages paths
1 parent a658a8c commit e3c52c6

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

File renamed without changes.

site/sandbox.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,12 @@ <h1>Statement for {{accountHolder}}</h1>
437437
// step 5
438438
let publicKey = null;
439439
if (proof && vc.issuer?.startsWith('did:web:')) {
440-
const domain = vc.issuer.replace('did:web:','').replace(/:/g,'/');
441-
const didUrl = `https://${domain}/.well-known/did.json`;
440+
const parts = vc.issuer.replace('did:web:','').split(':');
441+
const domain = parts[0];
442+
const path = parts.slice(1).join('/');
443+
const didUrl = path
444+
? `https://${domain}/${path}/did.json`
445+
: `https://${domain}/.well-known/did.json`;
442446
set('did','run', C('Fetching: '+didUrl)+N('The issuer hosts this public JSON file on their web server. The private key NEVER leaves their server.'));
443447
try {
444448
const res = await fetch(didUrl);

site/sw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const CACHE = 'openfdd-sandbox-v2';
1+
const CACHE = 'openfdd-sandbox-v3';
22
const ASSETS = [
33
'./sandbox.html',
44
'./index.html',

0 commit comments

Comments
 (0)