(options = kEmptyObject)
| 68 | } |
| 69 | |
| 70 | function getFlags(options = kEmptyObject) { |
| 71 | validateObject(options, 'options'); |
| 72 | const { |
| 73 | subject = 'default', // Can be 'default', 'always', or 'never' |
| 74 | wildcards = true, |
| 75 | partialWildcards = true, |
| 76 | multiLabelWildcards = false, |
| 77 | singleLabelSubdomains = false, |
| 78 | } = { ...options }; |
| 79 | let flags = 0; |
| 80 | validateString(subject, 'options.subject'); |
| 81 | validateBoolean(wildcards, 'options.wildcards'); |
| 82 | validateBoolean(partialWildcards, 'options.partialWildcards'); |
| 83 | validateBoolean(multiLabelWildcards, 'options.multiLabelWildcards'); |
| 84 | validateBoolean(singleLabelSubdomains, 'options.singleLabelSubdomains'); |
| 85 | switch (subject) { |
| 86 | case 'default': /* Matches OpenSSL's default, no flags. */ break; |
| 87 | case 'always': flags |= X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT; break; |
| 88 | case 'never': flags |= X509_CHECK_FLAG_NEVER_CHECK_SUBJECT; break; |
| 89 | default: |
| 90 | throw new ERR_INVALID_ARG_VALUE('options.subject', subject); |
| 91 | } |
| 92 | if (!wildcards) flags |= X509_CHECK_FLAG_NO_WILDCARDS; |
| 93 | if (!partialWildcards) flags |= X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS; |
| 94 | if (multiLabelWildcards) flags |= X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS; |
| 95 | if (singleLabelSubdomains) flags |= X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS; |
| 96 | return flags; |
| 97 | } |
| 98 | |
| 99 | class InternalX509Certificate { |
| 100 | [kInternalState] = new SafeMap(); |
no outgoing calls
no test coverage detected