import Model, { attr } from '@ember-data/model';
import { computed } from '@ember/object';
import { expandAttributeMeta } from 'vault/utils/field-to-attrs';
export default Model.extend({
backend: attr('string'),
der: attr(),
pem: attr('string'),
caChain: attr('string'),
attrList(keys) {
return expandAttributeMeta(this, keys);
},
//urls
urlsAttrs: computed(function () {
let keys = ['issuingCertificates', 'crlDistributionPoints', 'ocspServers'];
return this.attrList(keys);
}),
issuingCertificates: attr({
editType: 'stringArray',
crlDistributionPoints: attr({
label: 'CRL Distribution Points',
ocspServers: attr({
label: 'OCSP Servers',
//tidy
tidyAttrs: computed(function () {
let keys = ['tidyCertStore', 'tidyRevocationList', 'safetyBuffer'];
tidyCertStore: attr('boolean', {
defaultValue: false,
label: 'Tidy the Certificate Store',
tidyRevocationList: attr('boolean', {
label: 'Tidy the Revocation List (CRL)',
safetyBuffer: attr({
defaultValue: '72h',
editType: 'ttl',
crlAttrs: computed(function () {
let keys = ['expiry'];
//crl
expiry: attr({
});