@tak-ps/node-tak 11.18.2 → 11.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/api/certificate.d.ts +117 -0
- package/dist/lib/api/certificate.js +133 -0
- package/dist/lib/api/certificate.js.map +1 -0
- package/dist/lib/api.d.ts +5 -2
- package/dist/lib/api.js +7 -2
- package/dist/lib/api.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/index.ts +3 -3
- package/lib/api/certificate.ts +168 -0
- package/lib/api.ts +32 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
## Version History
|
|
12
12
|
|
|
13
|
+
### v11.20.0 - 2025-12-21
|
|
14
|
+
|
|
15
|
+
- :tada: Introduce deleting/revoking by ID and add TS Docs
|
|
16
|
+
|
|
17
|
+
### v11.19.0 - 2025-12-21
|
|
18
|
+
|
|
19
|
+
- :tada: Introduce first batch of Certificate APIs
|
|
20
|
+
|
|
13
21
|
### v11.18.2 - 2025-12-16
|
|
14
22
|
|
|
15
23
|
- :rocket: Add Build Step
|
package/dist/index.d.ts
CHANGED
|
@@ -31,8 +31,6 @@ export default class TAK extends EventEmitter {
|
|
|
31
31
|
client?: TLSSocket;
|
|
32
32
|
version?: string;
|
|
33
33
|
/**
|
|
34
|
-
* @constructor
|
|
35
|
-
*
|
|
36
34
|
* @param url - Full URL of Streaming COT Endpoint IE: "https://ops.cotak.gov:8089"
|
|
37
35
|
* @param auth - TAK Certificate Pair
|
|
38
36
|
* @param opts - Options Object
|
|
@@ -50,10 +48,12 @@ export default class TAK extends EventEmitter {
|
|
|
50
48
|
/**
|
|
51
49
|
* Write a CoT to the TAK Connection
|
|
52
50
|
*
|
|
53
|
-
* @param {CoT}
|
|
51
|
+
* @param {CoT} cots CoT Object
|
|
54
52
|
*/
|
|
55
53
|
write(cots: CoT[]): Promise<void>;
|
|
56
54
|
write_xml(body: string): void;
|
|
57
55
|
static findCoT(str: string): null | PartialCoT;
|
|
58
56
|
}
|
|
57
|
+
export * from './lib/api.js';
|
|
58
|
+
export { CommandOutputFormat } from './lib/commands.js';
|
|
59
59
|
export { TAKAPI, CoT, };
|
package/dist/index.js
CHANGED
|
@@ -21,8 +21,6 @@ export default class TAK extends EventEmitter {
|
|
|
21
21
|
client;
|
|
22
22
|
version;
|
|
23
23
|
/**
|
|
24
|
-
* @constructor
|
|
25
|
-
*
|
|
26
24
|
* @param url - Full URL of Streaming COT Endpoint IE: "https://ops.cotak.gov:8089"
|
|
27
25
|
* @param auth - TAK Certificate Pair
|
|
28
26
|
* @param opts - Options Object
|
|
@@ -172,7 +170,7 @@ export default class TAK extends EventEmitter {
|
|
|
172
170
|
/**
|
|
173
171
|
* Write a CoT to the TAK Connection
|
|
174
172
|
*
|
|
175
|
-
* @param {CoT}
|
|
173
|
+
* @param {CoT} cots CoT Object
|
|
176
174
|
*/
|
|
177
175
|
async write(cots) {
|
|
178
176
|
for (const cot of cots) {
|
|
@@ -200,5 +198,7 @@ export default class TAK extends EventEmitter {
|
|
|
200
198
|
};
|
|
201
199
|
}
|
|
202
200
|
}
|
|
201
|
+
export * from './lib/api.js';
|
|
202
|
+
export { CommandOutputFormat } from './lib/commands.js';
|
|
203
203
|
export { TAKAPI, CoT, };
|
|
204
204
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,aAAa,CAAC;AAEvC,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,GAAG,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAIlD,OAAO,MAAM,MAAM,cAAc,CAAC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';
|
|
2
|
+
import type { Static } from '@sinclair/typebox';
|
|
3
|
+
export declare const Certificate: import("@sinclair/typebox").TObject<{
|
|
4
|
+
id: import("@sinclair/typebox").TInteger;
|
|
5
|
+
creatorDn: import("@sinclair/typebox").TString;
|
|
6
|
+
subjectDn: import("@sinclair/typebox").TString;
|
|
7
|
+
userDn: import("@sinclair/typebox").TString;
|
|
8
|
+
certificate: import("@sinclair/typebox").TString;
|
|
9
|
+
hash: import("@sinclair/typebox").TString;
|
|
10
|
+
clientUid: import("@sinclair/typebox").TString;
|
|
11
|
+
issuanceDate: import("@sinclair/typebox").TString;
|
|
12
|
+
expirationDate: import("@sinclair/typebox").TString;
|
|
13
|
+
effectiveDate: import("@sinclair/typebox").TString;
|
|
14
|
+
revocationDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
15
|
+
token: import("@sinclair/typebox").TString;
|
|
16
|
+
serialNumber: import("@sinclair/typebox").TString;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const TAKList_Certificate: import("@sinclair/typebox").TObject<{
|
|
19
|
+
version: import("@sinclair/typebox").TString;
|
|
20
|
+
type: import("@sinclair/typebox").TString;
|
|
21
|
+
data: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
22
|
+
id: import("@sinclair/typebox").TInteger;
|
|
23
|
+
creatorDn: import("@sinclair/typebox").TString;
|
|
24
|
+
subjectDn: import("@sinclair/typebox").TString;
|
|
25
|
+
userDn: import("@sinclair/typebox").TString;
|
|
26
|
+
certificate: import("@sinclair/typebox").TString;
|
|
27
|
+
hash: import("@sinclair/typebox").TString;
|
|
28
|
+
clientUid: import("@sinclair/typebox").TString;
|
|
29
|
+
issuanceDate: import("@sinclair/typebox").TString;
|
|
30
|
+
expirationDate: import("@sinclair/typebox").TString;
|
|
31
|
+
effectiveDate: import("@sinclair/typebox").TString;
|
|
32
|
+
revocationDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
33
|
+
token: import("@sinclair/typebox").TString;
|
|
34
|
+
serialNumber: import("@sinclair/typebox").TString;
|
|
35
|
+
}>>;
|
|
36
|
+
messages: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
37
|
+
nodeId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
38
|
+
}>;
|
|
39
|
+
export declare const TAKItem_Certificate: import("@sinclair/typebox").TObject<{
|
|
40
|
+
version: import("@sinclair/typebox").TString;
|
|
41
|
+
type: import("@sinclair/typebox").TString;
|
|
42
|
+
data: import("@sinclair/typebox").TObject<{
|
|
43
|
+
id: import("@sinclair/typebox").TInteger;
|
|
44
|
+
creatorDn: import("@sinclair/typebox").TString;
|
|
45
|
+
subjectDn: import("@sinclair/typebox").TString;
|
|
46
|
+
userDn: import("@sinclair/typebox").TString;
|
|
47
|
+
certificate: import("@sinclair/typebox").TString;
|
|
48
|
+
hash: import("@sinclair/typebox").TString;
|
|
49
|
+
clientUid: import("@sinclair/typebox").TString;
|
|
50
|
+
issuanceDate: import("@sinclair/typebox").TString;
|
|
51
|
+
expirationDate: import("@sinclair/typebox").TString;
|
|
52
|
+
effectiveDate: import("@sinclair/typebox").TString;
|
|
53
|
+
revocationDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
54
|
+
token: import("@sinclair/typebox").TString;
|
|
55
|
+
serialNumber: import("@sinclair/typebox").TString;
|
|
56
|
+
}>;
|
|
57
|
+
messages: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
58
|
+
nodeId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
59
|
+
}>;
|
|
60
|
+
export default class CertificateCommands extends Commands {
|
|
61
|
+
schema: {};
|
|
62
|
+
cli(): Promise<object | string>;
|
|
63
|
+
/**
|
|
64
|
+
* List Certificates
|
|
65
|
+
*
|
|
66
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/getAll_1 TAK Server Docs}.
|
|
67
|
+
*/
|
|
68
|
+
list(username?: string): Promise<Static<typeof TAKList_Certificate>>;
|
|
69
|
+
/**
|
|
70
|
+
* List Revoked Certificates
|
|
71
|
+
*
|
|
72
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/getRevoked TAK Server Docs}.
|
|
73
|
+
*/
|
|
74
|
+
listRevoked(): Promise<Static<typeof TAKList_Certificate>>;
|
|
75
|
+
/**
|
|
76
|
+
* List Replaced Certificates
|
|
77
|
+
*
|
|
78
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/getReplaced TAK Server Docs}.
|
|
79
|
+
*/
|
|
80
|
+
listReplaced(): Promise<Static<typeof TAKList_Certificate>>;
|
|
81
|
+
/**
|
|
82
|
+
* List Expired Certificates
|
|
83
|
+
*
|
|
84
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/getExpired TAK Server Docs}.
|
|
85
|
+
*/
|
|
86
|
+
listExpired(): Promise<Static<typeof TAKList_Certificate>>;
|
|
87
|
+
/**
|
|
88
|
+
* Get Single Certificate
|
|
89
|
+
*
|
|
90
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/getCertificate TAK Server Docs}.
|
|
91
|
+
*/
|
|
92
|
+
get(hash: string): Promise<Static<typeof TAKItem_Certificate>>;
|
|
93
|
+
/**
|
|
94
|
+
* Download Single Certificate
|
|
95
|
+
*
|
|
96
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/downloadCertificate TAK Server Docs}.
|
|
97
|
+
*/
|
|
98
|
+
download(hash: string): Promise<string>;
|
|
99
|
+
/**
|
|
100
|
+
* Revoke Single Certificate
|
|
101
|
+
*
|
|
102
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/revokeCertificate TAK Server Docs}.
|
|
103
|
+
*/
|
|
104
|
+
revoke(hash: string): Promise<Static<typeof TAKItem_Certificate>>;
|
|
105
|
+
/**
|
|
106
|
+
* Revoke Certificates by Id
|
|
107
|
+
*
|
|
108
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/revokeCertificates TAK Server Docs}.
|
|
109
|
+
*/
|
|
110
|
+
revokeIds(ids: string[]): Promise<Static<typeof TAKItem_Certificate>>;
|
|
111
|
+
/**
|
|
112
|
+
* Delete Certificates by Id
|
|
113
|
+
*
|
|
114
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/deleteCertificates TAK Server Docs}.
|
|
115
|
+
*/
|
|
116
|
+
deleteIds(ids: string[]): Promise<Static<typeof TAKItem_Certificate>>;
|
|
117
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import Commands from '../commands.js';
|
|
2
|
+
import { Type } from '@sinclair/typebox';
|
|
3
|
+
import { TAKItem, TAKList } from './types.js';
|
|
4
|
+
export const Certificate = Type.Object({
|
|
5
|
+
id: Type.Integer(),
|
|
6
|
+
creatorDn: Type.String(),
|
|
7
|
+
subjectDn: Type.String(),
|
|
8
|
+
userDn: Type.String(),
|
|
9
|
+
certificate: Type.String(),
|
|
10
|
+
hash: Type.String(),
|
|
11
|
+
clientUid: Type.String(),
|
|
12
|
+
issuanceDate: Type.String({ format: 'date-time' }),
|
|
13
|
+
expirationDate: Type.String({ format: 'date-time' }),
|
|
14
|
+
effectiveDate: Type.String({ format: 'date-time' }),
|
|
15
|
+
revocationDate: Type.Optional(Type.String({ format: 'date-time' })),
|
|
16
|
+
token: Type.String(),
|
|
17
|
+
serialNumber: Type.String()
|
|
18
|
+
});
|
|
19
|
+
export const TAKList_Certificate = TAKList(Certificate);
|
|
20
|
+
export const TAKItem_Certificate = TAKItem(Certificate);
|
|
21
|
+
export default class CertificateCommands extends Commands {
|
|
22
|
+
schema = {};
|
|
23
|
+
async cli() {
|
|
24
|
+
throw new Error('Unsupported Subcommand');
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* List Certificates
|
|
28
|
+
*
|
|
29
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/getAll_1 TAK Server Docs}.
|
|
30
|
+
*/
|
|
31
|
+
async list(username) {
|
|
32
|
+
const url = new URL('/Marti/api/certadmin/cert', this.api.url);
|
|
33
|
+
if (username) {
|
|
34
|
+
url.searchParams.append('username', username);
|
|
35
|
+
}
|
|
36
|
+
return await this.api.fetch(url);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* List Revoked Certificates
|
|
40
|
+
*
|
|
41
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/getRevoked TAK Server Docs}.
|
|
42
|
+
*/
|
|
43
|
+
async listRevoked() {
|
|
44
|
+
const url = new URL('/Marti/api/certadmin/cert/revoked', this.api.url);
|
|
45
|
+
return await this.api.fetch(url);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* List Replaced Certificates
|
|
49
|
+
*
|
|
50
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/getReplaced TAK Server Docs}.
|
|
51
|
+
*/
|
|
52
|
+
async listReplaced() {
|
|
53
|
+
const url = new URL('/Marti/api/certadmin/cert/replaced', this.api.url);
|
|
54
|
+
return await this.api.fetch(url);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* List Expired Certificates
|
|
58
|
+
*
|
|
59
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/getExpired TAK Server Docs}.
|
|
60
|
+
*/
|
|
61
|
+
async listExpired() {
|
|
62
|
+
const url = new URL('/Marti/api/certadmin/cert/expired', this.api.url);
|
|
63
|
+
return await this.api.fetch(url);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get Single Certificate
|
|
67
|
+
*
|
|
68
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/getCertificate TAK Server Docs}.
|
|
69
|
+
*/
|
|
70
|
+
async get(hash) {
|
|
71
|
+
const url = new URL(`/Marti/api/certadmin/cert/${hash}`, this.api.url);
|
|
72
|
+
return await this.api.fetch(url);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Download Single Certificate
|
|
76
|
+
*
|
|
77
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/downloadCertificate TAK Server Docs}.
|
|
78
|
+
*/
|
|
79
|
+
async download(hash) {
|
|
80
|
+
const url = new URL(`/Marti/api/certadmin/cert/${hash}/download`, this.api.url);
|
|
81
|
+
return await this.api.fetch(url, {
|
|
82
|
+
method: 'GET',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Revoke Single Certificate
|
|
87
|
+
*
|
|
88
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/revokeCertificate TAK Server Docs}.
|
|
89
|
+
*/
|
|
90
|
+
async revoke(hash) {
|
|
91
|
+
const url = new URL(`/Marti/api/certadmin/cert/${hash}`, this.api.url);
|
|
92
|
+
return await this.api.fetch(url, {
|
|
93
|
+
method: 'DELETE'
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Revoke Certificates by Id
|
|
98
|
+
*
|
|
99
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/revokeCertificates TAK Server Docs}.
|
|
100
|
+
*/
|
|
101
|
+
async revokeIds(ids) {
|
|
102
|
+
if (ids.length === 0) {
|
|
103
|
+
throw new Error('At least one ID must be provided');
|
|
104
|
+
}
|
|
105
|
+
else if (ids.length > 1) {
|
|
106
|
+
// TODO the api docs suggest this is possible but I haven't tested it yet
|
|
107
|
+
throw new Error('Only one ID can be currently revoked at a time');
|
|
108
|
+
}
|
|
109
|
+
const url = new URL(`/Marti/api/certadmin/cert/revoke/${ids[0]}`, this.api.url);
|
|
110
|
+
return await this.api.fetch(url, {
|
|
111
|
+
method: 'DELETE'
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Delete Certificates by Id
|
|
116
|
+
*
|
|
117
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/deleteCertificates TAK Server Docs}.
|
|
118
|
+
*/
|
|
119
|
+
async deleteIds(ids) {
|
|
120
|
+
if (ids.length === 0) {
|
|
121
|
+
throw new Error('At least one ID must be provided');
|
|
122
|
+
}
|
|
123
|
+
else if (ids.length > 1) {
|
|
124
|
+
// TODO the api docs suggest this is possible but I haven't tested it yet
|
|
125
|
+
throw new Error('Only one ID can be currently deleted at a time');
|
|
126
|
+
}
|
|
127
|
+
const url = new URL(`/Marti/api/certadmin/cert/delete/${ids[0]}`, this.api.url);
|
|
128
|
+
return await this.api.fetch(url, {
|
|
129
|
+
method: 'DELETE'
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=certificate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"certificate.js","sourceRoot":"","sources":["../../../lib/api/certificate.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC;IACnC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE;IAClB,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE;IACxB,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE;IACxB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;IACrB,WAAW,EAAE,IAAI,CAAC,MAAM,EA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KAAK,CAAC,GAAG,EAAE;YAC7B,MAAM,EAAE,QAAQ;SACnB,CAAuC,CAAC;IAC7C,CAAC;CACJ"}
|
package/dist/lib/api.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import OAuth from './api/oauth.js';
|
|
2
2
|
import Package from './api/package.js';
|
|
3
|
+
import Certificate from './api/certificate.js';
|
|
3
4
|
import Query from './api/query.js';
|
|
4
5
|
import Locate from './api/locate.js';
|
|
5
|
-
import Mission from './api/mission.js';
|
|
6
|
+
import Mission, { MissionSubscriberRole } from './api/mission.js';
|
|
6
7
|
import MissionInvite from './api/mission-invite.js';
|
|
7
8
|
import MissionLog from './api/mission-log.js';
|
|
8
|
-
import MissionLayer from './api/mission-layer.js';
|
|
9
|
+
import MissionLayer, { MissionLayerType } from './api/mission-layer.js';
|
|
9
10
|
import Credentials from './api/credentials.js';
|
|
10
11
|
import Security from './api/security.js';
|
|
11
12
|
import Contacts from './api/contacts.js';
|
|
@@ -38,6 +39,7 @@ export default class TAKAPI {
|
|
|
38
39
|
MissionLayer: MissionLayer;
|
|
39
40
|
Credentials: Credentials;
|
|
40
41
|
Contacts: Contacts;
|
|
42
|
+
Certificate: Certificate;
|
|
41
43
|
Subscription: Subscription;
|
|
42
44
|
Profile: Profile;
|
|
43
45
|
Injectors: Injectors;
|
|
@@ -58,3 +60,4 @@ export default class TAKAPI {
|
|
|
58
60
|
*/
|
|
59
61
|
fetch(url: URL, opts?: any, raw?: boolean): Promise<any>;
|
|
60
62
|
}
|
|
63
|
+
export { OAuth, Package, Certificate, Query, Locate, Mission, MissionInvite, MissionLog, MissionLayer, Credentials, Security, Contacts, Profile, Files, Iconsets, Injectors, Repeater, Group, Subscription, Video, Export, MissionSubscriberRole, MissionLayerType };
|
package/dist/lib/api.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import FormData from 'form-data';
|
|
2
2
|
import OAuth from './api/oauth.js';
|
|
3
3
|
import Package from './api/package.js';
|
|
4
|
+
import Certificate from './api/certificate.js';
|
|
4
5
|
import Query from './api/query.js';
|
|
5
6
|
import Locate from './api/locate.js';
|
|
6
|
-
import Mission from './api/mission.js';
|
|
7
|
+
import Mission, { MissionSubscriberRole } from './api/mission.js';
|
|
7
8
|
import MissionInvite from './api/mission-invite.js';
|
|
8
9
|
import MissionLog from './api/mission-log.js';
|
|
9
|
-
import MissionLayer from './api/mission-layer.js';
|
|
10
|
+
import MissionLayer, { MissionLayerType } from './api/mission-layer.js';
|
|
10
11
|
import Credentials from './api/credentials.js';
|
|
11
12
|
import Security from './api/security.js';
|
|
12
13
|
import Contacts from './api/contacts.js';
|
|
@@ -31,6 +32,7 @@ export const CommandList = {
|
|
|
31
32
|
'mission-log': 'MissionLog',
|
|
32
33
|
'mission-layer': 'MissionLayer',
|
|
33
34
|
credential: 'Credentials',
|
|
35
|
+
certificate: 'Certificate',
|
|
34
36
|
iconsets: 'Iconsets',
|
|
35
37
|
contact: 'Contacts',
|
|
36
38
|
subscription: 'Subscription',
|
|
@@ -60,6 +62,7 @@ export default class TAKAPI {
|
|
|
60
62
|
MissionLayer;
|
|
61
63
|
Credentials;
|
|
62
64
|
Contacts;
|
|
65
|
+
Certificate;
|
|
63
66
|
Subscription;
|
|
64
67
|
Profile;
|
|
65
68
|
Injectors;
|
|
@@ -77,6 +80,7 @@ export default class TAKAPI {
|
|
|
77
80
|
this.Locate = new Locate(this);
|
|
78
81
|
this.Package = new Package(this);
|
|
79
82
|
this.Profile = new Profile(this);
|
|
83
|
+
this.Certificate = new Certificate(this);
|
|
80
84
|
this.OAuth = new OAuth(this);
|
|
81
85
|
this.Export = new Export(this);
|
|
82
86
|
this.Iconsets = new Iconsets(this);
|
|
@@ -163,4 +167,5 @@ export default class TAKAPI {
|
|
|
163
167
|
function isPlainObject(value) {
|
|
164
168
|
return value?.constructor === Object;
|
|
165
169
|
}
|
|
170
|
+
export { OAuth, Package, Certificate, Query, Locate, Mission, MissionInvite, MissionLog, MissionLayer, Credentials, Security, Contacts, Profile, Files, Iconsets, Injectors, Repeater, Group, Subscription, Video, Export, MissionSubscriberRole, MissionLayerType };
|
|
166
171
|
//# sourceMappingURL=api.js.map
|
package/dist/lib/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../lib/api.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,gBAAgB,CAAC;AACnC,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,MAAM,gBAAgB,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,OAAO,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../lib/api.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,gBAAgB,CAAC;AACnC,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,WAAW,MAAM,sBAAsB,CAAC;AAC/C,OAAO,KAAK,MAAM,gBAAgB,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,OAAO,EAAE,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,YAAY,EAAE,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,WAAW,MAAM,sBAAsB,CAAC;AAC/C,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,OAAO,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,MAAM,gBAAgB,CAAC;AACnC,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,SAAS,MAAM,oBA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IAAI,gBAAgB,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;YACzE,CAAC;YAED,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,kBAAkB,EAAE,CAAC;gBACzD,OAAO,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC5B,CAAC;iBAAM,CAAC;gBACJ,OAAO,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC5B,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,IAAI,KAAK,aAAa;gBAAE,MAAM,GAAG,CAAC;YAClE,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/E,CAAC;IACL,CAAC;CACJ;AAED,SAAS,aAAa,CAAC,KAAa;IAChC,OAAQ,KAAK,EAAE,WAAW,KAAK,MAAM,CAAC;AAC1C,CAAC;AAED,OAAO,EACH,KAAK,EACL,OAAO,EACP,WAAW,EACX,KAAK,EACL,MAAM,EACN,OAAO,EACP,aAAa,EACb,UAAU,EACV,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,KAAK,EACL,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,gBAAgB,EACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../cli.ts","../index.ts","../test/default.test.ts","../test/findCoT.test.ts","../lib/api.ts","../lib/auth.ts","../lib/commands.ts","../lib/fetch.ts","../lib/stream.ts","../lib/api/contacts.ts","../lib/api/credentials.ts","../lib/api/export.ts","../lib/api/files.ts","../lib/api/groups.ts","../lib/api/iconsets.ts","../lib/api/injectors.ts","../lib/api/locate.ts","../lib/api/mission-invite.ts","../lib/api/mission-layer.ts","../lib/api/mission-log.ts","../lib/api/mission.ts","../lib/api/oauth.ts","../lib/api/package.ts","../lib/api/profile.ts","../lib/api/query.ts","../lib/api/repeater.ts","../lib/api/security.ts","../lib/api/subscriptions.ts","../lib/api/types.ts","../lib/api/video.ts"],"version":"5.9.3"}
|
|
1
|
+
{"root":["../cli.ts","../index.ts","../test/default.test.ts","../test/findCoT.test.ts","../lib/api.ts","../lib/auth.ts","../lib/commands.ts","../lib/fetch.ts","../lib/stream.ts","../lib/api/certificate.ts","../lib/api/contacts.ts","../lib/api/credentials.ts","../lib/api/export.ts","../lib/api/files.ts","../lib/api/groups.ts","../lib/api/iconsets.ts","../lib/api/injectors.ts","../lib/api/locate.ts","../lib/api/mission-invite.ts","../lib/api/mission-layer.ts","../lib/api/mission-log.ts","../lib/api/mission.ts","../lib/api/oauth.ts","../lib/api/package.ts","../lib/api/profile.ts","../lib/api/query.ts","../lib/api/repeater.ts","../lib/api/security.ts","../lib/api/subscriptions.ts","../lib/api/types.ts","../lib/api/video.ts"],"version":"5.9.3"}
|
package/index.ts
CHANGED
|
@@ -43,8 +43,6 @@ export default class TAK extends EventEmitter {
|
|
|
43
43
|
version?: string;
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
* @constructor
|
|
47
|
-
*
|
|
48
46
|
* @param url - Full URL of Streaming COT Endpoint IE: "https://ops.cotak.gov:8089"
|
|
49
47
|
* @param auth - TAK Certificate Pair
|
|
50
48
|
* @param opts - Options Object
|
|
@@ -224,7 +222,7 @@ export default class TAK extends EventEmitter {
|
|
|
224
222
|
/**
|
|
225
223
|
* Write a CoT to the TAK Connection
|
|
226
224
|
*
|
|
227
|
-
* @param {CoT}
|
|
225
|
+
* @param {CoT} cots CoT Object
|
|
228
226
|
*/
|
|
229
227
|
async write(cots: CoT[]): Promise<void> {
|
|
230
228
|
for (const cot of cots) {
|
|
@@ -258,6 +256,8 @@ export default class TAK extends EventEmitter {
|
|
|
258
256
|
}
|
|
259
257
|
}
|
|
260
258
|
|
|
259
|
+
export * from './lib/api.js';
|
|
260
|
+
export { CommandOutputFormat } from './lib/commands.js';
|
|
261
261
|
export {
|
|
262
262
|
TAKAPI,
|
|
263
263
|
CoT,
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import Commands from '../commands.js';
|
|
2
|
+
import { Type } from '@sinclair/typebox';
|
|
3
|
+
import type { Static } from '@sinclair/typebox';
|
|
4
|
+
import { TAKItem, TAKList } from './types.js';
|
|
5
|
+
|
|
6
|
+
export const Certificate = Type.Object({
|
|
7
|
+
id: Type.Integer(),
|
|
8
|
+
creatorDn: Type.String(),
|
|
9
|
+
subjectDn: Type.String(),
|
|
10
|
+
userDn: Type.String(),
|
|
11
|
+
certificate: Type.String(),
|
|
12
|
+
hash: Type.String(),
|
|
13
|
+
clientUid: Type.String(),
|
|
14
|
+
issuanceDate: Type.String({ format: 'date-time' }),
|
|
15
|
+
expirationDate: Type.String({ format: 'date-time' }),
|
|
16
|
+
effectiveDate: Type.String({ format: 'date-time' }),
|
|
17
|
+
revocationDate: Type.Optional(Type.String({ format: 'date-time' })),
|
|
18
|
+
token: Type.String(),
|
|
19
|
+
serialNumber: Type.String()
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const TAKList_Certificate = TAKList(Certificate);
|
|
23
|
+
export const TAKItem_Certificate = TAKItem(Certificate);
|
|
24
|
+
|
|
25
|
+
export default class CertificateCommands extends Commands {
|
|
26
|
+
schema = {}
|
|
27
|
+
|
|
28
|
+
async cli(): Promise<object | string> {
|
|
29
|
+
throw new Error('Unsupported Subcommand');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* List Certificates
|
|
34
|
+
*
|
|
35
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/getAll_1 TAK Server Docs}.
|
|
36
|
+
*/
|
|
37
|
+
async list(
|
|
38
|
+
username?: string
|
|
39
|
+
): Promise<Static<typeof TAKList_Certificate>> {
|
|
40
|
+
const url = new URL('/Marti/api/certadmin/cert', this.api.url);
|
|
41
|
+
|
|
42
|
+
if (username) {
|
|
43
|
+
url.searchParams.append('username', username);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return await this.api.fetch(url) as Static<typeof TAKList_Certificate>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* List Revoked Certificates
|
|
51
|
+
*
|
|
52
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/getRevoked TAK Server Docs}.
|
|
53
|
+
*/
|
|
54
|
+
async listRevoked(): Promise<Static<typeof TAKList_Certificate>> {
|
|
55
|
+
const url = new URL('/Marti/api/certadmin/cert/revoked', this.api.url);
|
|
56
|
+
|
|
57
|
+
return await this.api.fetch(url) as Static<typeof TAKList_Certificate>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* List Replaced Certificates
|
|
62
|
+
*
|
|
63
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/getReplaced TAK Server Docs}.
|
|
64
|
+
*/
|
|
65
|
+
async listReplaced(): Promise<Static<typeof TAKList_Certificate>> {
|
|
66
|
+
const url = new URL('/Marti/api/certadmin/cert/replaced', this.api.url);
|
|
67
|
+
|
|
68
|
+
return await this.api.fetch(url) as Static<typeof TAKList_Certificate>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* List Expired Certificates
|
|
73
|
+
*
|
|
74
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/getExpired TAK Server Docs}.
|
|
75
|
+
*/
|
|
76
|
+
async listExpired(): Promise<Static<typeof TAKList_Certificate>> {
|
|
77
|
+
const url = new URL('/Marti/api/certadmin/cert/expired', this.api.url);
|
|
78
|
+
|
|
79
|
+
return await this.api.fetch(url) as Static<typeof TAKList_Certificate>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Get Single Certificate
|
|
84
|
+
*
|
|
85
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/getCertificate TAK Server Docs}.
|
|
86
|
+
*/
|
|
87
|
+
async get(
|
|
88
|
+
hash: string
|
|
89
|
+
): Promise<Static<typeof TAKItem_Certificate>> {
|
|
90
|
+
const url = new URL(`/Marti/api/certadmin/cert/${hash}`, this.api.url);
|
|
91
|
+
|
|
92
|
+
return await this.api.fetch(url) as Static<typeof TAKItem_Certificate>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Download Single Certificate
|
|
97
|
+
*
|
|
98
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/downloadCertificate TAK Server Docs}.
|
|
99
|
+
*/
|
|
100
|
+
async download(
|
|
101
|
+
hash: string
|
|
102
|
+
): Promise<string> {
|
|
103
|
+
const url = new URL(`/Marti/api/certadmin/cert/${hash}/download`, this.api.url);
|
|
104
|
+
|
|
105
|
+
return await this.api.fetch(url, {
|
|
106
|
+
method: 'GET',
|
|
107
|
+
}) as string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Revoke Single Certificate
|
|
112
|
+
*
|
|
113
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/revokeCertificate TAK Server Docs}.
|
|
114
|
+
*/
|
|
115
|
+
async revoke(
|
|
116
|
+
hash: string
|
|
117
|
+
): Promise<Static<typeof TAKItem_Certificate>> {
|
|
118
|
+
const url = new URL(`/Marti/api/certadmin/cert/${hash}`, this.api.url);
|
|
119
|
+
|
|
120
|
+
return await this.api.fetch(url, {
|
|
121
|
+
method: 'DELETE'
|
|
122
|
+
}) as Static<typeof TAKItem_Certificate>;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Revoke Certificates by Id
|
|
127
|
+
*
|
|
128
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/revokeCertificates TAK Server Docs}.
|
|
129
|
+
*/
|
|
130
|
+
async revokeIds(
|
|
131
|
+
ids: string[]
|
|
132
|
+
): Promise<Static<typeof TAKItem_Certificate>> {
|
|
133
|
+
if (ids.length === 0) {
|
|
134
|
+
throw new Error('At least one ID must be provided');
|
|
135
|
+
} else if (ids.length > 1) {
|
|
136
|
+
// TODO the api docs suggest this is possible but I haven't tested it yet
|
|
137
|
+
throw new Error('Only one ID can be currently revoked at a time');
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const url = new URL(`/Marti/api/certadmin/cert/revoke/${ids[0]}`, this.api.url);
|
|
141
|
+
|
|
142
|
+
return await this.api.fetch(url, {
|
|
143
|
+
method: 'DELETE'
|
|
144
|
+
}) as Static<typeof TAKItem_Certificate>;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Delete Certificates by Id
|
|
149
|
+
*
|
|
150
|
+
* {@link https://docs.tak.gov/api/takserver/redoc#tag/cert-manager-admin-api/operation/deleteCertificates TAK Server Docs}.
|
|
151
|
+
*/
|
|
152
|
+
async deleteIds(
|
|
153
|
+
ids: string[]
|
|
154
|
+
): Promise<Static<typeof TAKItem_Certificate>> {
|
|
155
|
+
if (ids.length === 0) {
|
|
156
|
+
throw new Error('At least one ID must be provided');
|
|
157
|
+
} else if (ids.length > 1) {
|
|
158
|
+
// TODO the api docs suggest this is possible but I haven't tested it yet
|
|
159
|
+
throw new Error('Only one ID can be currently deleted at a time');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const url = new URL(`/Marti/api/certadmin/cert/delete/${ids[0]}`, this.api.url);
|
|
163
|
+
|
|
164
|
+
return await this.api.fetch(url, {
|
|
165
|
+
method: 'DELETE'
|
|
166
|
+
}) as Static<typeof TAKItem_Certificate>;
|
|
167
|
+
}
|
|
168
|
+
}
|
package/lib/api.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import FormData from 'form-data';
|
|
2
2
|
import OAuth from './api/oauth.js';
|
|
3
3
|
import Package from './api/package.js';
|
|
4
|
+
import Certificate from './api/certificate.js';
|
|
4
5
|
import Query from './api/query.js';
|
|
5
6
|
import Locate from './api/locate.js';
|
|
6
|
-
import Mission from './api/mission.js';
|
|
7
|
+
import Mission, { MissionSubscriberRole } from './api/mission.js';
|
|
7
8
|
import MissionInvite from './api/mission-invite.js';
|
|
8
9
|
import MissionLog from './api/mission-log.js';
|
|
9
|
-
import MissionLayer from './api/mission-layer.js';
|
|
10
|
+
import MissionLayer, { MissionLayerType } from './api/mission-layer.js';
|
|
10
11
|
import Credentials from './api/credentials.js';
|
|
11
12
|
import Security from './api/security.js';
|
|
12
13
|
import Contacts from './api/contacts.js';
|
|
@@ -33,6 +34,7 @@ export const CommandList: Record<string, keyof TAKAPI> = {
|
|
|
33
34
|
'mission-log': 'MissionLog',
|
|
34
35
|
'mission-layer': 'MissionLayer',
|
|
35
36
|
credential: 'Credentials',
|
|
37
|
+
certificate: 'Certificate',
|
|
36
38
|
iconsets: 'Iconsets',
|
|
37
39
|
contact: 'Contacts',
|
|
38
40
|
subscription: 'Subscription',
|
|
@@ -63,6 +65,7 @@ export default class TAKAPI {
|
|
|
63
65
|
MissionLayer: MissionLayer;
|
|
64
66
|
Credentials: Credentials;
|
|
65
67
|
Contacts: Contacts;
|
|
68
|
+
Certificate: Certificate;
|
|
66
69
|
Subscription: Subscription;
|
|
67
70
|
Profile: Profile;
|
|
68
71
|
Injectors: Injectors;
|
|
@@ -82,6 +85,7 @@ export default class TAKAPI {
|
|
|
82
85
|
this.Locate = new Locate(this);
|
|
83
86
|
this.Package = new Package(this);
|
|
84
87
|
this.Profile = new Profile(this);
|
|
88
|
+
this.Certificate = new Certificate(this);
|
|
85
89
|
this.OAuth = new OAuth(this);
|
|
86
90
|
this.Export = new Export(this);
|
|
87
91
|
this.Iconsets = new Iconsets(this);
|
|
@@ -178,3 +182,29 @@ export default class TAKAPI {
|
|
|
178
182
|
function isPlainObject(value: object) {
|
|
179
183
|
return value?.constructor === Object;
|
|
180
184
|
}
|
|
185
|
+
|
|
186
|
+
export {
|
|
187
|
+
OAuth,
|
|
188
|
+
Package,
|
|
189
|
+
Certificate,
|
|
190
|
+
Query,
|
|
191
|
+
Locate,
|
|
192
|
+
Mission,
|
|
193
|
+
MissionInvite,
|
|
194
|
+
MissionLog,
|
|
195
|
+
MissionLayer,
|
|
196
|
+
Credentials,
|
|
197
|
+
Security,
|
|
198
|
+
Contacts,
|
|
199
|
+
Profile,
|
|
200
|
+
Files,
|
|
201
|
+
Iconsets,
|
|
202
|
+
Injectors,
|
|
203
|
+
Repeater,
|
|
204
|
+
Group,
|
|
205
|
+
Subscription,
|
|
206
|
+
Video,
|
|
207
|
+
Export,
|
|
208
|
+
MissionSubscriberRole,
|
|
209
|
+
MissionLayerType
|
|
210
|
+
};
|
package/package.json
CHANGED