-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(oidc): dpop inside serviceworker (#1306) (release)
* feat(oidc): dpop inside serviceworker * test * update * update * update * update
- Loading branch information
1 parent
4a5887f
commit 8f3940c
Showing
19 changed files
with
474 additions
and
59 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
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,20 @@ | ||
import {uint8ToUrlBase64} from "./jwt"; | ||
|
||
|
||
export function textEncodeLite(str: string) { | ||
const buf = new ArrayBuffer(str.length); | ||
const bufView = new Uint8Array(buf); | ||
|
||
for (let i = 0; i < str.length; i++) { | ||
bufView[i] = str.charCodeAt(i); | ||
} | ||
return bufView; | ||
} | ||
|
||
export function base64urlOfHashOfASCIIEncodingAsync(code: string):Promise<string> { | ||
return new Promise((resolve, reject) => { | ||
crypto.subtle.digest('SHA-256', textEncodeLite(code)).then(buffer => { | ||
return resolve(uint8ToUrlBase64(new Uint8Array(buffer))); | ||
}, error => reject(error)); | ||
}); | ||
} |
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,22 @@ | ||
import {Domain, DomainDetails} from "./types.js"; | ||
import {defaultDemonstratingProofOfPossessionConfiguration} from "./jwt"; | ||
|
||
const isDpop= (trustedDomain: Domain[] | DomainDetails) : boolean => { | ||
if (Array.isArray(trustedDomain)) { | ||
return false; | ||
} | ||
return trustedDomain.demonstratingProofOfPossession ?? false; | ||
} | ||
|
||
export const getDpopConfiguration = (trustedDomain: Domain[] | DomainDetails) => { | ||
|
||
if(!isDpop(trustedDomain)) { | ||
return null; | ||
} | ||
|
||
if (Array.isArray(trustedDomain)) { | ||
return null; | ||
} | ||
|
||
return trustedDomain.demonstratingProofOfPossessionConfiguration ?? defaultDemonstratingProofOfPossessionConfiguration; | ||
} |
Oops, something went wrong.