vestauth 0.1.14 → 0.1.18
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 +11 -0
- package/LICENSE +28 -0
- package/package.json +19 -4
- package/src/cli/actions/challenge.js +10 -1
- package/src/cli/actions/hash.js +12 -1
- package/src/cli/actions/sign.js +10 -1
- package/src/cli/actions/verify.js +12 -2
- package/src/cli/vestauth.js +5 -1
- package/src/lib/helpers/errors.js +1 -1
- package/src/lib/helpers/truncate.js +10 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx-ops/compare/v0.1.0...main)
|
|
6
|
+
|
|
7
|
+
## [0.1.3](https://github.com/dotenvx/dotenvx-ops/compare/v0.1.0...v0.1.1) (2026-01-17)
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* TBD
|
package/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Scott Motte
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vestauth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "auth for agents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vestauth"
|
|
@@ -16,6 +16,16 @@
|
|
|
16
16
|
],
|
|
17
17
|
"license": "BSD-3-Clause",
|
|
18
18
|
"main": "src/lib/main.js",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"require": "./src/lib/main.js",
|
|
22
|
+
"default": "./src/lib/main.js"
|
|
23
|
+
},
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"bin": {
|
|
27
|
+
"vestauth": "./src/cli/vestauth.js"
|
|
28
|
+
},
|
|
19
29
|
"author": "@motdotla",
|
|
20
30
|
"type": "commonjs",
|
|
21
31
|
"scripts": {
|
|
@@ -23,8 +33,7 @@
|
|
|
23
33
|
"standard:fix": "standard --fix",
|
|
24
34
|
"test": "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
|
|
25
35
|
"test-coverage": "tap run --show-full-coverage --timeout=60000",
|
|
26
|
-
"
|
|
27
|
-
"prerelease": "npm test && npm run testshell",
|
|
36
|
+
"prerelease": "npm test",
|
|
28
37
|
"release": "standard-version"
|
|
29
38
|
},
|
|
30
39
|
"dependencies": {
|
|
@@ -34,7 +43,13 @@
|
|
|
34
43
|
"eciesjs": "^0.4.16"
|
|
35
44
|
},
|
|
36
45
|
"devDependencies": {
|
|
46
|
+
"@yao-pkg/pkg": "^5.14.2",
|
|
47
|
+
"capture-console": "^1.0.2",
|
|
48
|
+
"esbuild": "^0.25.8",
|
|
49
|
+
"proxyquire": "^2.1.3",
|
|
50
|
+
"sinon": "^14.0.1",
|
|
37
51
|
"standard": "^17.1.0",
|
|
38
|
-
"standard-version": "^9.5.0"
|
|
52
|
+
"standard-version": "^9.5.0",
|
|
53
|
+
"tap": "^21.0.1"
|
|
39
54
|
}
|
|
40
55
|
}
|
|
@@ -8,7 +8,16 @@ function challenge () {
|
|
|
8
8
|
|
|
9
9
|
const chal = main.challenge()
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const output = {
|
|
12
|
+
callenge: chal
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let space = 0
|
|
16
|
+
if (options.prettyPrint) {
|
|
17
|
+
space = 2
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
console.log(JSON.stringify(output, null, space))
|
|
12
21
|
}
|
|
13
22
|
|
|
14
23
|
module.exports = challenge
|
package/src/cli/actions/hash.js
CHANGED
|
@@ -3,13 +3,24 @@ const { logger } = require('./../../shared/logger')
|
|
|
3
3
|
const main = require('./../../lib/main')
|
|
4
4
|
|
|
5
5
|
function hash (message) {
|
|
6
|
+
logger.debug(`message: ${message}`)
|
|
7
|
+
|
|
6
8
|
const options = this.opts()
|
|
7
9
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
8
10
|
|
|
9
11
|
const hashMessage = main.hash(message)
|
|
10
12
|
const hashBase64Url = Buffer.from(hashMessage).toString('base64url')
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
const output = {
|
|
15
|
+
hash: hashBase64Url
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let space = 0
|
|
19
|
+
if (options.prettyPrint) {
|
|
20
|
+
space = 2
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
console.log(JSON.stringify(output, null, space))
|
|
13
24
|
}
|
|
14
25
|
|
|
15
26
|
module.exports = hash
|
package/src/cli/actions/sign.js
CHANGED
|
@@ -11,7 +11,16 @@ async function sign (challenge, privateKeyHex) {
|
|
|
11
11
|
|
|
12
12
|
const signature = await main.sign(challenge, privateKeyHex)
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const output = {
|
|
15
|
+
signature
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let space = 0
|
|
19
|
+
if (options.prettyPrint) {
|
|
20
|
+
space = 2
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
console.log(JSON.stringify(output, null, space))
|
|
15
24
|
}
|
|
16
25
|
|
|
17
26
|
module.exports = sign
|
|
@@ -10,9 +10,19 @@ async function verify (challenge, signatureBase64, publicKeyHex) {
|
|
|
10
10
|
const options = this.opts()
|
|
11
11
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const success = main.verify(challenge, signatureBase64, publicKeyHex)
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const output = {
|
|
16
|
+
success,
|
|
17
|
+
public_key: publicKeyHex
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let space = 0
|
|
21
|
+
if (options.prettyPrint) {
|
|
22
|
+
space = 2
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
console.log(JSON.stringify(output, null, space))
|
|
16
26
|
}
|
|
17
27
|
|
|
18
28
|
module.exports = verify
|
package/src/cli/vestauth.js
CHANGED
|
@@ -12,7 +12,7 @@ const getCommanderVersion = require('./../lib/helpers/getCommanderVersion')
|
|
|
12
12
|
// surface hoisting problems
|
|
13
13
|
const commanderVersion = getCommanderVersion()
|
|
14
14
|
if (commanderVersion && parseInt(commanderVersion.split('.')[0], 10) >= 12) {
|
|
15
|
-
const message = `
|
|
15
|
+
const message = `vestauth depends on commander@11.x.x but you are attempting to hoist commander@${commanderVersion}`
|
|
16
16
|
const error = new Errors({ message }).dangerousDependencyHoist()
|
|
17
17
|
logger.error(error.message)
|
|
18
18
|
if (error.help) logger.error(error.help)
|
|
@@ -42,6 +42,7 @@ program
|
|
|
42
42
|
const challengeAction = require('./actions/challenge')
|
|
43
43
|
program.command('challenge')
|
|
44
44
|
.description('generate challenge')
|
|
45
|
+
.option('-pp, --pretty-print', 'pretty print output')
|
|
45
46
|
.action(challengeAction)
|
|
46
47
|
|
|
47
48
|
// vestauth hash [message]
|
|
@@ -49,6 +50,7 @@ const hashAction = require('./actions/hash')
|
|
|
49
50
|
program.command('hash')
|
|
50
51
|
.description('hash message')
|
|
51
52
|
.argument('<message>', 'message string')
|
|
53
|
+
.option('-pp, --pretty-print', 'pretty print output')
|
|
52
54
|
.action(hashAction)
|
|
53
55
|
|
|
54
56
|
// vestauth keypair
|
|
@@ -65,6 +67,7 @@ program.command('sign')
|
|
|
65
67
|
.description('sign challenge')
|
|
66
68
|
.argument('<challenge>', 'challenge (base64url)')
|
|
67
69
|
.argument('<privateKey>', 'private key (hex)')
|
|
70
|
+
.option('-pp, --pretty-print', 'pretty print output')
|
|
68
71
|
.action(signAction)
|
|
69
72
|
|
|
70
73
|
// vestauth verify
|
|
@@ -74,6 +77,7 @@ program.command('verify')
|
|
|
74
77
|
.argument('<challenge>', 'challenge (base64url)')
|
|
75
78
|
.argument('<signature>', 'signature (base64url)')
|
|
76
79
|
.argument('<publicKey>', 'public key (hex)')
|
|
80
|
+
.option('-pp, --pretty-print', 'pretty print output')
|
|
77
81
|
.action(verifyAction)
|
|
78
82
|
|
|
79
83
|
// vestauth help
|
|
@@ -5,7 +5,7 @@ class Errors {
|
|
|
5
5
|
|
|
6
6
|
dangerousDependencyHoist () {
|
|
7
7
|
const code = 'DANGEROUS_DEPENDENCY_HOIST'
|
|
8
|
-
const message = `[${code}] your environment has hoisted an incompatible version of a
|
|
8
|
+
const message = `[${code}] your environment has hoisted an incompatible version of a vestauth dependency: ${this.message}`
|
|
9
9
|
const help = `[${code}] https://github.com/vestauth/vestauth`
|
|
10
10
|
|
|
11
11
|
const e = new Error(message)
|