/* eslint-disable @typescript-eslint/no-unused-vars */ import * as asn1js from "asn1js"; import * as pvtsutils from "pvtsutils"; import { AsnError } from "./errors"; import * as Schema from "./Schema";
/** * Name of the class
*/ publicstatic CLASS_NAME = "PkiObject";
/** * Returns block name * @returns Returns string block name
*/ publicstatic blockName(): string { returnthis.CLASS_NAME;
}
/** * Creates PKI object from the raw data * @param raw ASN.1 encoded raw data * @returns Initialized and filled current class object
*/ publicstatic fromBER<T extends PkiObject>(this: PkiObjectConstructor<T>, raw: BufferSource): T { const asn1 = asn1js.fromBER(raw);
AsnError.assert(asn1, this.name);
/** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value
*/ publicstatic defaultValues(memberName: string): any { thrownew Error(`Invalid member name for ${this.CLASS_NAME} class: ${memberName}`);
}
/** * Returns value of pre-defined ASN.1 schema for current class * @param parameters Input parameters for the schema * @returns ASN.1 schema object
*/ publicstatic schema(parameters: Schema.SchemaParameters = {}): Schema.SchemaType { thrownew Error(`Method '${this.CLASS_NAME}.schema' should be overridden`);
}
public get className(): string { return (this.constructor as unknown as { CLASS_NAME: string; }).CLASS_NAME;
}
/** * Converts parsed ASN.1 object into current class * @param schema ASN.1 schema
*/ publicabstract fromSchema(schema: Schema.SchemaType): void;
/** * Converts current object to ASN.1 object and sets correct values * @param encodeFlag If param equal to `false` then creates schema via decoding stored value. In other case creates schema via assembling from cached parts * @returns ASN.1 object
*/ publicabstract toSchema(encodeFlag?: boolean): Schema.SchemaType;
/** * Converts the class to JSON object * @returns JSON object
*/ publicabstract toJSON(): any;
public toString(encoding: "hex" | "base64" | "base64url" = "hex"): string {
let schema: Schema.SchemaType;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.