798 lines
25 KiB
TypeScript
Executable File
798 lines
25 KiB
TypeScript
Executable File
export namespace http {
|
|
|
|
export class Response {
|
|
Status: string;
|
|
StatusCode: number;
|
|
Proto: string;
|
|
ProtoMajor: number;
|
|
ProtoMinor: number;
|
|
Header: Record<string, Array<string>>;
|
|
Body: any;
|
|
ContentLength: number;
|
|
TransferEncoding: string[];
|
|
Close: boolean;
|
|
Uncompressed: boolean;
|
|
Trailer: Record<string, Array<string>>;
|
|
Request?: Request;
|
|
TLS?: tls.ConnectionState;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Response(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Status = source["Status"];
|
|
this.StatusCode = source["StatusCode"];
|
|
this.Proto = source["Proto"];
|
|
this.ProtoMajor = source["ProtoMajor"];
|
|
this.ProtoMinor = source["ProtoMinor"];
|
|
this.Header = source["Header"];
|
|
this.Body = source["Body"];
|
|
this.ContentLength = source["ContentLength"];
|
|
this.TransferEncoding = source["TransferEncoding"];
|
|
this.Close = source["Close"];
|
|
this.Uncompressed = source["Uncompressed"];
|
|
this.Trailer = source["Trailer"];
|
|
this.Request = this.convertValues(source["Request"], Request);
|
|
this.TLS = this.convertValues(source["TLS"], tls.ConnectionState);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class Request {
|
|
Method: string;
|
|
URL?: url.URL;
|
|
Proto: string;
|
|
ProtoMajor: number;
|
|
ProtoMinor: number;
|
|
Header: Record<string, Array<string>>;
|
|
Body: any;
|
|
ContentLength: number;
|
|
TransferEncoding: string[];
|
|
Close: boolean;
|
|
Host: string;
|
|
Form: Record<string, Array<string>>;
|
|
PostForm: Record<string, Array<string>>;
|
|
MultipartForm?: multipart.Form;
|
|
Trailer: Record<string, Array<string>>;
|
|
RemoteAddr: string;
|
|
RequestURI: string;
|
|
TLS?: tls.ConnectionState;
|
|
Response?: Response;
|
|
Pattern: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Request(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Method = source["Method"];
|
|
this.URL = this.convertValues(source["URL"], url.URL);
|
|
this.Proto = source["Proto"];
|
|
this.ProtoMajor = source["ProtoMajor"];
|
|
this.ProtoMinor = source["ProtoMinor"];
|
|
this.Header = source["Header"];
|
|
this.Body = source["Body"];
|
|
this.ContentLength = source["ContentLength"];
|
|
this.TransferEncoding = source["TransferEncoding"];
|
|
this.Close = source["Close"];
|
|
this.Host = source["Host"];
|
|
this.Form = source["Form"];
|
|
this.PostForm = source["PostForm"];
|
|
this.MultipartForm = this.convertValues(source["MultipartForm"], multipart.Form);
|
|
this.Trailer = source["Trailer"];
|
|
this.RemoteAddr = source["RemoteAddr"];
|
|
this.RequestURI = source["RequestURI"];
|
|
this.TLS = this.convertValues(source["TLS"], tls.ConnectionState);
|
|
this.Response = this.convertValues(source["Response"], Response);
|
|
this.Pattern = source["Pattern"];
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace library {
|
|
|
|
export class Album {
|
|
ID: number;
|
|
Name: string;
|
|
ArtistName: string;
|
|
CoverArtPath: string;
|
|
CoverArtSmall: string;
|
|
CoverArtMedium: string;
|
|
CoverArtLarge: string;
|
|
Year: number;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Album(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.ID = source["ID"];
|
|
this.Name = source["Name"];
|
|
this.ArtistName = source["ArtistName"];
|
|
this.CoverArtPath = source["CoverArtPath"];
|
|
this.CoverArtSmall = source["CoverArtSmall"];
|
|
this.CoverArtMedium = source["CoverArtMedium"];
|
|
this.CoverArtLarge = source["CoverArtLarge"];
|
|
this.Year = source["Year"];
|
|
}
|
|
}
|
|
export class ScanMetrics {
|
|
total: number;
|
|
loadExisting: number;
|
|
walkDuration: number;
|
|
extractionWallClock: number;
|
|
dbWritesWallClock: number;
|
|
orphanCleanup: number;
|
|
postScanVariants: number;
|
|
formatExtraction: Record<string, number>;
|
|
formatCount: Record<string, number>;
|
|
tagExtraction: number;
|
|
durationExtraction: number;
|
|
batchCommits: number;
|
|
coverArtSave: number;
|
|
thumbnailWallClock: number;
|
|
thumbnailGeneration: number;
|
|
thumbnailSmall: number;
|
|
thumbnailMedium: number;
|
|
thumbnailLarge: number;
|
|
clearQueue: number;
|
|
clearDatabase: number;
|
|
clearCoverFiles: number;
|
|
added: number;
|
|
updated: number;
|
|
skipped: number;
|
|
removed: number;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new ScanMetrics(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.total = source["total"];
|
|
this.loadExisting = source["loadExisting"];
|
|
this.walkDuration = source["walkDuration"];
|
|
this.extractionWallClock = source["extractionWallClock"];
|
|
this.dbWritesWallClock = source["dbWritesWallClock"];
|
|
this.orphanCleanup = source["orphanCleanup"];
|
|
this.postScanVariants = source["postScanVariants"];
|
|
this.formatExtraction = source["formatExtraction"];
|
|
this.formatCount = source["formatCount"];
|
|
this.tagExtraction = source["tagExtraction"];
|
|
this.durationExtraction = source["durationExtraction"];
|
|
this.batchCommits = source["batchCommits"];
|
|
this.coverArtSave = source["coverArtSave"];
|
|
this.thumbnailWallClock = source["thumbnailWallClock"];
|
|
this.thumbnailGeneration = source["thumbnailGeneration"];
|
|
this.thumbnailSmall = source["thumbnailSmall"];
|
|
this.thumbnailMedium = source["thumbnailMedium"];
|
|
this.thumbnailLarge = source["thumbnailLarge"];
|
|
this.clearQueue = source["clearQueue"];
|
|
this.clearDatabase = source["clearDatabase"];
|
|
this.clearCoverFiles = source["clearCoverFiles"];
|
|
this.added = source["added"];
|
|
this.updated = source["updated"];
|
|
this.skipped = source["skipped"];
|
|
this.removed = source["removed"];
|
|
}
|
|
}
|
|
export class Track {
|
|
TrackName: string;
|
|
ArtistName: string;
|
|
TrackLength: string;
|
|
FilePath: string;
|
|
TrackNumber: number;
|
|
DiscNumber: number;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Track(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.TrackName = source["TrackName"];
|
|
this.ArtistName = source["ArtistName"];
|
|
this.TrackLength = source["TrackLength"];
|
|
this.FilePath = source["FilePath"];
|
|
this.TrackNumber = source["TrackNumber"];
|
|
this.DiscNumber = source["DiscNumber"];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace multipart {
|
|
|
|
export class FileHeader {
|
|
Filename: string;
|
|
Header: Record<string, Array<string>>;
|
|
Size: number;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new FileHeader(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Filename = source["Filename"];
|
|
this.Header = source["Header"];
|
|
this.Size = source["Size"];
|
|
}
|
|
}
|
|
export class Form {
|
|
Value: Record<string, Array<string>>;
|
|
File: Record<string, Array<FileHeader>>;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Form(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Value = source["Value"];
|
|
this.File = this.convertValues(source["File"], Array<FileHeader>, true);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace net {
|
|
|
|
export class IPNet {
|
|
IP: number[];
|
|
Mask: number[];
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new IPNet(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.IP = source["IP"];
|
|
this.Mask = source["Mask"];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace pkix {
|
|
|
|
export class AttributeTypeAndValue {
|
|
Type: number[];
|
|
Value: any;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new AttributeTypeAndValue(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Type = source["Type"];
|
|
this.Value = source["Value"];
|
|
}
|
|
}
|
|
export class Extension {
|
|
Id: number[];
|
|
Critical: boolean;
|
|
Value: number[];
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Extension(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Id = source["Id"];
|
|
this.Critical = source["Critical"];
|
|
this.Value = source["Value"];
|
|
}
|
|
}
|
|
export class Name {
|
|
Country: string[];
|
|
Organization: string[];
|
|
OrganizationalUnit: string[];
|
|
Locality: string[];
|
|
Province: string[];
|
|
StreetAddress: string[];
|
|
PostalCode: string[];
|
|
SerialNumber: string;
|
|
CommonName: string;
|
|
Names: AttributeTypeAndValue[];
|
|
ExtraNames: AttributeTypeAndValue[];
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Name(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Country = source["Country"];
|
|
this.Organization = source["Organization"];
|
|
this.OrganizationalUnit = source["OrganizationalUnit"];
|
|
this.Locality = source["Locality"];
|
|
this.Province = source["Province"];
|
|
this.StreetAddress = source["StreetAddress"];
|
|
this.PostalCode = source["PostalCode"];
|
|
this.SerialNumber = source["SerialNumber"];
|
|
this.CommonName = source["CommonName"];
|
|
this.Names = this.convertValues(source["Names"], AttributeTypeAndValue);
|
|
this.ExtraNames = this.convertValues(source["ExtraNames"], AttributeTypeAndValue);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace playlist {
|
|
|
|
export class Summary {
|
|
ID: number;
|
|
Name: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Summary(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.ID = source["ID"];
|
|
this.Name = source["Name"];
|
|
}
|
|
}
|
|
export class Track {
|
|
ID: number;
|
|
Position: number;
|
|
FilePath: string;
|
|
Title: string;
|
|
Artist: string;
|
|
Album: string;
|
|
CoverArtPath: string;
|
|
CoverArtSmall: string;
|
|
CoverArtMedium: string;
|
|
CoverArtLarge: string;
|
|
Duration: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Track(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.ID = source["ID"];
|
|
this.Position = source["Position"];
|
|
this.FilePath = source["FilePath"];
|
|
this.Title = source["Title"];
|
|
this.Artist = source["Artist"];
|
|
this.Album = source["Album"];
|
|
this.CoverArtPath = source["CoverArtPath"];
|
|
this.CoverArtSmall = source["CoverArtSmall"];
|
|
this.CoverArtMedium = source["CoverArtMedium"];
|
|
this.CoverArtLarge = source["CoverArtLarge"];
|
|
this.Duration = source["Duration"];
|
|
}
|
|
}
|
|
export class WithTracks {
|
|
Summary: Summary;
|
|
Tracks: Track[];
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new WithTracks(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Summary = this.convertValues(source["Summary"], Summary);
|
|
this.Tracks = this.convertValues(source["Tracks"], Track);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace tls {
|
|
|
|
export class ConnectionState {
|
|
Version: number;
|
|
HandshakeComplete: boolean;
|
|
DidResume: boolean;
|
|
CipherSuite: number;
|
|
CurveID: number;
|
|
NegotiatedProtocol: string;
|
|
NegotiatedProtocolIsMutual: boolean;
|
|
ServerName: string;
|
|
PeerCertificates: x509.Certificate[];
|
|
VerifiedChains: x509.Certificate[][];
|
|
SignedCertificateTimestamps: number[][];
|
|
OCSPResponse: number[];
|
|
TLSUnique: number[];
|
|
ECHAccepted: boolean;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new ConnectionState(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Version = source["Version"];
|
|
this.HandshakeComplete = source["HandshakeComplete"];
|
|
this.DidResume = source["DidResume"];
|
|
this.CipherSuite = source["CipherSuite"];
|
|
this.CurveID = source["CurveID"];
|
|
this.NegotiatedProtocol = source["NegotiatedProtocol"];
|
|
this.NegotiatedProtocolIsMutual = source["NegotiatedProtocolIsMutual"];
|
|
this.ServerName = source["ServerName"];
|
|
this.PeerCertificates = this.convertValues(source["PeerCertificates"], x509.Certificate);
|
|
this.VerifiedChains = this.convertValues(source["VerifiedChains"], x509.Certificate);
|
|
this.SignedCertificateTimestamps = source["SignedCertificateTimestamps"];
|
|
this.OCSPResponse = source["OCSPResponse"];
|
|
this.TLSUnique = source["TLSUnique"];
|
|
this.ECHAccepted = source["ECHAccepted"];
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace url {
|
|
|
|
export class Userinfo {
|
|
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Userinfo(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
|
|
}
|
|
}
|
|
export class URL {
|
|
Scheme: string;
|
|
Opaque: string;
|
|
// Go type: Userinfo
|
|
User?: any;
|
|
Host: string;
|
|
Path: string;
|
|
RawPath: string;
|
|
OmitHost: boolean;
|
|
ForceQuery: boolean;
|
|
RawQuery: string;
|
|
Fragment: string;
|
|
RawFragment: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new URL(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Scheme = source["Scheme"];
|
|
this.Opaque = source["Opaque"];
|
|
this.User = this.convertValues(source["User"], null);
|
|
this.Host = source["Host"];
|
|
this.Path = source["Path"];
|
|
this.RawPath = source["RawPath"];
|
|
this.OmitHost = source["OmitHost"];
|
|
this.ForceQuery = source["ForceQuery"];
|
|
this.RawQuery = source["RawQuery"];
|
|
this.Fragment = source["Fragment"];
|
|
this.RawFragment = source["RawFragment"];
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace x509 {
|
|
|
|
export class PolicyMapping {
|
|
// Go type: OID
|
|
IssuerDomainPolicy: any;
|
|
// Go type: OID
|
|
SubjectDomainPolicy: any;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new PolicyMapping(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.IssuerDomainPolicy = this.convertValues(source["IssuerDomainPolicy"], null);
|
|
this.SubjectDomainPolicy = this.convertValues(source["SubjectDomainPolicy"], null);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class OID {
|
|
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new OID(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
|
|
}
|
|
}
|
|
export class Certificate {
|
|
Raw: number[];
|
|
RawTBSCertificate: number[];
|
|
RawSubjectPublicKeyInfo: number[];
|
|
RawSubject: number[];
|
|
RawIssuer: number[];
|
|
Signature: number[];
|
|
SignatureAlgorithm: number;
|
|
PublicKeyAlgorithm: number;
|
|
PublicKey: any;
|
|
Version: number;
|
|
// Go type: big
|
|
SerialNumber?: any;
|
|
Issuer: pkix.Name;
|
|
Subject: pkix.Name;
|
|
// Go type: time
|
|
NotBefore: any;
|
|
// Go type: time
|
|
NotAfter: any;
|
|
KeyUsage: number;
|
|
Extensions: pkix.Extension[];
|
|
ExtraExtensions: pkix.Extension[];
|
|
UnhandledCriticalExtensions: number[][];
|
|
ExtKeyUsage: number[];
|
|
UnknownExtKeyUsage: number[][];
|
|
BasicConstraintsValid: boolean;
|
|
IsCA: boolean;
|
|
MaxPathLen: number;
|
|
MaxPathLenZero: boolean;
|
|
SubjectKeyId: number[];
|
|
AuthorityKeyId: number[];
|
|
OCSPServer: string[];
|
|
IssuingCertificateURL: string[];
|
|
DNSNames: string[];
|
|
EmailAddresses: string[];
|
|
IPAddresses: number[][];
|
|
URIs: url.URL[];
|
|
PermittedDNSDomainsCritical: boolean;
|
|
PermittedDNSDomains: string[];
|
|
ExcludedDNSDomains: string[];
|
|
PermittedIPRanges: net.IPNet[];
|
|
ExcludedIPRanges: net.IPNet[];
|
|
PermittedEmailAddresses: string[];
|
|
ExcludedEmailAddresses: string[];
|
|
PermittedURIDomains: string[];
|
|
ExcludedURIDomains: string[];
|
|
CRLDistributionPoints: string[];
|
|
PolicyIdentifiers: number[][];
|
|
Policies: OID[];
|
|
InhibitAnyPolicy: number;
|
|
InhibitAnyPolicyZero: boolean;
|
|
InhibitPolicyMapping: number;
|
|
InhibitPolicyMappingZero: boolean;
|
|
RequireExplicitPolicy: number;
|
|
RequireExplicitPolicyZero: boolean;
|
|
PolicyMappings: PolicyMapping[];
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Certificate(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.Raw = source["Raw"];
|
|
this.RawTBSCertificate = source["RawTBSCertificate"];
|
|
this.RawSubjectPublicKeyInfo = source["RawSubjectPublicKeyInfo"];
|
|
this.RawSubject = source["RawSubject"];
|
|
this.RawIssuer = source["RawIssuer"];
|
|
this.Signature = source["Signature"];
|
|
this.SignatureAlgorithm = source["SignatureAlgorithm"];
|
|
this.PublicKeyAlgorithm = source["PublicKeyAlgorithm"];
|
|
this.PublicKey = source["PublicKey"];
|
|
this.Version = source["Version"];
|
|
this.SerialNumber = this.convertValues(source["SerialNumber"], null);
|
|
this.Issuer = this.convertValues(source["Issuer"], pkix.Name);
|
|
this.Subject = this.convertValues(source["Subject"], pkix.Name);
|
|
this.NotBefore = this.convertValues(source["NotBefore"], null);
|
|
this.NotAfter = this.convertValues(source["NotAfter"], null);
|
|
this.KeyUsage = source["KeyUsage"];
|
|
this.Extensions = this.convertValues(source["Extensions"], pkix.Extension);
|
|
this.ExtraExtensions = this.convertValues(source["ExtraExtensions"], pkix.Extension);
|
|
this.UnhandledCriticalExtensions = source["UnhandledCriticalExtensions"];
|
|
this.ExtKeyUsage = source["ExtKeyUsage"];
|
|
this.UnknownExtKeyUsage = source["UnknownExtKeyUsage"];
|
|
this.BasicConstraintsValid = source["BasicConstraintsValid"];
|
|
this.IsCA = source["IsCA"];
|
|
this.MaxPathLen = source["MaxPathLen"];
|
|
this.MaxPathLenZero = source["MaxPathLenZero"];
|
|
this.SubjectKeyId = source["SubjectKeyId"];
|
|
this.AuthorityKeyId = source["AuthorityKeyId"];
|
|
this.OCSPServer = source["OCSPServer"];
|
|
this.IssuingCertificateURL = source["IssuingCertificateURL"];
|
|
this.DNSNames = source["DNSNames"];
|
|
this.EmailAddresses = source["EmailAddresses"];
|
|
this.IPAddresses = source["IPAddresses"];
|
|
this.URIs = this.convertValues(source["URIs"], url.URL);
|
|
this.PermittedDNSDomainsCritical = source["PermittedDNSDomainsCritical"];
|
|
this.PermittedDNSDomains = source["PermittedDNSDomains"];
|
|
this.ExcludedDNSDomains = source["ExcludedDNSDomains"];
|
|
this.PermittedIPRanges = this.convertValues(source["PermittedIPRanges"], net.IPNet);
|
|
this.ExcludedIPRanges = this.convertValues(source["ExcludedIPRanges"], net.IPNet);
|
|
this.PermittedEmailAddresses = source["PermittedEmailAddresses"];
|
|
this.ExcludedEmailAddresses = source["ExcludedEmailAddresses"];
|
|
this.PermittedURIDomains = source["PermittedURIDomains"];
|
|
this.ExcludedURIDomains = source["ExcludedURIDomains"];
|
|
this.CRLDistributionPoints = source["CRLDistributionPoints"];
|
|
this.PolicyIdentifiers = source["PolicyIdentifiers"];
|
|
this.Policies = this.convertValues(source["Policies"], OID);
|
|
this.InhibitAnyPolicy = source["InhibitAnyPolicy"];
|
|
this.InhibitAnyPolicyZero = source["InhibitAnyPolicyZero"];
|
|
this.InhibitPolicyMapping = source["InhibitPolicyMapping"];
|
|
this.InhibitPolicyMappingZero = source["InhibitPolicyMappingZero"];
|
|
this.RequireExplicitPolicy = source["RequireExplicitPolicy"];
|
|
this.RequireExplicitPolicyZero = source["RequireExplicitPolicyZero"];
|
|
this.PolicyMappings = this.convertValues(source["PolicyMappings"], PolicyMapping);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
}
|
|
|