How to use pvutils - 10 common examples

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 / PBKDF2Params.js View on Github external
fromSchema(schema)
	{
		//region Clear input data first
		clearProps(schema, [
			"salt",
			"iterationCount",
			"keyLength",
			"prf"
		]);
		//endregion
		
		//region Check the schema is valid
		const asn1 = asn1js.compareSchema(schema,
			schema,
			PBKDF2Params.schema({
				names: {
					saltPrimitive: "salt",
					saltConstructed: {
						names: {
							blockName: "salt"
github PeculiarVentures / PKI.js / src / ExtKeyUsage.js View on Github external
fromSchema(schema)
	{
		//region Clear input data first
		clearProps(schema, [
			"keyPurposes"
		]);
		//endregion
		
		//region Check the schema is valid
		const asn1 = asn1js.compareSchema(schema,
			schema,
			ExtKeyUsage.schema({
				names: {
					keyPurposes: "keyPurposes"
				}
			})
		);

		if(asn1.verified === false)
			throw new Error("Object's schema was not verified against input data for ExtKeyUsage");
github PeculiarVentures / PKI.js / src / SubjectDirectoryAttributes.js View on Github external
fromSchema(schema)
	{
		//region Clear input data first
		clearProps(schema, [
			"attributes"
		]);
		//endregion
		
		//region Check the schema is valid
		const asn1 = asn1js.compareSchema(schema,
			schema,
			SubjectDirectoryAttributes.schema({
				names: {
					attributes: "attributes"
				}
			})
		);

		if(asn1.verified === false)
			throw new Error("Object's schema was not verified against input data for SubjectDirectoryAttributes");
github PeculiarVentures / PKI.js / src / Attribute.js View on Github external
fromSchema(schema)
	{
		//region Clear input data first
		clearProps(schema, [
			"type",
			"values"
		]);
		//endregion
		
		//region Check the schema is valid
		const asn1 = asn1js.compareSchema(schema,
			schema,
			Attribute.schema({
				names: {
					type: "type",
					values: "values"
				}
			})
		);
github PeculiarVentures / PKI.js / src / OtherRevocationInfoFormat.js View on Github external
fromSchema(schema)
	{
		//region Clear input data first
		clearProps(schema, [
			"otherRevInfoFormat",
			"otherRevInfo"
		]);
		//endregion
		
		//region Check the schema is valid
		const asn1 = asn1js.compareSchema(schema,
			schema,
			OtherRevocationInfoFormat.schema()
		);

		if(asn1.verified === false)
			throw new Error("Object's schema was not verified against input data for OtherRevocationInfoFormat");
		//endregion

		//region Get internal properties from parsed 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
	}
	//**********************************************************************************

pvutils

Common utilities for products from Peculiar Ventures

MIT
Latest version published 3 years ago

Package Health Score

68 / 100
Full package analysis