@nextera.one/softid-cli 1.0.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/README.md +34 -0
- package/dist/commands/claim.js +34 -0
- package/dist/commands/verify.js +34 -0
- package/dist/index.js +17 -0
- package/package.json +27 -0
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# SoftID CLI
|
|
2
|
+
|
|
3
|
+
Command-line tools for generating and verifying [SoftID](https://softid.org) claims.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @nextera.one/softid-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Claim an Identity
|
|
14
|
+
|
|
15
|
+
Generate the required DNS TXT record:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
softid claim MYAPP --domain myapp.com
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Output:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
NAME _softid.myapp.com
|
|
25
|
+
VALUE v=softid1; sid=MYAPP; nonce=...
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Verify an Identity
|
|
29
|
+
|
|
30
|
+
Check if a domain validly claims an SID:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
softid verify MYAPP --domain myapp.com
|
|
34
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.claimCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const softid_sdk_1 = require("@nextera.one/softid-sdk");
|
|
10
|
+
exports.claimCommand = new commander_1.Command('claim')
|
|
11
|
+
.description('Generate the DNS TXT record for claiming a SoftID')
|
|
12
|
+
.argument('<SID>', 'The Software Identifier (e.g., MYAPP, VUE)')
|
|
13
|
+
.option('-d, --domain <domain>', 'The canonical domain (optional, for reference)')
|
|
14
|
+
.option('-n, --nonce <nonce>', 'Custom nonce (optional)')
|
|
15
|
+
.action((sid, options) => {
|
|
16
|
+
try {
|
|
17
|
+
console.log(chalk_1.default.bold(`\nSoftID Claim Generation: ${chalk_1.default.green(sid.toUpperCase())}\n`));
|
|
18
|
+
const record = (0, softid_sdk_1.generateClaimRecord)({
|
|
19
|
+
sid: sid.toUpperCase(),
|
|
20
|
+
nonce: options.nonce
|
|
21
|
+
});
|
|
22
|
+
console.log(`To claim ownership, add this ${chalk_1.default.yellow('TXT record')} to your DNS:`);
|
|
23
|
+
const domainHint = options.domain ? `_softid.${options.domain}` : '_softid.<your-domain>';
|
|
24
|
+
console.log('\n' + chalk_1.default.bgBlack.white(' NAME ') + ' ' + chalk_1.default.cyan(domainHint));
|
|
25
|
+
console.log(chalk_1.default.bgBlack.white(' VALUE ') + ' ' + chalk_1.default.green(record));
|
|
26
|
+
console.log('\n' + chalk_1.default.dim('After propagation, run:'));
|
|
27
|
+
console.log(chalk_1.default.dim(`softid verify ${sid} --domain ${options.domain || '<your-domain>'}`));
|
|
28
|
+
console.log('');
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
console.error(chalk_1.default.red(`Error: ${err.message}`));
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.verifyCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const softid_sdk_1 = require("@nextera.one/softid-sdk");
|
|
10
|
+
exports.verifyCommand = new commander_1.Command('verify')
|
|
11
|
+
.description('Verify a SoftID claim against a domain')
|
|
12
|
+
.argument('<SID>', 'The Software Identifier to verify')
|
|
13
|
+
.requiredOption('-d, --domain <domain>', 'The domain to check against')
|
|
14
|
+
.action(async (sid, options) => {
|
|
15
|
+
console.log(chalk_1.default.dim(`Verifying ${sid} on ${options.domain}...`));
|
|
16
|
+
try {
|
|
17
|
+
const result = await (0, softid_sdk_1.verifyOwnership)(sid.toUpperCase(), options.domain);
|
|
18
|
+
if (result.verified) {
|
|
19
|
+
console.log(chalk_1.default.green('\n✅ VERIFIED OWNER'));
|
|
20
|
+
console.log(`SID: ${chalk_1.default.bold(result.sid)}`);
|
|
21
|
+
console.log(`Domain: ${chalk_1.default.cyan(result.domain)}`);
|
|
22
|
+
console.log(`Nonce: ${chalk_1.default.dim(result.nonce)}`);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
console.log(chalk_1.default.red('\n❌ VERIFICATION FAILED'));
|
|
26
|
+
console.log(`Reason: ${result.error || 'Unknown error'}`);
|
|
27
|
+
}
|
|
28
|
+
console.log('');
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
console.error(chalk_1.default.red(`Error: ${err.message}`));
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
});
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const claim_1 = require("./commands/claim");
|
|
6
|
+
const verify_1 = require("./commands/verify");
|
|
7
|
+
const program = new commander_1.Command();
|
|
8
|
+
program
|
|
9
|
+
.name('softid')
|
|
10
|
+
.description('SoftID CLI - Software Identity Tools')
|
|
11
|
+
.version('1.0.0');
|
|
12
|
+
program.addCommand(claim_1.claimCommand);
|
|
13
|
+
program.addCommand(verify_1.verifyCommand);
|
|
14
|
+
program.parse(process.argv);
|
|
15
|
+
if (!process.argv.slice(2).length) {
|
|
16
|
+
program.outputHelp();
|
|
17
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nextera.one/softid-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SoftID CLI - DNS-based Software Identity Tools",
|
|
5
|
+
"bin": {
|
|
6
|
+
"softid": "dist/index.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"start": "node dist/index.js",
|
|
11
|
+
"test": "npm run build && node --test",
|
|
12
|
+
"prepare": "npm run build"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"chalk": "^4.1.2",
|
|
20
|
+
"commander": "^14.0.2",
|
|
21
|
+
"@nextera.one/softid-sdk": "^1.0.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^20.10.0",
|
|
25
|
+
"typescript": "^5.3.3"
|
|
26
|
+
}
|
|
27
|
+
}
|