|
| 1 | +import { Enum } from "../src/enum.js"; |
| 2 | +import { Constrained } from "../src/dep.ts"; |
| 3 | + |
1 | 4 | /** |
2 | | - * Supported groups - @see https://datatracker.ietf.org/doc/html/rfc8446#section-4.2.7. |
| 5 | + * Represents TLS Certificate Types. |
| 6 | + * @see https://datatracker.ietf.org/doc/html/rfc8446#section-4.2.7 |
| 7 | + * @extends {Enum} |
3 | 8 | */ |
4 | 9 | export class CertificateType extends Enum { |
5 | | - static X509: CertificateType; |
6 | | - static RAWPUBLICKEY: CertificateType; |
7 | | - /** |
8 | | - * check octet and return valid CertificateType |
9 | | - * |
10 | | - * @static |
11 | | - * @param {Uint8Array} octet |
12 | | - * @returns {CertificateType } |
13 | | - */ |
14 | | - static from(octet: Uint8Array): CertificateType; |
15 | | - /**return 8 */ |
16 | | - get bit(): number; |
| 10 | + /** Certificate type X.509 */ |
| 11 | + static X509: CertificateType; |
| 12 | + |
| 13 | + /** Certificate type Raw Public Key */ |
| 14 | + static RAWPUBLICKEY: CertificateType; |
| 15 | + |
| 16 | + /** |
| 17 | + * Checks the given octet and returns a valid `CertificateType`. |
| 18 | + * @param {Uint8Array} octet - The octet to validate. |
| 19 | + * @returns {CertificateType} The corresponding `CertificateType`. |
| 20 | + * @throws Will throw an error if the type is unknown. |
| 21 | + */ |
| 22 | + static from(octet: Uint8Array): CertificateType; |
| 23 | + |
| 24 | + /** |
| 25 | + * The bit length of the certificate type. |
| 26 | + * @type {number} |
| 27 | + * @readonly |
| 28 | + */ |
| 29 | + get bit(): number; |
| 30 | +} |
| 31 | + |
| 32 | +/** |
| 33 | + * Represents a TLS Certificate Entry. |
| 34 | + * @extends {Uint8Array} |
| 35 | + */ |
| 36 | +export class CertificateEntry extends Uint8Array { |
| 37 | + /** |
| 38 | + * Parses an array to create a `CertificateEntry`. |
| 39 | + * @param {Uint8Array} array - The array to parse. |
| 40 | + * @returns {CertificateEntry} The parsed certificate entry. |
| 41 | + */ |
| 42 | + static from(array: Uint8Array): CertificateEntry; |
| 43 | + |
| 44 | + /** |
| 45 | + * Constructs a `CertificateEntry`. |
| 46 | + * @param {Uint8Array} opaque - The certificate data. |
| 47 | + * @param {...Uint8Array} extension - The certificate extensions. |
| 48 | + */ |
| 49 | + constructor(opaque: Uint8Array, ...extension: Uint8Array[]); |
| 50 | + |
| 51 | + /** The certificate data. */ |
| 52 | + opaque: Uint8Array; |
| 53 | + |
| 54 | + /** The certificate extensions. */ |
| 55 | + extension: Uint8Array[]; |
| 56 | +} |
| 57 | + |
| 58 | +/** |
| 59 | + * Represents a TLS Certificate structure. |
| 60 | + * @extends {Uint8Array} |
| 61 | + */ |
| 62 | +export class Certificate extends Uint8Array { |
| 63 | + /** |
| 64 | + * Parses an array to create a `Certificate`. |
| 65 | + * @param {Uint8Array} array - The array to parse. |
| 66 | + * @returns {Certificate} The parsed certificate. |
| 67 | + */ |
| 68 | + static from(array: Uint8Array): Certificate; |
| 69 | + |
| 70 | + /** |
| 71 | + * Constructs a `Certificate`. |
| 72 | + * @param {Uint8Array} opaque - The certificate request context. |
| 73 | + * @param {...CertificateEntry} certificateEntry - The list of certificate entries. |
| 74 | + */ |
| 75 | + constructor(opaque: Uint8Array, ...certificateEntry: CertificateEntry[]); |
| 76 | + |
| 77 | + /** The certificate request context. */ |
| 78 | + opaque: Uint8Array; |
| 79 | + |
| 80 | + /** The list of certificate entries. */ |
| 81 | + certificateEntry: CertificateEntry[]; |
| 82 | +} |
| 83 | + |
| 84 | +/** |
| 85 | + * Represents constrained certificate data. |
| 86 | + * @extends {Constrained} |
| 87 | + * @private |
| 88 | + */ |
| 89 | +declare class Cert_data extends Constrained { |
| 90 | + /** |
| 91 | + * Parses an array to create `Cert_data`. |
| 92 | + * @param {Uint8Array} array - The array to parse. |
| 93 | + * @returns {Cert_data} The parsed certificate data. |
| 94 | + */ |
| 95 | + static from(array: Uint8Array): Cert_data; |
| 96 | + |
| 97 | + /** |
| 98 | + * Constructs a `Cert_data` instance. |
| 99 | + * @param {Uint8Array} opaque - The certificate data. |
| 100 | + */ |
| 101 | + constructor(opaque: Uint8Array); |
| 102 | + |
| 103 | + /** The certificate data. */ |
| 104 | + opaque: Uint8Array; |
| 105 | +} |
| 106 | + |
| 107 | +/** |
| 108 | + * Represents constrained extensions. |
| 109 | + * @extends {Constrained} |
| 110 | + * @private |
| 111 | + */ |
| 112 | +declare class Extensions extends Constrained { |
| 113 | + /** |
| 114 | + * Parses an array to create `Extensions`. |
| 115 | + * @param {Uint8Array} array - The array to parse. |
| 116 | + * @returns {Extensions} The parsed extensions. |
| 117 | + */ |
| 118 | + static from(array: Uint8Array): Extensions; |
| 119 | + |
| 120 | + /** |
| 121 | + * Constructs an `Extensions` instance. |
| 122 | + * @param {...Uint8Array} extension - The list of extensions. |
| 123 | + */ |
| 124 | + constructor(...extension: Uint8Array[]); |
| 125 | + |
| 126 | + /** The list of extensions. */ |
| 127 | + extension: Uint8Array[]; |
| 128 | +} |
| 129 | + |
| 130 | +/** |
| 131 | + * Represents a certificate request context. |
| 132 | + * @extends {Constrained} |
| 133 | + * @private |
| 134 | + */ |
| 135 | +declare class Certificate_request_context extends Constrained { |
| 136 | + /** |
| 137 | + * Parses an array to create `Certificate_request_context`. |
| 138 | + * @param {Uint8Array} array - The array to parse. |
| 139 | + * @returns {Certificate_request_context} The parsed context. |
| 140 | + */ |
| 141 | + static from(array: Uint8Array): Certificate_request_context; |
| 142 | + |
| 143 | + /** |
| 144 | + * Constructs a `Certificate_request_context` instance. |
| 145 | + * @param {Uint8Array} opaque - The context data. |
| 146 | + */ |
| 147 | + constructor(opaque: Uint8Array); |
| 148 | + |
| 149 | + /** The context data. */ |
| 150 | + opaque: Uint8Array; |
| 151 | +} |
| 152 | + |
| 153 | +/** |
| 154 | + * Represents a certificate list. |
| 155 | + * @extends {Constrained} |
| 156 | + * @private |
| 157 | + */ |
| 158 | +declare class Certificate_list extends Constrained { |
| 159 | + /** |
| 160 | + * Parses an array to create `Certificate_list`. |
| 161 | + * @param {Uint8Array} array - The array to parse. |
| 162 | + * @returns {Certificate_list} The parsed list. |
| 163 | + */ |
| 164 | + static from(array: Uint8Array): Certificate_list; |
| 165 | + |
| 166 | + /** |
| 167 | + * Constructs a `Certificate_list` instance. |
| 168 | + * @param {...CertificateEntry} certificateEntry - The list of certificate entries. |
| 169 | + */ |
| 170 | + constructor(...certificateEntry: CertificateEntry[]); |
| 171 | + |
| 172 | + /** The list of certificate entries. */ |
| 173 | + certificateEntry: CertificateEntry[]; |
17 | 174 | } |
18 | | -import { Enum } from "../src/enum.js"; |
|
0 commit comments