mirror of
https://github.com/kou029w/websri.git
synced 2025-01-18 16:08:16 +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;
|
export type PrioritizedHashAlgorithm = "" | HashAlgorithm;
|
||||||
|
|
||||||
|
/** [W3C Subresource Integrity getPrioritizedHashFunction(a, b)](https://www.w3.org/TR/SRI/#dfn-getprioritizedhashfunction-a-b) */
|
||||||
export type GetPrioritizedHashAlgorithm = (
|
export type GetPrioritizedHashAlgorithm = (
|
||||||
a: HashAlgorithm,
|
a: HashAlgorithm,
|
||||||
b: HashAlgorithm,
|
b: HashAlgorithm,
|
||||||
) => PrioritizedHashAlgorithm;
|
) => PrioritizedHashAlgorithm;
|
||||||
|
|
||||||
|
/** [W3C Subresource Integrity getPrioritizedHashFunction(a, b)](https://www.w3.org/TR/SRI/#dfn-getprioritizedhashfunction-a-b) */
|
||||||
export function getPrioritizedHashAlgorithm(
|
export function getPrioritizedHashAlgorithm(
|
||||||
a: HashAlgorithm,
|
a: HashAlgorithm,
|
||||||
b: HashAlgorithm,
|
b: HashAlgorithm,
|
||||||
|
@ -129,6 +131,7 @@ export class IntegrityMetadataSet extends Map<
|
||||||
this.getPrioritizedHashAlgorithm = options.getPrioritizedHashAlgorithm;
|
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 {
|
get strongest(): IntegrityMetadata {
|
||||||
const [hashAlgorithm = "sha512"]: ReadonlyArray<HashAlgorithm> = [
|
const [hashAlgorithm = "sha512"]: ReadonlyArray<HashAlgorithm> = [
|
||||||
...this.keys(),
|
...this.keys(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue