fromName static method

JWTAlgorithm fromName(
  1. String name
)

Return the JWTAlgorithm from his string name

Implementation

static JWTAlgorithm fromName(String name) {
  switch (name) {
    case 'HS256':
      return JWTAlgorithm.HS256;
    case 'HS384':
      return JWTAlgorithm.HS384;
    case 'HS512':
      return JWTAlgorithm.HS512;
    case 'RS256':
      return JWTAlgorithm.RS256;
    case 'RS384':
      return JWTAlgorithm.RS384;
    case 'RS512':
      return JWTAlgorithm.RS512;
    case 'ES256':
      return JWTAlgorithm.ES256;
    case 'ES384':
      return JWTAlgorithm.ES384;
    case 'ES512':
      return JWTAlgorithm.ES512;
    case 'ES256K':
      return JWTAlgorithm.ES256K;
    case 'EdDSA':
      return JWTAlgorithm.EdDSA;
    case 'PS256':
      return JWTAlgorithm.PS256;
    case 'PS384':
      return JWTAlgorithm.PS384;
    case 'PS512':
      return JWTAlgorithm.PS512;
    default:
      throw JWTInvalidException('unknown algorithm');
  }
}