vestauth 0.13.0 β 0.14.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 -1
- package/README.md +41 -41
- package/package.json +1 -1
- package/src/cli/actions/provider/verify.js +2 -2
- package/src/cli/actions/tool/verify.js +34 -0
- package/src/cli/commands/primitives.js +1 -1
- package/src/cli/commands/provider.js +1 -1
- package/src/cli/commands/tool.js +21 -0
- package/src/cli/vestauth.js +2 -1
- package/src/lib/helpers/{providerVerify.js β toolVerify.js} +2 -2
- package/src/lib/helpers/verifyAgentFqdn.js +6 -6
- package/src/lib/main.js +6 -3
- package/src/lib/tool.js +5 -0
- package/src/lib/provider.js +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
|
|
3
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
4
|
|
|
5
|
-
[Unreleased](https://github.com/vestauth/vestauth/compare/v0.
|
|
5
|
+
[Unreleased](https://github.com/vestauth/vestauth/compare/v0.14.0...main)
|
|
6
|
+
|
|
7
|
+
## [0.14.0](https://github.com/vestauth/vestauth/compare/v0.13.0...v0.14.0) (2026-02-18)
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* Renamed instances of `provider` with `tool` ([#22](https://github.com/vestauth/vestauth/pull/22))
|
|
12
|
+
* `provider` still backwards compatible
|
|
6
13
|
|
|
7
14
|
## [0.13.0](https://github.com/vestauth/vestauth/compare/v0.12.1...v0.13.0) (2026-02-18)
|
|
8
15
|
|
package/README.md
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
> [1 minute demo πΊ](https://www.youtube.com/watch?v=cHARyULr_qk)
|
|
6
6
|
>
|
|
7
|
-
> Vestauth gives agents a cryptographic identity and a simple way to authenticate HTTP requests. Most agent systems rely on API keys, bearer tokens, or username/passwords. These approaches are difficult to rotate, easy to leak, and hard to attribute to a specific agent. Vestauth replaces shared secrets with public/private key cryptography. Agents sign requests using a private key, and
|
|
7
|
+
> Vestauth gives agents a cryptographic identity and a simple way to authenticate HTTP requests. Most agent systems rely on API keys, bearer tokens, or username/passwords. These approaches are difficult to rotate, easy to leak, and hard to attribute to a specific agent. Vestauth replaces shared secrets with public/private key cryptography. Agents sign requests using a private key, and tools verify those requests using the agent's public key. It's elegant and the future. [[1](#compare)]
|
|
8
8
|
>
|
|
9
9
|
> *Scott Motteβcreator of `dotenv` and `dotenvx`*
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
### Quickstart [](https://www.npmjs.com/package/vestauth) [](https://www.npmjs.com/package/vestauth) [](https://www.npmjs.com/package/vestauth) [](https://datatracker.ietf.org/doc/rfc9421/) [](https://datatracker.ietf.org/doc/html/draft-meunier-web-bot-auth-architecture)
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
16
|
npm i -g vestauth
|
|
@@ -102,7 +102,7 @@ AGENT_UID="agent-4b94ccd425e939fac5016b6b"
|
|
|
102
102
|
|
|
103
103
|
| Variable | Role | Usage |
|
|
104
104
|
|----------|------------|------------|
|
|
105
|
-
| `AGENT_PUBLIC_JWK` | Verification | Published for
|
|
105
|
+
| `AGENT_PUBLIC_JWK` | Verification | Published for tool signature validation |
|
|
106
106
|
| `AGENT_PRIVATE_JWK` | Signing | Used locally to sign HTTP requests |
|
|
107
107
|
| `AGENT_UID` | Identity | Builds discovery FQDN and identifies the agent |
|
|
108
108
|
|
|
@@ -117,13 +117,13 @@ $ vestauth primitives headers GET https://api.vestauth.com/whoami --pp
|
|
|
117
117
|
}
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
Vestauth turns `curl` into a powerful primitive for
|
|
120
|
+
Vestauth turns `curl` into a powerful primitive for tool-side agent identity, verification, and authentication. See the next section.
|
|
121
121
|
|
|
122
122
|
</details>
|
|
123
123
|
|
|
124
124
|
|
|
125
125
|
|
|
126
|
-
##
|
|
126
|
+
## Tool: Verification
|
|
127
127
|
|
|
128
128
|
> Verify requests and safely trust agent identity using cryptographic proof.
|
|
129
129
|
|
|
@@ -140,10 +140,10 @@ app.get('/whoami', async (req, res) => {
|
|
|
140
140
|
|
|
141
141
|
// --------------------------------------------------------------------------------
|
|
142
142
|
// πͺͺ Reveal the agent's cryptographic identity. //
|
|
143
|
-
// The `
|
|
144
|
-
// authenticated
|
|
143
|
+
// The `tool.verify` method turns your endpoint into a cryptographically //
|
|
144
|
+
// authenticated tool β verifying signatures, keys, and returning the agent. //
|
|
145
145
|
// --------------------------------------------------------------------------------
|
|
146
|
-
const agent = await vestauth.
|
|
146
|
+
const agent = await vestauth.tool.verify(req.method, url, req.headers)
|
|
147
147
|
|
|
148
148
|
res.json(agent)
|
|
149
149
|
} catch (err) {
|
|
@@ -168,7 +168,7 @@ $ vestauth agent curl http://localhost:3000/whoami
|
|
|
168
168
|
<details><summary>learn more</summary><br>
|
|
169
169
|
|
|
170
170
|
```sh
|
|
171
|
-
Agent β Signs Request β
|
|
171
|
+
Agent β Signs Request β Tool β Discovers Keys β Verifies Signature β Trusted Agent
|
|
172
172
|
```
|
|
173
173
|
|
|
174
174
|
Vestauth verifies requests using public key discovery and HTTP Message Signature validation.
|
|
@@ -181,7 +181,7 @@ When a signed request is received, Vestauth:
|
|
|
181
181
|
4. Verifies the request signature using RFC 9421.
|
|
182
182
|
5. Validates timestamps and nonce protections to prevent replay attacks.
|
|
183
183
|
|
|
184
|
-
If verification succeeds, the
|
|
184
|
+
If verification succeeds, the tool can safely trust the agent's cryptographic identity.
|
|
185
185
|
|
|
186
186
|
Vestauth intentionally separates identity discovery from verification to support key rotation and distributed agent infrastructure.
|
|
187
187
|
|
|
@@ -303,12 +303,12 @@ $ vestauth agent rotate
|
|
|
303
303
|
```
|
|
304
304
|
|
|
305
305
|
</details>
|
|
306
|
-
<details><summary>`
|
|
306
|
+
<details><summary>`tool verify`</summary><br>
|
|
307
307
|
|
|
308
308
|
Verify agent.
|
|
309
309
|
|
|
310
310
|
```sh
|
|
311
|
-
$ vestauth
|
|
311
|
+
$ vestauth tool verify GET https://api.vestauth.com/whoami --signature "sig1=:H1kxwSRWFbIzKbHaUy4hQFp/JrmVTX//72JPHcW4W7cPt9q6LytRJgx5pUgWrrr7DCcMWgx/jpTPc8Ht8SZ3CQ==:" --signature-input "sig1=(\"@authority\");created=1770396709;keyid=\"FGzgs758DBGnI1S0BejChDsK0IKZm3qPpOOXdRnnBkM\";alg=\"ed25519\";expires=1770397009;nonce=\"BZSDVktdkjO6XH5jafAdPDttsB6eytXO7u8KXJN1tMtd5bprE3rp08HiaTRo7H6gZGtYb4_qtL7RiGi8P2Gq7w\";tag=\"web-bot-auth\"" --signature-agent "sig1=agent-609a4fd2ebf4e6347108c517.api.vestauth.com"
|
|
312
312
|
{"uid":"agent-609a4fd2ebf4e6347108c517",...}
|
|
313
313
|
```
|
|
314
314
|
|
|
@@ -367,21 +367,21 @@ $ vestauth primitives verify GET https://api.vestauth.com/whoami --signature "si
|
|
|
367
367
|
|
|
368
368
|
Use vestauth directly in code.
|
|
369
369
|
|
|
370
|
-
<details><summary>`
|
|
370
|
+
<details><summary>`tool.verify()`</summary><br>
|
|
371
371
|
|
|
372
372
|
Verify and authenticate an agent's cryptographic identity.
|
|
373
373
|
|
|
374
374
|
```js
|
|
375
|
-
const agent = await vestauth.
|
|
375
|
+
const agent = await vestauth.tool.verify(req.method, url, req.headers)
|
|
376
376
|
```
|
|
377
377
|
|
|
378
378
|
</details>
|
|
379
379
|
|
|
380
380
|
|
|
381
381
|
|
|
382
|
-
## Available
|
|
382
|
+
## Available Tools
|
|
383
383
|
|
|
384
|
-
> Vestauth is pioneering the auth layer for agents. Get in early on this distribution train. [Become a vestauth
|
|
384
|
+
> Vestauth is pioneering the auth layer for agents. Get in early on this distribution train. [Become a vestauth tool](mailto:mot@dotenvx.com)
|
|
385
385
|
|
|
386
386
|
* AS2 (Agentic Secret Storage) - https://as2.dotenvx.com
|
|
387
387
|
|
|
@@ -389,7 +389,7 @@ const agent = await vestauth.provider.verify(req.method, url, req.headers)
|
|
|
389
389
|
|
|
390
390
|
## Compare
|
|
391
391
|
|
|
392
|
-
**Agent +
|
|
392
|
+
**Agent + Tool Matrix** β Compare Vestauth vs existing auth.
|
|
393
393
|
|
|
394
394
|
| Capability | Vestauth | API Keys | OAuth | Cookies |
|
|
395
395
|
|---|---|---|---|---|
|
|
@@ -398,11 +398,11 @@ const agent = await vestauth.provider.verify(req.method, url, req.headers)
|
|
|
398
398
|
| **Agent: no shared secret** | β
| β | β οΈ (bearer tokens) | β |
|
|
399
399
|
| **Agent: perβrequest identity proof** | β
| β | β οΈ (tokenβbased) | β |
|
|
400
400
|
| **Agent: easy key/token rotation** | β
| β οΈ | β οΈ | β οΈ |
|
|
401
|
-
| **
|
|
402
|
-
| **
|
|
403
|
-
| **
|
|
404
|
-
| **
|
|
405
|
-
| **
|
|
401
|
+
| **Tool: no secret storage** | β
(public keys only) | β | β | β |
|
|
402
|
+
| **Tool: strong attribution to agent** | β
| β οΈ | β οΈ | β |
|
|
403
|
+
| **Tool: stateless verification** | β
| β
| β
| β |
|
|
404
|
+
| **Tool: simple to implement** | β οΈ (sig verification) | β
| β | β
|
|
|
405
|
+
| **Tool: revocation control** | β
| β οΈ | β
| β οΈ |
|
|
406
406
|
|
|
407
407
|
Legend: β
strong fit, β οΈ partial/conditional, β poor fit
|
|
408
408
|
|
|
@@ -410,7 +410,7 @@ Legend: β
strong fit, β οΈ partial/conditional, β poor fit
|
|
|
410
410
|
|
|
411
411
|
1. An agent generates a public/private keypair.
|
|
412
412
|
2. The agent signs each HTTP request with its private key.
|
|
413
|
-
3. The
|
|
413
|
+
3. The tool verifies the signature using the agentβs public key.
|
|
414
414
|
4. Requests are attributable, auditable, and do not require shared secrets or browser sessions.
|
|
415
415
|
|
|
416
416
|
|
|
@@ -424,7 +424,7 @@ Vestauth builds on open internet standards for agent authentication.
|
|
|
424
424
|
| **[RFC 9421 β HTTP Message Signatures](https://datatracker.ietf.org/doc/rfc9421/)** | Defines how requests are cryptographically signed and verified |
|
|
425
425
|
| **[Web-Bot-Auth Draft](https://datatracker.ietf.org/doc/html/draft-meunier-web-bot-auth-architecture)** | Defines headers and authentication architecture for autonomous agents |
|
|
426
426
|
|
|
427
|
-
Vestauth follows these specifications to ensure interoperability between agents and
|
|
427
|
+
Vestauth follows these specifications to ensure interoperability between agents and tools while avoiding vendor lock-in. Vestauth focuses on developer ergonomics while staying compliant with these emerging standards.
|
|
428
428
|
|
|
429
429
|
|
|
430
430
|
|
|
@@ -443,7 +443,7 @@ Vestauth follows these specifications to ensure interoperability between agents
|
|
|
443
443
|
>
|
|
444
444
|
> Most agent systems rely on API keys, bearer tokens, or username/passwords. These approaches are difficult to rotate, easy to leak, and hard to attribute to a specific agent.
|
|
445
445
|
>
|
|
446
|
-
> Vestauth replaces shared secrets with public/private key cryptography. Agents sign requests using a private key, and
|
|
446
|
+
> Vestauth replaces shared secrets with public/private key cryptography. Agents sign requests using a private key, and tools verify those requests using the agent's public key.
|
|
447
447
|
|
|
448
448
|
|
|
449
449
|
|
|
@@ -453,7 +453,7 @@ Vestauth follows these specifications to ensure interoperability between agents
|
|
|
453
453
|
|
|
454
454
|
> API keys are shared secrets. Anyone who obtains the key can impersonate the client, and keys are difficult to rotate safely.
|
|
455
455
|
>
|
|
456
|
-
> Vestauth uses cryptographic signing instead of shared secrets. This allows
|
|
456
|
+
> Vestauth uses cryptographic signing instead of shared secrets. This allows tools to verify identity without storing or distributing sensitive credentials.
|
|
457
457
|
|
|
458
458
|
|
|
459
459
|
|
|
@@ -464,7 +464,7 @@ Vestauth follows these specifications to ensure interoperability between agents
|
|
|
464
464
|
> Agent keys are generated locally and stored in the agent's environment configuration (`.env`).
|
|
465
465
|
>
|
|
466
466
|
> * `AGENT_PRIVATE_JWK` is used to sign requests and must never be shared.
|
|
467
|
-
> * `AGENT_PUBLIC_JWK` is safe to publish and is used by
|
|
467
|
+
> * `AGENT_PUBLIC_JWK` is safe to publish and is used by tools for verification.
|
|
468
468
|
|
|
469
469
|
|
|
470
470
|
|
|
@@ -500,7 +500,7 @@ Vestauth follows these specifications to ensure interoperability between agents
|
|
|
500
500
|
|
|
501
501
|
> No.
|
|
502
502
|
>
|
|
503
|
-
> Vestauth is primarily a client-side and verification library. Agents generate keys locally and sign requests directly.
|
|
503
|
+
> Vestauth is primarily a client-side and verification library. Agents generate keys locally and sign requests directly. Tools verify requests using public keys exposed via .well-known discovery endpoints.
|
|
504
504
|
>
|
|
505
505
|
> There is no central authentication server required.
|
|
506
506
|
|
|
@@ -529,9 +529,9 @@ Vestauth follows these specifications to ensure interoperability between agents
|
|
|
529
529
|
> * Signature-Input
|
|
530
530
|
> * Signature-Agent
|
|
531
531
|
>
|
|
532
|
-
>
|
|
532
|
+
> Tools verify the request by retrieving the agent's public key from a discovery endpoint and verifying the signature cryptographically.
|
|
533
533
|
>
|
|
534
|
-
> If the signature is valid, the
|
|
534
|
+
> If the signature is valid, the tool knows the request was created by the agent that owns that private key.
|
|
535
535
|
|
|
536
536
|
|
|
537
537
|
|
|
@@ -547,7 +547,7 @@ Vestauth follows these specifications to ensure interoperability between agents
|
|
|
547
547
|
> * expires timestamp - defines a short validity window
|
|
548
548
|
> * nonce value - ensures each request is unique
|
|
549
549
|
>
|
|
550
|
-
>
|
|
550
|
+
> Tools verify that:
|
|
551
551
|
>
|
|
552
552
|
> 1. The signature is still within the allowed time window
|
|
553
553
|
> 2. The nonce has not been used before
|
|
@@ -555,7 +555,7 @@ Vestauth follows these specifications to ensure interoperability between agents
|
|
|
555
555
|
>
|
|
556
556
|
> Because signatures are short-lived and tied to unique nonce values, an intercepted request cannot be reused successfully.
|
|
557
557
|
>
|
|
558
|
-
>
|
|
558
|
+
> Tools may optionally store nonce values for additional replay protection.
|
|
559
559
|
|
|
560
560
|
|
|
561
561
|
|
|
@@ -563,7 +563,7 @@ Vestauth follows these specifications to ensure interoperability between agents
|
|
|
563
563
|
|
|
564
564
|
<details><summary>Why does Vestauth use public key discovery?</summary><br>
|
|
565
565
|
|
|
566
|
-
> Public key discovery allows
|
|
566
|
+
> Public key discovery allows tools to verify agent signatures without manual key exchange. Each agent hosts its public keys in a standardized .well-known directory.
|
|
567
567
|
>
|
|
568
568
|
> This enables dynamic agent onboarding while preserving cryptographic verification.
|
|
569
569
|
|
|
@@ -591,16 +591,16 @@ Vestauth follows these specifications to ensure interoperability between agents
|
|
|
591
591
|
> *.api.vestauth.com
|
|
592
592
|
> ```
|
|
593
593
|
>
|
|
594
|
-
> When a
|
|
594
|
+
> When a tool verifies a request, Vestauth converts the agent identity into a fixed .well-known endpoint within this trusted domain. Because this domain is controlled by Vestauth, tools never fetch attacker-supplied URLs or internal network addresses.
|
|
595
595
|
>
|
|
596
596
|
> This removes the most common SSRF attack vector during signature verification.
|
|
597
597
|
>
|
|
598
598
|
> **Custom trusted discovery domains**
|
|
599
599
|
>
|
|
600
|
-
>
|
|
600
|
+
> Tools can optionally configure additional trusted discovery domains using:
|
|
601
601
|
>
|
|
602
602
|
> ```ini
|
|
603
|
-
>
|
|
603
|
+
> TOOL_FQDN_REGEX
|
|
604
604
|
> ```
|
|
605
605
|
>
|
|
606
606
|
> This allows organizations to:
|
|
@@ -612,14 +612,14 @@ Vestauth follows these specifications to ensure interoperability between agents
|
|
|
612
612
|
> For example:
|
|
613
613
|
>
|
|
614
614
|
> ```ini
|
|
615
|
-
>
|
|
615
|
+
> TOOL_FQDN_REGEX=".*\.agents\.vestauth\.com|.*\.agents\.example\.internal"
|
|
616
616
|
> ```
|
|
617
617
|
>
|
|
618
618
|
> Only discovery endpoints matching this allowlist will be fetched.
|
|
619
619
|
>
|
|
620
620
|
> **Defense in depth**
|
|
621
621
|
>
|
|
622
|
-
> Even with domain scoping,
|
|
622
|
+
> Even with domain scoping, tools may optionally add safeguards such as:
|
|
623
623
|
>
|
|
624
624
|
> * HTTPS-only enforcement
|
|
625
625
|
> * Request timeouts
|
|
@@ -636,17 +636,17 @@ Vestauth follows these specifications to ensure interoperability between agents
|
|
|
636
636
|
|
|
637
637
|
> Vestauth uses .well-known discovery to keep requests small, enable key rotation, and support long-term identity management.
|
|
638
638
|
>
|
|
639
|
-
> Embedding public keys directly in every request would increase header size, reduce caching opportunities, and make key rotation difficult. By publishing keys through a discovery endpoint, Vestauth allows
|
|
639
|
+
> Embedding public keys directly in every request would increase header size, reduce caching opportunities, and make key rotation difficult. By publishing keys through a discovery endpoint, Vestauth allows tools to fetch and cache keys independently from individual requests.
|
|
640
640
|
>
|
|
641
641
|
> This approach provides several benefits:
|
|
642
642
|
>
|
|
643
643
|
> **Efficient requests**
|
|
644
644
|
>
|
|
645
|
-
> Public keys are retrieved once and can be cached by
|
|
645
|
+
> Public keys are retrieved once and can be cached by tools. Agents do not need to send large key material with every request.
|
|
646
646
|
>
|
|
647
647
|
> **Key rotation support**
|
|
648
648
|
>
|
|
649
|
-
> Agents can rotate signing keys without changing their identity.
|
|
649
|
+
> Agents can rotate signing keys without changing their identity. Tools simply refresh keys from the discovery endpoint.
|
|
650
650
|
>
|
|
651
651
|
> **Multi-key support**
|
|
652
652
|
>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { logger } = require('./../../../shared/logger')
|
|
2
2
|
const catchAndLog = require('./../../../lib/helpers/catchAndLog')
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const tool = require('./../../../lib/tool')
|
|
5
5
|
|
|
6
6
|
async function verify (httpMethod, uri) {
|
|
7
7
|
try {
|
|
@@ -17,7 +17,7 @@ async function verify (httpMethod, uri) {
|
|
|
17
17
|
'Signature-Agent': options.signatureAgent
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const output = await
|
|
20
|
+
const output = await tool.verify(httpMethod, uri, headers)
|
|
21
21
|
|
|
22
22
|
let space = 0
|
|
23
23
|
if (options.prettyPrint) {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const { logger } = require('./../../../shared/logger')
|
|
2
|
+
const catchAndLog = require('./../../../lib/helpers/catchAndLog')
|
|
3
|
+
|
|
4
|
+
const tool = require('./../../../lib/tool')
|
|
5
|
+
|
|
6
|
+
async function verify (httpMethod, uri) {
|
|
7
|
+
try {
|
|
8
|
+
logger.debug(`httpMethod: ${httpMethod}`)
|
|
9
|
+
logger.debug(`uri: ${uri}`)
|
|
10
|
+
|
|
11
|
+
const options = this.opts()
|
|
12
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
13
|
+
|
|
14
|
+
const headers = {
|
|
15
|
+
Signature: options.signature,
|
|
16
|
+
'Signature-Input': options.signatureInput,
|
|
17
|
+
'Signature-Agent': options.signatureAgent
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const output = await tool.verify(httpMethod, uri, headers)
|
|
21
|
+
|
|
22
|
+
let space = 0
|
|
23
|
+
if (options.prettyPrint) {
|
|
24
|
+
space = 2
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
console.log(JSON.stringify(output, null, space))
|
|
28
|
+
} catch (error) {
|
|
29
|
+
catchAndLog(error)
|
|
30
|
+
process.exit(1)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = verify
|
|
@@ -12,7 +12,7 @@ const keypairAction = require('./../actions/primitives/keypair')
|
|
|
12
12
|
primitives.command('keypair')
|
|
13
13
|
.description('generate public/private keypair')
|
|
14
14
|
.option('--private-jwk <privateJwk>', 'pre-existing private JWK')
|
|
15
|
-
.option('--prefix <type>', 'agent (default) |
|
|
15
|
+
.option('--prefix <type>', 'agent (default) | tool | none', 'agent')
|
|
16
16
|
.option('--pp, --pretty-print', 'pretty print output')
|
|
17
17
|
.action(keypairAction)
|
|
18
18
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const { Command } = require('commander')
|
|
2
|
+
|
|
3
|
+
const tool = new Command('tool')
|
|
4
|
+
|
|
5
|
+
tool
|
|
6
|
+
.description('π¨ tool')
|
|
7
|
+
.allowUnknownOption()
|
|
8
|
+
|
|
9
|
+
// vestauth tool verify
|
|
10
|
+
const verifyAction = require('./../actions/tool/verify')
|
|
11
|
+
tool.command('verify')
|
|
12
|
+
.description('verify agent')
|
|
13
|
+
.argument('<httpMethod>', 'GET (default)')
|
|
14
|
+
.argument('<uri>', '')
|
|
15
|
+
.requiredOption('--signature <signature>', '')
|
|
16
|
+
.requiredOption('--signature-input <signatureInput>', '')
|
|
17
|
+
.requiredOption('--signature-agent <signatureAgent>', '')
|
|
18
|
+
.option('--pp, --pretty-print', 'pretty print output')
|
|
19
|
+
.action(verifyAction)
|
|
20
|
+
|
|
21
|
+
module.exports = tool
|
package/src/cli/vestauth.js
CHANGED
|
@@ -39,7 +39,8 @@ program
|
|
|
39
39
|
.allowUnknownOption()
|
|
40
40
|
|
|
41
41
|
program.addCommand(require('./commands/agent'))
|
|
42
|
-
program.addCommand(require('./commands/
|
|
42
|
+
program.addCommand(require('./commands/tool'))
|
|
43
|
+
program.addCommand(require('./commands/provider'), { hidden: true })
|
|
43
44
|
program.addCommand(require('./commands/primitives'))
|
|
44
45
|
|
|
45
46
|
// vestauth help
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const verify = require('./verify')
|
|
2
2
|
const Errors = require('./errors')
|
|
3
3
|
|
|
4
|
-
async function
|
|
4
|
+
async function toolVerify (httpMethod, uri, headers = {}) {
|
|
5
5
|
if (!httpMethod) {
|
|
6
6
|
throw new Errors().missingHttpMethod()
|
|
7
7
|
}
|
|
@@ -17,4 +17,4 @@ async function providerVerify (httpMethod, uri, headers = {}) {
|
|
|
17
17
|
return verify(httpMethod, uri, headers)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
module.exports =
|
|
20
|
+
module.exports = toolVerify
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const
|
|
1
|
+
const DEFAULT_TOOL_FQDN_REGEX = /^[A-Za-z0-9-]+\.(?:agents|api)\.vestauth\.com$/
|
|
2
2
|
const Errors = require('./errors')
|
|
3
3
|
|
|
4
|
-
function
|
|
5
|
-
const override = process.env.PROVIDER_FQDN_REGEX
|
|
6
|
-
if (!override) return
|
|
4
|
+
function getToolFqdnRegex () {
|
|
5
|
+
const override = process.env.TOOL_FQDN_REGEX || process.env.PROVIDER_FQDN_REGEX
|
|
6
|
+
if (!override) return DEFAULT_TOOL_FQDN_REGEX
|
|
7
7
|
|
|
8
8
|
try {
|
|
9
9
|
return new RegExp(override)
|
|
10
10
|
} catch {
|
|
11
|
-
return
|
|
11
|
+
return DEFAULT_TOOL_FQDN_REGEX
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -17,7 +17,7 @@ function verifyAgentFqdn (fqdn) {
|
|
|
17
17
|
throw new Errors().invalidSignatureAgent()
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const pattern =
|
|
20
|
+
const pattern = getToolFqdnRegex()
|
|
21
21
|
if (!pattern.test(fqdn)) {
|
|
22
22
|
throw new Errors().invalidSignatureAgent()
|
|
23
23
|
}
|
package/src/lib/main.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
const agent = require('./agent')
|
|
2
|
-
const
|
|
2
|
+
const tool = require('./tool')
|
|
3
3
|
const primitives = require('./primitives')
|
|
4
4
|
|
|
5
5
|
module.exports = {
|
|
6
6
|
agent,
|
|
7
|
-
|
|
8
|
-
primitives
|
|
7
|
+
tool,
|
|
8
|
+
primitives,
|
|
9
|
+
|
|
10
|
+
// deprecate: synonym
|
|
11
|
+
provider: tool
|
|
9
12
|
}
|
package/src/lib/tool.js
ADDED