2022-09-27 13:40:55 +00:00
|
|
|
import * as plugins from './smartacme.plugins.js';
|
|
|
|
import * as interfaces from './interfaces/index.js';
|
2019-01-13 01:10:00 +00:00
|
|
|
|
2019-02-06 13:37:00 +00:00
|
|
|
/**
|
|
|
|
* certmatcher is responsible for matching certificates
|
|
|
|
*/
|
2019-01-13 01:10:00 +00:00
|
|
|
export class CertMatcher {
|
2019-02-06 13:37:00 +00:00
|
|
|
/**
|
|
|
|
* creates a domainName for the certificate that will include the broadest scope
|
|
|
|
* for wild card certificates
|
|
|
|
* @param domainNameArg the domainNameArg to create the scope from
|
|
|
|
*/
|
2019-01-13 01:10:00 +00:00
|
|
|
public getCertificateDomainNameByDomainName(domainNameArg: string): string {
|
|
|
|
const originalDomain = new plugins.smartstring.Domain(domainNameArg);
|
|
|
|
if (!originalDomain.level4) {
|
|
|
|
return `${originalDomain.level2}.${originalDomain.level1}`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|