(params: SignatureParams)
| 759 | } |
| 760 | |
| 761 | function 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 |
no test coverage detected