Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fromSchema(schema)
{
//region Clear input data first
clearProps(schema, [
"version",
"originatorInfo",
"recipientInfos",
"encryptedContentInfo",
"unprotectedAttrs"
]);
//endregion
//region Check the schema is valid
const asn1 = asn1js.compareSchema(schema,
schema,
EnvelopedData.schema({
names: {
version: "version",
originatorInfo: "originatorInfo",
recipientInfos: "recipientInfos",
encryptedContentInfo: {
names: {
blockName: "encryptedContentInfo"
}
},
unprotectedAttrs: "unprotectedAttrs"
}
})
);
fromSchema(schema)
{
//region Clear input data first
clearProps(schema, [
"crlId",
"crlValue"
]);
//endregion
//region Check the schema is valid
const asn1 = asn1js.compareSchema(schema,
schema,
CRLBag.schema({
names: {
id: "crlId",
value: "crlValue"
}
})
);
if(asn1.verified === false)
throw new Error("Object's schema was not verified against input data for CRLBag");
//endregion
//region Get internal properties from parsed schema
this.crlId = asn1.result.crlId.valueBlock.toString();
this.crlValue = asn1.result.crlValue;
fromSchema(schema)
{
//region Clear input data first
clearProps(schema, [
"notBefore",
"notAfter"
]);
//endregion
//region Check the schema is valid
const asn1 = asn1js.compareSchema(schema,
schema,
PrivateKeyUsagePeriod.schema({
names: {
notBefore: "notBefore",
notAfter: "notAfter"
}
})
);
if(asn1.verified === false)
throw new Error("Object's schema was not verified against input data for PrivateKeyUsagePeriod");
//endregion
//region Get internal properties from parsed schema
if("notBefore" in asn1.result)
{
fromSchema(schema)
{
//region Clear input data first
clearProps(schema, [
"keyIdentifier",
"authorityCertIssuer",
"authorityCertSerialNumber"
]);
//endregion
//region Check the schema is valid
const asn1 = asn1js.compareSchema(schema,
schema,
AuthorityKeyIdentifier.schema({
names: {
keyIdentifier: "keyIdentifier",
authorityCertIssuer: "authorityCertIssuer",
authorityCertSerialNumber: "authorityCertSerialNumber"
}
})
);
if(asn1.verified === false)
throw new Error("Object's schema was not verified against input data for AuthorityKeyIdentifier");
//endregion
//region Get internal properties from parsed schema
if("keyIdentifier" in asn1.result)
fromSchema(schema)
{
//region Clear input data first
clearProps(schema, [
"rid",
"encryptedKey"
]);
//endregion
//region Check the schema is valid
const asn1 = asn1js.compareSchema(schema,
schema,
RecipientEncryptedKey.schema({
names: {
rid: {
names: {
blockName: "rid"
}
},
encryptedKey: "encryptedKey"
}
})
);
if(asn1.verified === false)
throw new Error("Object's schema was not verified against input data for RecipientEncryptedKey");
//endregion
fromSchema(schema)
{
//region Clear input data first
clearProps(schema, [
"attributes"
]);
//endregion
//region Check the schema is valid
const asn1 = asn1js.compareSchema(schema,
schema,
SignedAndUnsignedAttributes.schema({
names: {
tagNumber: this.type,
attributes: "attributes"
}
})
);
if(asn1.verified === false)
throw new Error("Object's schema was not verified against input data for SignedAndUnsignedAttributes");
//endregion
//region Get internal properties from parsed schema
this.type = asn1.result.idBlock.tagNumber;
this.encodedValue = asn1.result.valueBeforeDecode;
fromSchema(schema)
{
//region Clear input data first
clearProps(schema, [
"ResponseData",
"ResponseData.version",
"ResponseData.responderID",
"ResponseData.producedAt",
"ResponseData.responses",
"ResponseData.responseExtensions"
]);
//endregion
//region Check the schema is valid
const asn1 = asn1js.compareSchema(schema,
schema,
ResponseData.schema()
);
if(asn1.verified === false)
throw new Error("Object's schema was not verified against input data for ResponseData");
//endregion
//region Get internal properties from parsed schema
this.tbs = asn1.result.ResponseData.valueBeforeDecode;
if("ResponseData.version" in asn1.result)
this.version = asn1.result["ResponseData.version"].valueBlock.valueDec;
if(asn1.result["ResponseData.responderID"].idBlock.tagNumber === 1)
this.responderID = new RelativeDistinguishedNames({ schema: asn1.result["ResponseData.responderID"].valueBlock.value[0] });
fromSchema(schema)
{
//region Check the schema is valid
const asn1 = asn1js.compareSchema(schema,
schema,
ContentHints.schema({
names: {
contentDescription: "contentDescription",
contentType: "contentType"
}
})
);
if(asn1.verified === false)
throw new Error("Object's schema was not verified against input data for ContentHints");
//endregion
//region Get internal properties from parsed schema
if("contentDescription" in asn1.result)
this.contentDescription = asn1.result.contentDescription.valueBlock.value;
fromSchema(schema)
{
//region Check the schema is valid
const asn1 = asn1js.compareSchema(schema,
schema,
CompleteCertificateRefs.schema({
names: {
completeCertificateRefs: "completeCertificateRefs"
}
})
);
if(asn1.verified === false)
throw new Error("Object's schema was not verified against input data for CompleteCertificateRefs");
//endregion
//region Get internal properties from parsed schema
this.completeCertificateRefs = Array.from(asn1.result.completeCertificateRefs, element => new OtherCertID({ schema: element }));
//endregion
}
fromSchema(schema)
{
//region Clear input data first
clearProps(schema, [
"signatureAlgorithm",
"signature",
"certs"
]);
//endregion
//region Check the schema is valid
const asn1 = asn1js.compareSchema(schema,
schema,
Signature.schema({
names: {
signatureAlgorithm: {
names: {
blockName: "signatureAlgorithm"
}
},
signature: "signature",
certs: "certs"
}
})
);
if(asn1.verified === false)
throw new Error("Object's schema was not verified against input data for Signature");