[Video] Properly get the service auth aud from the session (#5025)
This commit is contained in:
parent
91fe41670f
commit
69e896c221
3 changed files with 34 additions and 6 deletions
|
@ -339,3 +339,21 @@ export function shortLinkToHref(url: string): string {
|
|||
return url
|
||||
}
|
||||
}
|
||||
|
||||
export function getHostnameFromUrl(url: string): string | null {
|
||||
let urlp
|
||||
try {
|
||||
urlp = new URL(url)
|
||||
} catch (e) {
|
||||
return null
|
||||
}
|
||||
return urlp.hostname
|
||||
}
|
||||
|
||||
export function getServiceAuthAudFromUrl(url: string): string | null {
|
||||
const hostname = getHostnameFromUrl(url)
|
||||
if (!hostname) {
|
||||
return null
|
||||
}
|
||||
return `did:web:${hostname}`
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue