MCPcopy Create free account
hub / github.com/denoland/std / validateSignParams

Function validateSignParams

http/unstable_message_signatures.ts:761–780  ·  view source on GitHub ↗
(params: SignatureParams)

Source from the content-addressed store, hash-verified

759}
760
761function validateSignParams(params: SignatureParams): void {
762 if (params.label !== undefined && !SF_KEY_REGEXP.test(params.label)) {
763 throw new TypeError(
764 `Invalid signature label "${params.label}": must be a valid sf-key (lowercase alphanumeric, _, -, ., *)`,
765 );
766 }
767 if (params.created !== undefined) {
768 validateTimestamp(params.created, "created");
769 }
770 if (params.expires !== undefined) {
771 validateTimestamp(params.expires, "expires");
772 }
773 if (
774 params.algorithm !== undefined && !isSupportedAlgorithm(params.algorithm)
775 ) {
776 throw new TypeError(
777 `Unsupported signature algorithm: "${params.algorithm}"`,
778 );
779 }
780}
781
782// =============================================================================
783// signMessage

Callers 1

signMessageFunction · 0.85

Calls 2

validateTimestampFunction · 0.85
isSupportedAlgorithmFunction · 0.85

Tested by

no test coverage detected