@tak-ps/node-tak 11.4.0 → 11.5.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
CHANGED
|
@@ -2,7 +2,7 @@ import { APIAuthPassword } from '../auth.js';
|
|
|
2
2
|
import { Type } from '@sinclair/typebox';
|
|
3
3
|
import Commands, { CommandOutputFormat } from '../commands.js';
|
|
4
4
|
import pem from 'pem';
|
|
5
|
-
import
|
|
5
|
+
import xmljs from 'xml-js';
|
|
6
6
|
export const CertificateResponse = Type.Object({
|
|
7
7
|
ca: Type.Array(Type.String()),
|
|
8
8
|
cert: Type.String(),
|
|
@@ -34,15 +34,16 @@ export default class CredentialCommands extends Commands {
|
|
|
34
34
|
async generate() {
|
|
35
35
|
if (!(this.api.auth instanceof APIAuthPassword))
|
|
36
36
|
throw new Error('Must use Password Auth');
|
|
37
|
-
const config =
|
|
37
|
+
const config = xmljs.xml2js(await this.config(), { compact: true });
|
|
38
38
|
let organization = null;
|
|
39
39
|
let organizationUnit = null;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
const nameEntries = config['ns2:certificateConfig'].nameEntries;
|
|
41
|
+
if (nameEntries && nameEntries.nameEntry) {
|
|
42
|
+
for (const ne of nameEntries.nameEntry) {
|
|
43
|
+
if (ne._attributes && ne._attributes.name === 'O')
|
|
44
|
+
organization = ne._attributes.value;
|
|
45
|
+
if (ne._attributes && ne._attributes.name === 'OU')
|
|
46
|
+
organizationUnit = ne._attributes.value;
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
const createCSR = pem.promisified.createCSR;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../../lib/api/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAAU,IAAI,E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AI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ;SACrC,CAAC,CAAC;QAEH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,8BAA8B,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAClE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC;QACxE,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAExC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE;YAClC,MAAM,EAAE,MAAM;YACd,SAAS,EAAE,IAAI;YACf,OAAO,EAAE;gBACL,MAAM,EAAE,kBAAkB;gBAC1B,aAAa,EAAE,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;aACxF;YACD,IAAI,EAAE,IAAI,CAAC,GAAG;SACjB,CAAC,CAAC;QAEH,IAAI,IAAI,GAAG,+BAA+B,GAAG,GAAG,CAAC,UAAU,CAAC;QAC5D,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;QACvD,IAAI,GAAG,IAAI,GAAG,2BAA2B,CAAC;QAE1C,OAAO;YACH,EAAE,EAAE,CAAE,GAAG,CAAC,GAAG,CAAE;YACf,IAAI;YACJ,GAAG,EAAE,IAAI,CAAC,SAAS;SACtB,CAAA;IACL,CAAC;CACJ"}
|
package/lib/api/credentials.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { ParsedArgs } from 'minimist'
|
|
|
3
3
|
import { Static, Type } from '@sinclair/typebox';
|
|
4
4
|
import Commands, { CommandOutputFormat } from '../commands.js';
|
|
5
5
|
import pem from 'pem';
|
|
6
|
-
import
|
|
6
|
+
import xmljs from 'xml-js';
|
|
7
7
|
|
|
8
8
|
export const CertificateResponse = Type.Object({
|
|
9
9
|
ca: Type.Array(Type.String()),
|
|
@@ -39,14 +39,15 @@ export default class CredentialCommands extends Commands {
|
|
|
39
39
|
async generate(): Promise<Static<typeof CertificateResponse>> {
|
|
40
40
|
if (!(this.api.auth instanceof APIAuthPassword)) throw new Error('Must use Password Auth');
|
|
41
41
|
|
|
42
|
-
const config =
|
|
42
|
+
const config: any = xmljs.xml2js(await this.config(), { compact: true });
|
|
43
43
|
|
|
44
44
|
let organization = null;
|
|
45
45
|
let organizationUnit = null;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (ne
|
|
46
|
+
const nameEntries = config['ns2:certificateConfig'].nameEntries;
|
|
47
|
+
if (nameEntries && nameEntries.nameEntry) {
|
|
48
|
+
for (const ne of nameEntries.nameEntry) {
|
|
49
|
+
if (ne._attributes && ne._attributes.name === 'O') organization = ne._attributes.value;
|
|
50
|
+
if (ne._attributes && ne._attributes.name === 'OU') organizationUnit = ne._attributes.value;
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tak-ps/node-tak",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "11.
|
|
4
|
+
"version": "11.5.0",
|
|
5
5
|
"description": "Lightweight JavaScript library for communicating with TAK Server",
|
|
6
6
|
"author": "Nick Ingalls <nick@ingalls.ca>",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -36,8 +36,7 @@
|
|
|
36
36
|
"p12-pem": "^1.0.5",
|
|
37
37
|
"pem": "^1.14.8",
|
|
38
38
|
"undici": "^7.8.0",
|
|
39
|
-
"xml-js": "^1.6.11"
|
|
40
|
-
"xml2js": "^0.6.2"
|
|
39
|
+
"xml-js": "^1.6.11"
|
|
41
40
|
},
|
|
42
41
|
"peerDependencies": {
|
|
43
42
|
"@tak-ps/node-cot": "^14.7.1"
|
|
@@ -48,7 +47,6 @@
|
|
|
48
47
|
"@types/node": "^24.0.0",
|
|
49
48
|
"@types/pem": "^1.14.4",
|
|
50
49
|
"@types/tape": "^5.6.0",
|
|
51
|
-
"@types/xml2js": "^0.4.14",
|
|
52
50
|
"c8": "^10.1.3",
|
|
53
51
|
"eslint": "^9.0.0",
|
|
54
52
|
"minimist": "^1.2.8",
|