@wildboar/pki-stub
Version:
X.510 PKI-Stub ASN.1 data structures in TypeScript
280 lines • 13.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_BuiltInStandardAttributes = exports._decode_BuiltInStandardAttributes = exports._extension_additions_list_spec_for_BuiltInStandardAttributes = exports._root_component_type_list_2_spec_for_BuiltInStandardAttributes = exports._root_component_type_list_1_spec_for_BuiltInStandardAttributes = exports.BuiltInStandardAttributes = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
const AdministrationDomainName_ta_1 = require("../PkiPmiExternalDataTypes/AdministrationDomainName.ta");
const CountryName_ta_1 = require("../PkiPmiExternalDataTypes/CountryName.ta");
const NetworkAddress_ta_1 = require("../PkiPmiExternalDataTypes/NetworkAddress.ta");
const NumericUserIdentifier_ta_1 = require("../PkiPmiExternalDataTypes/NumericUserIdentifier.ta");
const OrganizationalUnitNames_ta_1 = require("../PkiPmiExternalDataTypes/OrganizationalUnitNames.ta");
const OrganizationName_ta_1 = require("../PkiPmiExternalDataTypes/OrganizationName.ta");
const PersonalName_ta_1 = require("../PkiPmiExternalDataTypes/PersonalName.ta");
const PrivateDomainName_ta_1 = require("../PkiPmiExternalDataTypes/PrivateDomainName.ta");
const TerminalIdentifier_ta_1 = require("../PkiPmiExternalDataTypes/TerminalIdentifier.ta");
/* START_OF_SYMBOL_DEFINITION BuiltInStandardAttributes */
/**
* @summary BuiltInStandardAttributes
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* BuiltInStandardAttributes ::= SEQUENCE {
* country-name CountryName OPTIONAL,
* administration-domain-name AdministrationDomainName OPTIONAL,
* network-address [0] NetworkAddress OPTIONAL,
* -- see also extended-network-address
* terminal-identifier [1] TerminalIdentifier OPTIONAL,
* private-domain-name [2] PrivateDomainName OPTIONAL,
* organization-name [3] OrganizationName OPTIONAL,
* -- see also teletex-organization-name
* numeric-user-identifier [4] NumericUserIdentifier OPTIONAL,
* personal-name [5] PersonalName OPTIONAL,
* -- see also teletex-personal-name
* organizational-unit-names [6] OrganizationalUnitNames OPTIONAL
* -- see also teletex-organizational-unit-names --}
* ```
*
* @class
*/
class BuiltInStandardAttributes {
constructor(
/**
* @summary `country_name`.
* @public
* @readonly
*/
country_name,
/**
* @summary `administration_domain_name`.
* @public
* @readonly
*/
administration_domain_name,
/**
* @summary `network_address`.
* @public
* @readonly
*/
network_address,
/**
* @summary `terminal_identifier`.
* @public
* @readonly
*/
terminal_identifier,
/**
* @summary `private_domain_name`.
* @public
* @readonly
*/
private_domain_name,
/**
* @summary `organization_name`.
* @public
* @readonly
*/
organization_name,
/**
* @summary `numeric_user_identifier`.
* @public
* @readonly
*/
numeric_user_identifier,
/**
* @summary `personal_name`.
* @public
* @readonly
*/
personal_name,
/**
* @summary `organizational_unit_names`.
* @public
* @readonly
*/
organizational_unit_names) {
this.country_name = country_name;
this.administration_domain_name = administration_domain_name;
this.network_address = network_address;
this.terminal_identifier = terminal_identifier;
this.private_domain_name = private_domain_name;
this.organization_name = organization_name;
this.numeric_user_identifier = numeric_user_identifier;
this.personal_name = personal_name;
this.organizational_unit_names = organizational_unit_names;
}
/**
* @summary Restructures an object into a BuiltInStandardAttributes
* @description
*
* This takes an `object` and converts it to a `BuiltInStandardAttributes`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `BuiltInStandardAttributes`.
* @returns {BuiltInStandardAttributes}
*/
static _from_object(_o) {
return new BuiltInStandardAttributes(_o.country_name, _o.administration_domain_name, _o.network_address, _o.terminal_identifier, _o.private_domain_name, _o.organization_name, _o.numeric_user_identifier, _o.personal_name, _o.organizational_unit_names);
}
}
exports.BuiltInStandardAttributes = BuiltInStandardAttributes;
/* END_OF_SYMBOL_DEFINITION BuiltInStandardAttributes */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_BuiltInStandardAttributes */
/**
* @summary The Leading Root Component Types of BuiltInStandardAttributes
* @description
*
* This is an array of `ComponentSpec`s that define how to decode the leading root component type list of a SET or SEQUENCE.
*
* @constant
*/
exports._root_component_type_list_1_spec_for_BuiltInStandardAttributes = [
new $.ComponentSpec("country-name", true, $.hasTag(asn1_ts_1.ASN1TagClass.application, 1), undefined, undefined),
new $.ComponentSpec("administration-domain-name", true, $.hasTag(asn1_ts_1.ASN1TagClass.application, 2), undefined, undefined),
new $.ComponentSpec("network-address", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined),
new $.ComponentSpec("terminal-identifier", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 1), undefined, undefined),
new $.ComponentSpec("private-domain-name", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 2), undefined, undefined),
new $.ComponentSpec("organization-name", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 3), undefined, undefined),
new $.ComponentSpec("numeric-user-identifier", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 4), undefined, undefined),
new $.ComponentSpec("personal-name", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 5), undefined, undefined),
new $.ComponentSpec("organizational-unit-names", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 6), undefined, undefined),
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_BuiltInStandardAttributes */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_BuiltInStandardAttributes */
/**
* @summary The Trailing Root Component Types of BuiltInStandardAttributes
* @description
*
* This is an array of `ComponentSpec`s that define how to decode the trailing root component type list of a SET or SEQUENCE.
*
* @constant
*/
exports._root_component_type_list_2_spec_for_BuiltInStandardAttributes = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_BuiltInStandardAttributes */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_BuiltInStandardAttributes */
/**
* @summary The Extension Addition Component Types of BuiltInStandardAttributes
* @description
*
* This is an array of `ComponentSpec`s that define how to decode the extension addition component type list of a SET or SEQUENCE.
*
* @constant
*/
exports._extension_additions_list_spec_for_BuiltInStandardAttributes = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_BuiltInStandardAttributes */
/* START_OF_SYMBOL_DEFINITION _decode_BuiltInStandardAttributes */
/**
* @summary Decodes an ASN.1 element into a(n) BuiltInStandardAttributes
* @function
* @param {_Element} el The element being decoded.
* @returns {BuiltInStandardAttributes} The decoded data structure.
*/
function _decode_BuiltInStandardAttributes(el) {
/* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */
let country_name;
let administration_domain_name;
let network_address;
let terminal_identifier;
let private_domain_name;
let organization_name;
let numeric_user_identifier;
let personal_name;
let organizational_unit_names;
/* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */
/* START_OF_CALLBACKS_MAP */
const callbacks = {
"country-name": (_el) => {
country_name = CountryName_ta_1._decode_CountryName(_el);
},
"administration-domain-name": (_el) => {
administration_domain_name =
AdministrationDomainName_ta_1._decode_AdministrationDomainName(_el);
},
"network-address": (_el) => {
network_address = $._decode_explicit(() => NetworkAddress_ta_1._decode_NetworkAddress)(_el);
},
"terminal-identifier": (_el) => {
terminal_identifier =
$._decode_explicit(() => TerminalIdentifier_ta_1._decode_TerminalIdentifier)(_el);
},
"private-domain-name": (_el) => {
private_domain_name = $._decode_explicit(() => PrivateDomainName_ta_1._decode_PrivateDomainName)(_el);
},
"organization-name": (_el) => {
organization_name = $._decode_explicit(() => OrganizationName_ta_1._decode_OrganizationName)(_el);
},
"numeric-user-identifier": (_el) => {
numeric_user_identifier =
$._decode_explicit(() => NumericUserIdentifier_ta_1._decode_NumericUserIdentifier)(_el);
},
"personal-name": (_el) => {
personal_name = $._decode_explicit(() => PersonalName_ta_1._decode_PersonalName)(_el);
},
"organizational-unit-names": (_el) => {
organizational_unit_names =
$._decode_explicit(() => OrganizationalUnitNames_ta_1._decode_OrganizationalUnitNames)(_el);
},
};
/* END_OF_CALLBACKS_MAP */
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_BuiltInStandardAttributes, exports._extension_additions_list_spec_for_BuiltInStandardAttributes, exports._root_component_type_list_2_spec_for_BuiltInStandardAttributes, undefined);
return new BuiltInStandardAttributes(
/* SEQUENCE_CONSTRUCTOR_CALL */ country_name, administration_domain_name, network_address, terminal_identifier, private_domain_name, organization_name, numeric_user_identifier, personal_name, organizational_unit_names);
}
exports._decode_BuiltInStandardAttributes = _decode_BuiltInStandardAttributes;
/* END_OF_SYMBOL_DEFINITION _decode_BuiltInStandardAttributes */
/* START_OF_SYMBOL_DEFINITION _encode_BuiltInStandardAttributes */
/**
* @summary Encodes a(n) BuiltInStandardAttributes into an ASN.1 Element.
* @function
* @param {value} el The element being decoded.
* @param elGetter A function that can be used to get new ASN.1 elements.
* @returns {_Element} The BuiltInStandardAttributes, encoded as an ASN.1 Element.
*/
function _encode_BuiltInStandardAttributes(value, elGetter) {
var _a;
const components = [];
if (value.country_name) {
components.push(CountryName_ta_1._encode_CountryName(value.country_name, $.BER));
}
if (value.administration_domain_name) {
const c = AdministrationDomainName_ta_1._encode_AdministrationDomainName(value.administration_domain_name, $.BER);
components.push(c);
}
if (value.network_address) {
const c = $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 0, () => NetworkAddress_ta_1._encode_NetworkAddress, $.BER)(value.network_address, $.BER);
components.push(c);
}
if (value.terminal_identifier) {
const c = $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 1, () => TerminalIdentifier_ta_1._encode_TerminalIdentifier, $.BER)(value.terminal_identifier, $.BER);
components.push(c);
}
if (value.private_domain_name) {
const c = $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 2, () => PrivateDomainName_ta_1._encode_PrivateDomainName, $.BER)(value.private_domain_name, $.BER);
components.push(c);
}
if (value.organization_name) {
const c = $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 3, () => OrganizationName_ta_1._encode_OrganizationName, $.BER)(value.organization_name, $.BER);
components.push(c);
}
if (value.numeric_user_identifier) {
const c = $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 4, () => NumericUserIdentifier_ta_1._encode_NumericUserIdentifier, $.BER)(value.numeric_user_identifier, $.BER);
components.push(c);
}
if (value.personal_name) {
const c = $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 5, () => PersonalName_ta_1._encode_PersonalName, $.BER)(value.personal_name, $.BER);
components.push(c);
}
if ((_a = value.organizational_unit_names) === null || _a === void 0 ? void 0 : _a.length) {
const c = $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 6, () => OrganizationalUnitNames_ta_1._encode_OrganizationalUnitNames, $.BER)(value.organizational_unit_names, $.BER);
components.push(c);
}
return $._encodeSequence(components, $.BER);
}
exports._encode_BuiltInStandardAttributes = _encode_BuiltInStandardAttributes;
/* END_OF_SYMBOL_DEFINITION _encode_BuiltInStandardAttributes */
/* eslint-enable */
//# sourceMappingURL=BuiltInStandardAttributes.ta.js.map