Skip to content
Snippets Groups Projects
Select Git revision
  • cd283268ea74c536b3fc9dd2bde121721a1294e7
  • master default protected
  • gh-pages
  • dependabot/npm_and_yarn/nock-14.0.9
  • dependabot/npm_and_yarn/react-19.1.1
  • dependabot/npm_and_yarn/react-dom-19.1.1
  • server-2025-08-01-57ada99c
  • server-2025-02-01-6100669a
  • server-2024-11-01-87cba042
  • server-2024-10-01-6875b7c8
  • dependabot/npm_and_yarn/path-to-regexp-8.2.0
  • server-2024-09-01-3d52575c
  • daily-tests-gha2
  • daily-tests-gha
  • server-2023-12-01-92d8fb8e
  • server-2023-11-01-a80c93fd
  • server-2023-10-01-31096085
  • coc-v2
  • server-2023-09-01-8edc3810
  • server-2023-08-01-75858a03
  • server-2023-07-01-02183d8d
  • server-2025-08-03
  • server-2025-07-01
  • 5.0.2
  • 5.0.1
  • 5.0.0
  • server-2025-06-01
  • server-2025-05-01
  • server-2025-04-03
  • server-2025-03-02
  • server-2025-03-01
  • server-2025-02-02
  • server-2025-01-01
  • server-2024-12-01
  • server-2024-11-02
  • 4.1.0
  • server-2024-09-25
  • server-2024-09-02
  • server-2024-08-01
  • server-2024-07-01
  • 4.0.0
41 results

cypress.config.js

Blame
  • flags.go 1.91 KiB
    package main
    
    import (
    	"crypto/elliptic"
    	"fmt"
    	"strconv"
    	"strings"
    )
    
    var supportedPublicKeyAlgorithms = []string{"rsa", "ecdsa"}
    
    type PublicKeyAlgorithm string
    
    func (a *PublicKeyAlgorithm) String() string {
    	return string(*a)
    }
    
    func (a *PublicKeyAlgorithm) Set(str string) error {
    	if strings.TrimSpace(str) == "" {
    		*a = PublicKeyAlgorithm(supportedPublicKeyAlgorithms[0])
    		return nil
    	}
    	for _, v := range supportedPublicKeyAlgorithms {
    		if str == v {
    			*a = PublicKeyAlgorithm(str)
    			return nil
    		}
    	}
    	return fmt.Errorf(
    		"unsupported public key algorithm '%s', must be one of: %s",
    		str,
    		strings.Join(supportedPublicKeyAlgorithms, ", "),
    	)
    }
    
    func (a *PublicKeyAlgorithm) Type() string {
    	return "publicKeyAlgorithm"
    }
    
    var defaultRSAKeyBits = 2048
    
    type RSAKeyBits int
    
    func (b *RSAKeyBits) String() string {
    	return strconv.Itoa(int(*b))
    }
    
    func (b *RSAKeyBits) Set(str string) error {
    	if strings.TrimSpace(str) == "" {
    		*b = RSAKeyBits(defaultRSAKeyBits)
    		return nil
    	}
    	bits, err := strconv.Atoi(str)
    	if err != nil {
    		return err
    	}
    	if bits%8 != 0 {
    		return fmt.Errorf("RSA key bit size should be a multiples of 8")
    	}
    	*b = RSAKeyBits(bits)
    	return nil
    }
    
    func (b *RSAKeyBits) Type() string {
    	return "rsaKeyBits"
    }
    
    type ECDSACurve struct {
    	elliptic.Curve
    }
    
    var supportedECDSACurves = map[string]elliptic.Curve{
    	"P-256": elliptic.P256(),
    	"P-384": elliptic.P384(),
    	"P-521": elliptic.P521(),
    }
    
    func (c *ECDSACurve) String() string {
    	if c == nil || c.Curve == nil {
    		return ""
    	}
    	return c.Curve.Params().Name
    }
    
    func (c *ECDSACurve) Set(str string) error {
    	if strings.TrimSpace(str) == "" {
    		*c = ECDSACurve{supportedECDSACurves["P-384"]}
    		return nil
    	}
    	for k, v := range supportedECDSACurves {
    		if k == str {
    			*c = ECDSACurve{v}
    			return nil
    		}
    	}
    	return fmt.Errorf("unsupported curve '%s', should be one of: P-256, P-384, P-521", str)
    }
    
    func (c *ECDSACurve) Type() string {
    	return "ecdsaCurve"
    }