hashi-vault-js
Advanced tools
Comparing version
@@ -5,3 +5,11 @@ # Hashi Vault JS | ||
* `0.4.12` (**latest**) | ||
* `0.4.13` (**latest**) | ||
* Added SBOM generator script | ||
* Upgraded all dependencies to the latest | ||
* Refactored TypeScript types to get them linted and verified - issue [#35](https://github.com/rod4n4m1/hashi-vault-js/issues/35) | ||
* Fixed `package.json` to accept node engine `v14` - issue [#32](https://github.com/rod4n4m1/hashi-vault-js/issues/32) | ||
* Fixed TypeScript types to match main code and allow contructor without certificates - issue [#31](https://github.com/rod4n4m1/hashi-vault-js/issues/31) | ||
* Upgraded development env to Vault server `1.13.0` and `podman` | ||
* `0.4.12` | ||
* Turned CA certificate optional (contribution from @josedev-union) | ||
@@ -8,0 +16,0 @@ * Upgraded all dependencies (`Axios`, `Jest`, `random-words`, and `@type/node`) |
{ | ||
"name": "hashi-vault-js", | ||
"version": "0.4.12", | ||
"version": "0.4.13", | ||
"description": "A node.js module to interact with the Hashicorp Vault API.", | ||
@@ -50,12 +50,12 @@ "main": "Vault.js", | ||
"engines": { | ||
"node": ">=16" | ||
"node": ">=14" | ||
}, | ||
"dependencies": { | ||
"axios": "^1.2.1" | ||
"axios": "^1.3.4" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^18.6.1", | ||
"jest": "^29.3.1", | ||
"random-words": "^1.2.0", | ||
"typescript": "^4.7.4" | ||
"@types/node": "^18.15.10", | ||
"jest": "^29.5.0", | ||
"random-words": "^1.3.0", | ||
"typescript": "^5.0.2" | ||
}, | ||
@@ -62,0 +62,0 @@ "jest": { |
@@ -22,7 +22,7 @@ # Hashi Vault JS | ||
* npm | ||
* Tested on: **v8.12.x** | ||
* Tested on: **v9.2.x** | ||
* HashiCorp Vault | ||
* Minimum: v1.10.x | ||
* Accepted: v1.11.x | ||
* Recommended: **v1.12.x** | ||
* Minimum: v1.11.x | ||
* Accepted: v1.12.x | ||
* Recommended: **v1.13.x** | ||
@@ -234,3 +234,2 @@ **Note:** Depending on your Windows setup [windows-build-tools](https://www.npmjs.com/package/windows-build-tools) may need to be installed first. Also, for MacOS users, you should have **xcode-select** or entire Xcode App installed. | ||
### Error handling | ||
@@ -337,3 +336,2 @@ | ||
* Richard <richie765@> | ||
* Artico Bandurini <articobandurini@> | ||
* Ordinary IT9 <hkgnobody@> | ||
@@ -340,0 +338,0 @@ * Osama Adil <adilosama47@gmail.com> |
323
Vault.d.ts
@@ -10,12 +10,7 @@ // Type definitions for hashi-vault-js | ||
export type VaultConfig = { | ||
export type CertConfig = { | ||
/** | ||
* Indicates if the HTTP request to the Vault server should use | ||
* HTTPS (secure) or HTTP (non-secure) protocol | ||
*/ | ||
https?: boolean; | ||
/** | ||
* If https is true, then provide client certificate, client key and | ||
* the root CA cert. | ||
* Client cert and key are optional now. | ||
* the root CA cert. | ||
* Client cert and key are optional now. | ||
* @example './path/to/your/cert.crt' | ||
@@ -32,5 +27,13 @@ */ | ||
cacert: string; | ||
}; | ||
export type VaultConfig = { | ||
/** | ||
* Indicates if the HTTP request to the Vault server should use | ||
* HTTPS (secure) or HTTP (non-secure) protocol | ||
*/ | ||
https?: boolean; | ||
/** | ||
* Indicate the server name/IP, port and API version for the Vault instance, | ||
* all paths are relative to this one | ||
* all paths are relative to this one | ||
*/ | ||
@@ -40,4 +43,4 @@ baseUrl?: string; | ||
* Sets the root path after the base URL, it translates to a | ||
* partition inside the Vault where the secret engine / auth method was enabled. | ||
* Can be passed individually on each function through mount parameter | ||
* partition inside the Vault where the secret engine / auth method was enabled. | ||
* Can be passed individually on each function through mount parameter | ||
*/ | ||
@@ -51,4 +54,4 @@ rootPath: string; | ||
* If should use a proxy or not by the HTTP request | ||
* Example: | ||
* proxy: { host: proxy.ip, port: proxy.port } | ||
* Example: | ||
* proxy: { host: proxy.ip, port: proxy.port } | ||
*/ | ||
@@ -60,3 +63,3 @@ proxy?: AxiosProxyConfig | boolean; | ||
namespace?: string; | ||
} | ||
} & Partial<CertConfig>; | ||
@@ -77,96 +80,96 @@ export type CertificateFormat = "der" | "pem"; | ||
interface Cpu { | ||
cpu: number; | ||
vendorId: string; | ||
family: string; | ||
model: string; | ||
stepping: number; | ||
physicalId: string; | ||
coreId: string; | ||
cores: number; | ||
modelName: string; | ||
mhz: number; | ||
cacheSize: number; | ||
cpu: number; | ||
vendorId: string; | ||
family: string; | ||
model: string; | ||
stepping: number; | ||
physicalId: string; | ||
coreId: string; | ||
cores: number; | ||
modelName: string; | ||
mhz: number; | ||
cacheSize: number; | ||
flags: string[]; | ||
microcode: string; | ||
microcode: string; | ||
} | ||
interface CpuTime { | ||
cpu: string; | ||
user: number; | ||
system: number; | ||
idle: number; | ||
nice: number; | ||
iowait: number; | ||
irq: number; | ||
softirq: number; | ||
steal: number; | ||
guest: number; | ||
guestNice: number; | ||
cpu: string; | ||
user: number; | ||
system: number; | ||
idle: number; | ||
nice: number; | ||
iowait: number; | ||
irq: number; | ||
softirq: number; | ||
steal: number; | ||
guest: number; | ||
guestNice: number; | ||
} | ||
interface Disk { | ||
path: string; | ||
fstype: string; | ||
total: number; | ||
free: number; | ||
used: number; | ||
usedPercent: number; | ||
inodesTotal: number; | ||
inodesUsed: number; | ||
inodesFree: number; | ||
inodesUsedPercent: number; | ||
path: string; | ||
fstype: string; | ||
total: number; | ||
free: number; | ||
used: number; | ||
usedPercent: number; | ||
inodesTotal: number; | ||
inodesUsed: number; | ||
inodesFree: number; | ||
inodesUsedPercent: number; | ||
} | ||
interface Host { | ||
hostname: string; | ||
uptime: number; | ||
bootTime: number; | ||
procs: number; | ||
os: string; | ||
platform: string; | ||
platformFamily: string; | ||
platformVersion: string; | ||
kernelVersion: string; | ||
kernelArch: string; | ||
virtualizationSystem: string; | ||
virtualizationRole: string; | ||
hostid: string; | ||
hostname: string; | ||
uptime: number; | ||
bootTime: number; | ||
procs: number; | ||
os: string; | ||
platform: string; | ||
platformFamily: string; | ||
platformVersion: string; | ||
kernelVersion: string; | ||
kernelArch: string; | ||
virtualizationSystem: string; | ||
virtualizationRole: string; | ||
hostid: string; | ||
} | ||
interface Memory { | ||
total: number; | ||
available: number; | ||
used: number; | ||
usedPercent: number; | ||
free: number; | ||
active: number; | ||
inactive: number; | ||
wired: number; | ||
laundry: number; | ||
buffers: number; | ||
cached: number; | ||
writeback: number; | ||
dirty: number; | ||
writebacktmp: number; | ||
shared: number; | ||
slab: number; | ||
sreclaimable: number; | ||
sunreclaim: number; | ||
pagetables: number; | ||
swapcached: number; | ||
commitlimit: number; | ||
committedas: number; | ||
hightotal: number; | ||
highfree: number; | ||
lowtotal: number; | ||
lowfree: number; | ||
swaptotal: number; | ||
swapfree: number; | ||
mapped: number; | ||
vmalloctotal: number; | ||
vmallocused: number; | ||
vmallocchunk: number; | ||
hugepagestotal: number; | ||
hugepagesfree: number; | ||
hugepagesize: number; | ||
total: number; | ||
available: number; | ||
used: number; | ||
usedPercent: number; | ||
free: number; | ||
active: number; | ||
inactive: number; | ||
wired: number; | ||
laundry: number; | ||
buffers: number; | ||
cached: number; | ||
writeback: number; | ||
dirty: number; | ||
writebacktmp: number; | ||
shared: number; | ||
slab: number; | ||
sreclaimable: number; | ||
sunreclaim: number; | ||
pagetables: number; | ||
swapcached: number; | ||
commitlimit: number; | ||
committedas: number; | ||
hightotal: number; | ||
highfree: number; | ||
lowtotal: number; | ||
lowfree: number; | ||
swaptotal: number; | ||
swapfree: number; | ||
mapped: number; | ||
vmalloctotal: number; | ||
vmallocused: number; | ||
vmallocchunk: number; | ||
hugepagestotal: number; | ||
hugepagesfree: number; | ||
hugepagesize: number; | ||
} | ||
@@ -176,37 +179,37 @@ | ||
export type HealthCheckParams = { | ||
standbyok?: boolean; | ||
perfstandbyok?: boolean; | ||
activecode?: number; | ||
standbycode?: number; | ||
drsecondarycode?: number; | ||
performancestandbycode?: number; | ||
sealedcode?: number; | ||
uninitcode?: number; | ||
standbyok: boolean; | ||
perfstandbyok: boolean; | ||
activecode: number; | ||
standbycode: number; | ||
drsecondarycode: number; | ||
performancestandbycode: number; | ||
sealedcode: number; | ||
uninitcode: number; | ||
}; | ||
export type HealthCheckResponse = { | ||
initialized: boolean; | ||
sealed: boolean; | ||
standby: boolean; | ||
performance_standby: boolean; | ||
replication_performance_mode: string; | ||
replication_dr_mode: string; | ||
server_time_utc: number; | ||
version: string; | ||
cluster_name: string; | ||
initialized: boolean; | ||
sealed: boolean; | ||
standby: boolean; | ||
performance_standby: boolean; | ||
replication_performance_mode: string; | ||
replication_dr_mode: string; | ||
server_time_utc: number; | ||
version: string; | ||
cluster_name: string; | ||
cluster_id: string; | ||
} | ErrorResponse; | ||
export type SealStatusResponse = { | ||
type: string; | ||
initialized: boolean; | ||
sealed: boolean; | ||
t: number; | ||
n: number; | ||
progress: number; | ||
nonce: string; | ||
version: string; | ||
build_date: string; | ||
type: string; | ||
initialized: boolean; | ||
sealed: boolean; | ||
t: number; | ||
n: number; | ||
progress: number; | ||
nonce: string; | ||
version: string; | ||
build_date: string; | ||
migration: boolean; | ||
cluster_name?: string; | ||
cluster_id?: string; | ||
recovery_seal: boolean; | ||
recovery_seal: boolean; | ||
storage_type: string; | ||
@@ -231,5 +234,5 @@ } | ErrorResponse; | ||
request_id: string; | ||
lease_id: string; | ||
renewable: boolean; | ||
lease_duration: number; | ||
lease_id: string; | ||
renewable: boolean; | ||
lease_duration: number; | ||
data: { | ||
@@ -242,4 +245,4 @@ counters: { | ||
}; | ||
wrap_info: string | null; | ||
warnings: string | null; | ||
wrap_info: string | null; | ||
warnings: string | null; | ||
auth: string | null; | ||
@@ -251,5 +254,5 @@ } | ErrorResponse; | ||
sealed: boolean; | ||
t: number; | ||
n: number; | ||
progress: number; | ||
t: number; | ||
n: number; | ||
progress: number; | ||
version: number; | ||
@@ -263,3 +266,3 @@ cluster_name?: string; | ||
policies?: string; | ||
meta?: Record<string, any>; | ||
meta?: Record<string, unknown>; | ||
no_parent?: boolean; | ||
@@ -469,15 +472,15 @@ no_default_policy?: boolean; | ||
export type SetLdapConfigResponse = { | ||
binddn: string; | ||
binddn: string; | ||
deny_null_bind: boolean; | ||
discoverdn: boolean; | ||
groupattr: string; | ||
groupdn: string; | ||
groupfilter: string; | ||
insecure_tls: boolean; | ||
starttls: boolean; | ||
tls_max_version: string; | ||
tls_min_version: string; | ||
url: string; | ||
username_as_alias: boolean; | ||
userattr: string; | ||
discoverdn: boolean; | ||
groupattr: string; | ||
groupdn: string; | ||
groupfilter: string; | ||
insecure_tls: boolean; | ||
starttls: boolean; | ||
tls_max_version: string; | ||
tls_min_version: string; | ||
url: string; | ||
username_as_alias: boolean; | ||
userattr: string; | ||
userdn: string; | ||
@@ -545,9 +548,9 @@ } | ErrorResponse; | ||
export type CreateK8sRoleParams = { | ||
bound_service_account_names?: Record<string, any>; | ||
bound_service_account_namespaces?: Record<string, any>; | ||
bound_service_account_names?: Record<string, unknown>; | ||
bound_service_account_namespaces?: Record<string, unknown>; | ||
audience?: string; | ||
token_ttl?: string | number; | ||
token_max_ttl?: string | number; | ||
token_policies?: Record<string, any>; | ||
token_bound_cidrs?: Record<string, any>; | ||
token_policies?: Record<string, unknown>; | ||
token_bound_cidrs?: Record<string, unknown>; | ||
token_explicit_max_ttl?: string | number; | ||
@@ -576,3 +579,3 @@ token_no_default_policy?: boolean; | ||
token_policies: string[]; | ||
metadata: Record<string, any> | null; | ||
metadata: Record<string, unknown> | null; | ||
lease_duration: number; | ||
@@ -944,3 +947,3 @@ renewable: boolean; | ||
created_time: string; | ||
custom_metadata: Record<string, any>; | ||
custom_metadata: Record<string, unknown>; | ||
deletion_time: string; | ||
@@ -952,3 +955,3 @@ destroyed: boolean; | ||
created_time: string; | ||
custom_metadata: Record<string, any>; | ||
custom_metadata: Record<string, unknown>; | ||
deletion_time: string; | ||
@@ -958,3 +961,12 @@ destroyed: boolean; | ||
} | ErrorResponse; | ||
export type ReadKVSecretResponse = {} | ErrorResponse; | ||
export type ReadKVSecretResponse = { | ||
data: Record<string, unknown>; | ||
metadata: { | ||
created_time: string; | ||
custom_metadata: Record<string, unknown> | null; | ||
deletion_time: string; | ||
destroyed: boolean; | ||
version: number; | ||
} | ||
} | ErrorResponse; | ||
export type DeleteLatestVerKVSecretResponse = {} | ErrorResponse; | ||
@@ -969,3 +981,2 @@ export type DeleteVersionsKVSecretResponse = {} | ErrorResponse; | ||
declare module "hashi-vault-js" { | ||
@@ -986,3 +997,3 @@ class Vault { | ||
constructor(params: VaultConfig) | ||
healthCheck(params: HealthCheckParams): Promise<HealthCheckResponse>; | ||
healthCheck(params?: Partial<HealthCheckParams>): Promise<HealthCheckResponse>; | ||
sealStatus(): Promise<SealStatusResponse>; | ||
@@ -1082,6 +1093,6 @@ sysHostInfo(sudoToken: string): Promise<SysHostInfoResponse>; | ||
getADCredSatus(token: string, setName: string, mount?: string): Promise<GetADCredSatusResponse>; | ||
updateKVEngineConfig(token: string, data: Record<string, any>, mount?: string): Promise<UpdateKVEngineConfigResponse>; | ||
updateKVEngineConfig(token: string, data: Record<string, unknown>, mount?: string): Promise<UpdateKVEngineConfigResponse>; | ||
readKVEngineConfig(token: string, mount?: string): Promise<ReadKVEngineConfigResponse>; | ||
createKVSecret(token: string, name: string, secrets: Record<string, any>, mount?: string): Promise<CreateKVSecretResponse>; | ||
updateKVSecret(token: string, name: string, secrets: Record<string, any>, version: number, mount?: string): Promise<UpdateKVSecretResponse>; | ||
createKVSecret(token: string, name: string, secrets: Record<string, unknown>, mount?: string): Promise<CreateKVSecretResponse>; | ||
updateKVSecret(token: string, name: string, secrets: Record<string, unknown>, version: number, mount?: string): Promise<UpdateKVSecretResponse>; | ||
readKVSecret(token: string, name: string, version?: number, mount?: string): Promise<ReadKVSecretResponse>; | ||
@@ -1088,0 +1099,0 @@ deleteLatestVerKVSecret(token: string, name: string, mount?: string): Promise<DeleteLatestVerKVSecretResponse>; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
70
1.45%0
-100%576752
-85.49%14884
-85.76%343
-0.58%Updated