mirror of
https://github.com/kou029w/websri.git
synced 2025-01-18 08:05:13 +00:00
reference W3C SRI spec
This commit is contained in:
parent
3bd7f5566e
commit
d7ab327e56
1 changed files with 3 additions and 0 deletions
|
@ -10,11 +10,13 @@ export const supportedHashAlgorithms = {
|
|||
|
||||
export type PrioritizedHashAlgorithm = "" | HashAlgorithm;
|
||||
|
||||
/** [W3C Subresource Integrity getPrioritizedHashFunction(a, b)](https://www.w3.org/TR/SRI/#dfn-getprioritizedhashfunction-a-b) */
|
||||
export type GetPrioritizedHashAlgorithm = (
|
||||
a: HashAlgorithm,
|
||||
b: HashAlgorithm,
|
||||
) => PrioritizedHashAlgorithm;
|
||||
|
||||
/** [W3C Subresource Integrity getPrioritizedHashFunction(a, b)](https://www.w3.org/TR/SRI/#dfn-getprioritizedhashfunction-a-b) */
|
||||
export function getPrioritizedHashAlgorithm(
|
||||
a: HashAlgorithm,
|
||||
b: HashAlgorithm,
|
||||
|
@ -129,6 +131,7 @@ export class IntegrityMetadataSet extends Map<
|
|||
this.getPrioritizedHashAlgorithm = options.getPrioritizedHashAlgorithm;
|
||||
}
|
||||
|
||||
/** [W3C Subresource Integrity 3.3.4 Get the strongest metadata from set.](https://www.w3.org/TR/SRI/#get-the-strongest-metadata-from-set) */
|
||||
get strongest(): IntegrityMetadata {
|
||||
const [hashAlgorithm = "sha512"]: ReadonlyArray<HashAlgorithm> = [
|
||||
...this.keys(),
|
||||
|
|
Loading…
Add table
Reference in a new issue