summaryrefslogtreecommitdiffstats
path: root/third_party/js/PKI.js/src/Schema.ts
blob: a93004834a1511632b05ecd450135eb1ab4a1fb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
export type SchemaType = any;

export type SchemaNames = {
  blockName?: string;
  optional?: boolean;
};

export interface SchemaCompatible {
  /**
   * Converts parsed ASN.1 object into current class
   * @param schema
   */
  fromSchema(schema: SchemaType): void;
  /**
   * Convert current object to asn1js object and set correct values
   * @returns asn1js object
   */
  toSchema(): SchemaType;
  toJSON(): any;
}

export interface SchemaConstructor {
  schema?: SchemaType;
}

/**
 * Parameters for schema generation
 */
export interface SchemaParameters<N extends Record<string, any> = { /**/ }> {
  names?: SchemaNames & N;
}