From d7ab327e56d4868a8893b927c6c8cd98ed6d66be Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Tue, 17 Sep 2024 19:10:43 +0900 Subject: [PATCH] reference W3C SRI spec --- src/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.ts b/src/index.ts index bf4a79f..7fe6596 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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 = [ ...this.keys(),