vestauth 0.23.0 → 0.23.1

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,13 @@
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.23.0...main)
5
+ [Unreleased](https://github.com/vestauth/vestauth/compare/v0.23.1...main)
6
+
7
+ ## [0.23.1](https://github.com/vestauth/vestauth/compare/v0.23.0...v0.23.1) (2026-03-03)
8
+
9
+ ### Changed
10
+
11
+ * Check for existing tool ([#47](https://github.com/vestauth/vestauth/pull/47))
6
12
 
7
13
  ## [0.23.0](https://github.com/vestauth/vestauth/compare/v0.22.1...v0.23.0) (2026-03-03)
8
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vestauth",
3
- "version": "0.23.0",
3
+ "version": "0.23.1",
4
4
  "description": "web-bot-auth for agents–from the creator of dotenvx",
5
5
  "keywords": [
6
6
  "vestauth",
@@ -0,0 +1,17 @@
1
+ const env = require('./env')
2
+
3
+ function toolIdentity (raiseError = true) {
4
+ const publicJwk = env('TOOL_PUBLIC_JWK')
5
+ const privateJwk = env('TOOL_PRIVATE_JWK')
6
+ const uid = env('TOOL_UID')
7
+
8
+ if (raiseError && uid && !(publicJwk && privateJwk)) throw new Error('missing TOOL_PUBLIC_JWK, TOOL_PRIVATE_JWK, or TOOL_UID. Run [vestauth tool init]')
9
+
10
+ return {
11
+ uid,
12
+ publicJwk,
13
+ privateJwk
14
+ }
15
+ }
16
+
17
+ module.exports = toolIdentity
@@ -1,4 +1,5 @@
1
1
  const dotenvx = require('@dotenvx/dotenvx')
2
+ const toolIdentity = require('./toolIdentity')
2
3
  const keypair = require('./keypair')
3
4
  const touch = require('./touch')
4
5
  const normalizeToolHostname = require('./normalizeToolHostname')
@@ -9,10 +10,13 @@ async function toolInit (hostname = null) {
9
10
  const normalizedHostname = normalizeToolHostname(hostname)
10
11
  const shouldPersistHostname = normalizedHostname !== 'https://api.vestauth.com'
11
12
 
12
- const kp = keypair(null, 'tool')
13
+ // keypair
14
+ const currentPrivateJwk = toolIdentity(false).privateJwk
15
+ const kp = keypair(currentPrivateJwk, 'tool')
13
16
 
14
17
  touch(envPath)
15
18
 
19
+ // register tool
16
20
  const tool = await new PostToolRegister(normalizedHostname, kp.publicJwk, kp.privateJwk).run()
17
21
  dotenvx.set('TOOL_UID', tool.uid, { path: envPath, plain: true, quiet: true })
18
22
  dotenvx.set('TOOL_PUBLIC_JWK', JSON.stringify(kp.publicJwk), { path: envPath, plain: true, quiet: true })