MCPcopy
hub / github.com/panva/jose / validateAlgorithms

Function validateAlgorithms

src/lib/validate_algorithms.ts:1–14  ·  view source on GitHub ↗
(option: string, algorithms?: string[])

Source from the content-addressed store, hash-verified

1export function validateAlgorithms(option: string, algorithms?: string[]) {
2 if (
3 algorithms !== undefined &&
4 (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== 'string'))
5 ) {
6 throw new TypeError(`"${option}" option must be an array of strings`)
7 }
8
9 if (!algorithms) {
10 return undefined
11 }
12
13 return new Set(algorithms)
14}

Callers 2

flattenedDecryptFunction · 0.85
flattenedVerifyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…