Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@creditkarma/vault-client

Package Overview
Dependencies
Maintainers
5
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@creditkarma/vault-client - npm Package Compare versions

Comparing version 0.5.0-0 to 0.5.0

2

dist/main/types.d.ts

@@ -5,2 +5,3 @@ /// <reference types="request" />

apiVersion: 'v1';
protocol: 'http' | 'https';
destination: string;

@@ -11,2 +12,3 @@ requestOptions: CoreOptions;

apiVersion: 'v1';
protocol: 'http' | 'https';
destination: string;

@@ -13,0 +15,0 @@ requestOptions: CoreOptions;

10

dist/main/utils.js

@@ -5,4 +5,3 @@ "use strict";

function isObject(obj) {
return (obj !== null &&
typeof obj === 'object');
return obj !== null && typeof obj === 'object';
}

@@ -46,5 +45,3 @@ function merge(base, update) {

function removeLeadingTrailingSlash(str) {
const tmp = ((str.charAt(0) === '/') ?
str.substring(1, str.length) :
str);
const tmp = str.charAt(0) === '/' ? str.substring(1, str.length) : str;
if (tmp.charAt(tmp.length - 1) === '/') {

@@ -60,3 +57,4 @@ return tmp.substring(0, tmp.length - 1);

apiVersion: 'v1',
destination: 'http://localhost:8200',
protocol: 'http',
destination: 'localhost:8200',
mount: '/secret',

@@ -63,0 +61,0 @@ namespace: '',

@@ -6,2 +6,3 @@ /// <reference types="request" />

apiVersion?: 'v1';
protocol?: 'http' | 'https';
destination?: string;

@@ -8,0 +9,0 @@ requestOptions?: CoreOptions;

@@ -6,2 +6,3 @@ /// <reference types="request" />

destination: string;
protocol?: 'http' | 'https';
apiVersion?: 'v1';

@@ -13,3 +14,3 @@ requestOptions?: CoreOptions;

private dest;
constructor({destination, apiVersion, requestOptions}: IVaultServiceArgs);
constructor({destination, protocol, apiVersion, requestOptions}: IVaultServiceArgs);
status(options?: CoreOptions): Promise<IStatusResult>;

@@ -16,0 +17,0 @@ init(data: IInitArgs, options?: CoreOptions): Promise<IInitResult>;

@@ -22,9 +22,9 @@ "use strict";

function fetch(options, token) {
const requestOptions = ((token !== undefined) ?
utils.deepMerge(options, {
const requestOptions = token !== undefined
? utils.deepMerge(options, {
headers: {
'X-Vault-Token': token,
},
}) :
options);
})
: options;
return request(requestOptions).then((res) => {

@@ -45,5 +45,5 @@ switch (res.statusCode) {

class VaultService {
constructor({ destination, apiVersion = 'v1', requestOptions = {}, }) {
constructor({ destination, protocol = 'http', apiVersion = 'v1', requestOptions = {}, }) {
this.defaultOptions = requestOptions;
this.dest = `${destination}/${apiVersion}`;
this.dest = `${protocol}://${destination}/${apiVersion}`;
}

@@ -50,0 +50,0 @@ status(options = {}) {

{
"name": "@creditkarma/vault-client",
"version": "0.5.0-0",
"version": "0.5.0",
"description": "A client for communicating with Hashicorp Vault written in TypeScript",

@@ -25,3 +25,7 @@ "main": "dist/main/index.js",

"test:unit": "lab --timeout 10000 --verbose -l -S ./dist/tests/unit/*.spec.js",
"test:integration": "lab --timeout 15000 --verbose -l -S ./dist/tests/integration/*.spec.js"
"test:integration": "lab --timeout 15000 --verbose -l -S ./dist/tests/integration/*.spec.js",
"release:patch": "npm version patch && npm run release:publish",
"release:minor": "npm version minor && npm run release:publish",
"release:major": "npm version major && npm run release:publish",
"release:publish": "git push --follow-tags"
},

@@ -32,7 +36,4 @@ "author": "Credit Karma",

"type": "git",
"url": "https://github.com/creditkarma/thrift-server/tree/master/packages/vault-client"
"url": "https://github.com/creditkarma/vault-client"
},
"peerDependencies": {
"@types/request": "^2.47.0"
},
"devDependencies": {

@@ -42,3 +43,2 @@ "@types/code": "^4.0.3",

"@types/node": "^8.0.51",
"@types/request": "^2.47.0",
"code": "^4.1.0",

@@ -53,2 +53,3 @@ "lab": "^14.3.1",

"@types/request-promise-native": "^1.0.12",
"@types/request": "^2.47.0",
"request": "^2.83.0",

@@ -55,0 +56,0 @@ "request-promise-native": "^1.0.5"

@@ -24,9 +24,11 @@ # Vault Client

Available options:
* apiVersion - API version to use. Currently this can only be 'v1'.
* destination - The location of the Vault instance. Defaults to 'http://localhost:8200'.
* mount - The mount at which secrets can be found. Defaults to 'secret'.
* namespace - A namespace for secrets. This path will be prepended to all get/set requests. Defaults to ''.
* tokenPath - The local file path to a file containing the Vault token. Defaults to '/tmp/token'.
* requestOptions - Options passed to the underlying [Request library](https://github.com/request/request). The options can be overriden on a per-request basis by passing an optional final parameter to any of the service or client methods. This will be used to set up TLS.
* apiVersion - API version to use. Currently this can only be 'v1'.
* protocol - The protocol to use 'http' or 'https'. Defaults to 'http'.
* destination - The location of the Vault instance. Defaults to 'localhost:8200'.
* mount - The mount at which secrets can be found. Defaults to 'secret'.
* namespace - A namespace for secrets. This path will be prepended to all get/set requests. Defaults to ''.
* tokenPath - The local file path to a file containing the Vault token. Defaults to '/tmp/token'.
* requestOptions - Options passed to the underlying [Request library](https://github.com/request/request). The options can be overriden on a per-request basis by passing an optional final parameter to any of the service or client methods. This will be used to set up TLS.
#### Mount vs Namespace

@@ -56,12 +58,13 @@

const options: IHVConfig = {
apiVersion: 'v1',
destination: 'http://localhost:8200',
mount: 'secret',
namespace: '',
tokenPath: '/tmp/token',
requestOptions: {
headers: {
host: 'localhost'
apiVersion: 'v1',
protocol: 'http',
destination: 'localhost:8200',
mount: 'secret',
namespace: '',
tokenPath: '/tmp/token',
requestOptions: {
headers: {
host: 'localhost'
}
}
}
}

@@ -72,6 +75,6 @@ const client: VaultClient = new VaultClient(options)

client.set('key', 'value').then(() => {
// value successfully written
client.get<string>('key').then((val: string) => {
// val = 'value'
})
// value successfully written
client.get<string>('key').then((val: string) => {
// val = 'value'
})
})

@@ -87,6 +90,8 @@ ```

VaultService accepts a sub-set of the options that VaultClient accepts:
* apiVersion
* destination
* requestOptions
* apiVersion
* protocol
* destination
* requestOptions
#### Example

@@ -100,9 +105,10 @@

const options: IServiceConfig = {
apiVersion: 'v1',
destination: 'http://localhost:8200',
requestOptions: {
headers: {
host: 'localhost'
apiVersion: 'v1',
protocol: 'http',
destination: 'localhost:8200',
requestOptions: {
headers: {
host: 'localhost'
}
}
}
}

@@ -145,2 +151,2 @@ const service: VaultService = new VaultService(options)

This project is licensed under [Apache License Version 2.0](./LICENSE)
This project is licensed under [Apache License Version 2.0](./LICENSE)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc