How to use the pvutils.getParametersValue function in pvutils

To help you get started, we’ve selected a few pvutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PeculiarVentures / PKI.js / src / AttributeCertificateV2.js View on Github external
static schema(parameters = {})
	{
		/**
		 * @type {Object}
		 * @property {string} [blockName]
		 * @property {string} [issuerName]
		 * @property {string} [baseCertificateID]
		 * @property {string} [objectDigestInfo]
		 */
		const names = getParametersValue(parameters, "names", {});
		
		return (new asn1js.Sequence({
			name: (names.blockName || ""),
			value: [
				GeneralNames.schema({
					names: {
						blockName: names.issuerName
					}
				}, true),
				new asn1js.Constructed({
					optional: true,
					name: (names.baseCertificateID || ""),
					idBlock: {
						tagClass: 3,
						tagNumber: 0 // [0]
					},
github PeculiarVentures / PKI.js / src / OriginatorInfo.js View on Github external
static schema(parameters = {})
	{
		/**
		 * @type {Object}
		 * @property {string} [blockName]
		 * @property {string} [certs]
		 * @property {string} [crls]
		 */
		const names = getParametersValue(parameters, "names", {});

		return (new asn1js.Sequence({
			name: (names.blockName || ""),
			value: [
				new asn1js.Constructed({
					name: (names.certs || ""),
					optional: true,
					idBlock: {
						tagClass: 3, // CONTEXT-SPECIFIC
						tagNumber: 0 // [0]
					},
					value: CertificateSet.schema().valueBlock.value
				}),
				new asn1js.Constructed({
					name: (names.crls || ""),
					optional: true,
github PeculiarVentures / CAdES.js / src / RevocationInfoArchival.js View on Github external
//    ocsp [1] EXPLICIT SEQUENCE of OCSP Responses, OPTIONAL
		//    otherRevInfo [2] EXPLICIT SEQUENCE of OtherRevInfo, OPTIONAL
		//}
		//OtherRevInfo ::= SEQUENCE {
		//    Type OBJECT IDENTIFIER
		//    Value OCTET STRING
		//}
		
		/**
		 * @type {Object}
		 * @property {string} [blockName]
		 * @property {string} [crl]
		 * @property {string} [ocsp]
		 * @property {string} [otherRevInfo]
		 */
		const names = getParametersValue(parameters, "names", {});
		
		return (new asn1js.Sequence({
			name: (names.blockName || ""),
			value: [
				new asn1js.Constructed({
					optional: true,
					idBlock: {
						tagClass: 3, // CONTEXT-SPECIFIC
						tagNumber: 0 // [0]
					},
					value: [
						new asn1js.Sequence({
							value: [
								new asn1js.Repeated({
									name: (names.crl || ""),
									value: CertificateRevocationList.schema()
github PeculiarVentures / PKI.js / src / PBES2Params.js View on Github external
constructor(parameters = {})
	{
		//region Internal properties of the object
		/**
		 * @type {AlgorithmIdentifier}
		 * @desc keyDerivationFunc
		 */
		this.keyDerivationFunc = getParametersValue(parameters, "keyDerivationFunc", PBES2Params.defaultValues("keyDerivationFunc"));
		/**
		 * @type {AlgorithmIdentifier}
		 * @desc encryptionScheme
		 */
		this.encryptionScheme = getParametersValue(parameters, "encryptionScheme", PBES2Params.defaultValues("encryptionScheme"));
		//endregion

		//region If input argument array contains "schema" for this object
		if("schema" in parameters)
			this.fromSchema(parameters.schema);
		//endregion
	}
	//**********************************************************************************
github PeculiarVentures / PKI.js / src / OriginatorInfo.js View on Github external
constructor(parameters = {})
	{
		//region Internal properties of the object
		if("certs" in parameters)
			/**
			 * @type {CertificateSet}
			 * @desc certs
			 */
			this.certs = getParametersValue(parameters, "certs", OriginatorInfo.defaultValues("certs"));

		if("crls" in parameters)
			/**
			 * @type {RevocationInfoChoices}
			 * @desc crls
			 */
			this.crls = getParametersValue(parameters, "crls", OriginatorInfo.defaultValues("crls"));
		//endregion

		//region If input argument array contains "schema" for this object
		if("schema" in parameters)
			this.fromSchema(parameters.schema);
		//endregion
	}
	//**********************************************************************************
github PeculiarVentures / CAdES.js / src / CrlIdentifier.js View on Github external
constructor(parameters = {})
	{
		//region Internal properties of the object
		/**
		 * @type {RelativeDistinguishedNames}
		 * @description crlissuer
		 */
		this.crlissuer = getParametersValue(parameters, "crlissuer", CrlIdentifier.defaultValues("crlissuer"));
		/**
		 * @type {Date}
		 * @description crlIssuedTime
		 */
		this.crlIssuedTime = getParametersValue(parameters, "crlIssuedTime", CrlIdentifier.defaultValues("crlIssuedTime"));
		
		if("crlNumber" in parameters)
			/**
			 * @type {Integer}
			 * @description crlNumber
			 */
			this.crlNumber = getParametersValue(parameters, "crlNumber", CrlIdentifier.defaultValues("crlNumber"));
		//endregion
		
		//region If input argument array contains "schema" for this object
		if("schema" in parameters)
github PeculiarVentures / CAdES.js / src / OtherCertID.js View on Github external
constructor(parameters = {})
	{
		//region Internal properties of the object
		/**
		 * @type {OctetString|OtherHashAlgAndValue}
		 * @description otherCertHash
		 */
		this.otherCertHash = getParametersValue(parameters, "otherCertHash", OtherCertID.defaultValues("otherCertHash"));
		/**
		 * @type {IssuerSerial}
		 * @description issuerSerial
		 */
		this.issuerSerial = getParametersValue(parameters, "issuerSerial", OtherCertID.defaultValues("issuerSerial"));
		//endregion
		
		//region If input argument array contains "schema" for this object
		if("schema" in parameters)
			this.fromSchema(parameters.schema);
		//endregion
	}
	//**********************************************************************************
github PeculiarVentures / CAdES.js / src / RevocationInfoArchival.js View on Github external
*/
			this.crl = getParametersValue(parameters, "crl", RevocationInfoArchival.defaultValues("crl"));
		
		if("ocsp" in parameters)
			/**
			 * @type {Array.}
			 * @description ocsp
			 */
			this.ocsp = getParametersValue(parameters, "ocsp", RevocationInfoArchival.defaultValues("ocsp"));
		
		if("otherRevInfo" in parameters)
			/**
			 * @type {Array.}
			 * @description otherRevInfo
			 */
			this.otherRevInfo = getParametersValue(parameters, "otherRevInfo", RevocationInfoArchival.defaultValues("otherRevInfo"));
		//endregion
		
		//region If input argument array contains "schema" for this object
		if("schema" in parameters)
			this.fromSchema(parameters.schema);
		//endregion
	}
	//**********************************************************************************
github PeculiarVentures / PKI.js / src / CertificateRevocationList.js View on Github external
static schema(parameters = {})
	{
		/**
		 * @type {Object}
		 * @property {string} [blockName]
		 * @property {string} [signatureAlgorithm]
		 * @property {string} [signatureValue]
		 */
		const names = getParametersValue(parameters, "names", {});
		
		return (new asn1js.Sequence({
			name: (names.blockName || "CertificateList"),
			value: [
				tbsCertList(parameters),
				AlgorithmIdentifier.schema(names.signatureAlgorithm || {
					names: {
						blockName: "signatureAlgorithm"
					}
				}),
				new asn1js.BitString({ name: (names.signatureValue || "signatureValue") })
			]
		}));
	}
	//**********************************************************************************
github PeculiarVentures / PKI.js / src / AttributeCertificateV2.js View on Github external
static schema(parameters = {})
	{
		/**
		 * @type {Object}
		 * @property {string} [blockName]
		 * @property {Object} [acinfo]
		 * @property {Object} [signatureAlgorithm]
		 * @property {string} [signatureValue]
		 */
		const names = getParametersValue(parameters, "names", {});
		
		return (new asn1js.Sequence({
			name: (names.blockName || ""),
			value: [
				AttributeCertificateInfoV2.schema(names.acinfo || {}),
				AlgorithmIdentifier.schema(names.signatureAlgorithm || {}),
				new asn1js.BitString({ name: (names.signatureValue || "") })
			]
		}));
	}
	//**********************************************************************************

pvutils

Common utilities for products from Peculiar Ventures

MIT
Latest version published 3 years ago

Package Health Score

68 / 100
Full package analysis