Socket
Socket
Sign inDemoInstall

ibm-cloud-sdk-core

Package Overview
Dependencies
Maintainers
1
Versions
143
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ibm-cloud-sdk-core - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

CHANGELOG.md

21

iam-token-manager/v1.d.ts

@@ -20,2 +20,4 @@ /**

iamUrl?: string;
iamClientId?: string;
iamSecret?: string;
};

@@ -36,2 +38,4 @@ export interface IamTokenData {

private userAccessToken;
private iamClientId;
private iamSecret;
/**

@@ -61,2 +65,14 @@ * IAM Token Manager Service

/**
* Set the IAM 'client_id' and 'secret' values.
* These values are used to compute the Authorization header used
* when retrieving or refreshing the IAM access token.
* If these values are not set, then a default Authorization header
* will be used when interacting with the IAM token server.
*
* @param {string} iamClientId - The client id
* @param {string} iamSecret - The secret
* @returns {void}
*/
setIamAuthorizationInfo(iamClientId: string, iamSecret: string): void;
/**
* Set a self-managed IAM access token.

@@ -118,2 +134,7 @@ * The access token should be valid and not yet expired.

private saveTokenInfo;
/**
* Compute and return the Authorization header to be used with the
* IAM token server interactions (retrieve and refresh access token).
*/
private computeIamAuthHeader;
}

44

iam-token-manager/v1.js

@@ -18,2 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var bufferFrom = require("buffer-from");
var extend = require("extend");

@@ -34,3 +35,3 @@ var requestwrapper_1 = require("../lib/requestwrapper");

function IamTokenManagerV1(options) {
this.iamUrl = options.iamUrl || 'https://iam.bluemix.net/identity/token';
this.iamUrl = options.iamUrl || 'https://iam.cloud.ibm.com/identity/token';
this.tokenInfo = {};

@@ -43,2 +44,8 @@ if (options.iamApikey) {

}
if (options.iamClientId) {
this.iamClientId = options.iamClientId;
}
if (options.iamSecret) {
this.iamSecret = options.iamSecret;
}
}

@@ -81,2 +88,17 @@ /**

/**
* Set the IAM 'client_id' and 'secret' values.
* These values are used to compute the Authorization header used
* when retrieving or refreshing the IAM access token.
* If these values are not set, then a default Authorization header
* will be used when interacting with the IAM token server.
*
* @param {string} iamClientId - The client id
* @param {string} iamSecret - The secret
* @returns {void}
*/
IamTokenManagerV1.prototype.setIamAuthorizationInfo = function (iamClientId, iamSecret) {
this.iamClientId = iamClientId;
this.iamSecret = iamSecret;
};
/**
* Set a self-managed IAM access token.

@@ -109,3 +131,3 @@ * The access token should be valid and not yet expired.

'Content-type': 'application/x-www-form-urlencoded',
Authorization: 'Basic Yng6Yng='
Authorization: this.computeIamAuthHeader()
},

@@ -134,3 +156,3 @@ form: {

'Content-type': 'application/x-www-form-urlencoded',
Authorization: 'Basic Yng6Yng='
Authorization: this.computeIamAuthHeader()
},

@@ -197,2 +219,18 @@ form: {

};
/**
* Compute and return the Authorization header to be used with the
* IAM token server interactions (retrieve and refresh access token).
*/
IamTokenManagerV1.prototype.computeIamAuthHeader = function () {
// Use bx:bx as default auth header creds.
var clientId = 'bx';
var secret = 'bx';
// If both the clientId and secret were specified by the user, then use them.
if (this.iamClientId && this.iamSecret) {
clientId = this.iamClientId;
secret = this.iamSecret;
}
var encodedCreds = bufferFrom(clientId + ":" + secret).toString('base64');
return "Basic " + encodedCreds;
};
return IamTokenManagerV1;

@@ -199,0 +237,0 @@ }());

5

lib/base_service.js

@@ -22,3 +22,2 @@ "use strict";

var extend = require("extend");
var semver = require("semver");
var vcapServices = require("vcap_services");

@@ -94,6 +93,2 @@ var v1_1 = require("../iam-token-manager/v1");

}
var isNodeFour = semver.satisfies(process.version, '4.x');
if (isNodeFour) {
console.warn('WARNING: Support for Node v4.x is deprecated and will no longer be tested. Support will be officially dropped in the next major version.');
}
var options = extend({}, userOptions);

@@ -100,0 +95,0 @@ var _options = this.initCredentials(options);

/// <reference types="node" />
import { FileObject } from '../lib/helper';
declare const _default: {
fromFilename: (file: String | File | ReadableStream | Buffer | FileObject) => string;
fromFilename: (file: String | File | Buffer | NodeJS.ReadableStream | FileObject) => string;
fromHeader: (buffer: Buffer) => string;
};
export default _default;
{
"name": "ibm-cloud-sdk-core",
"version": "0.1.2",
"version": "0.2.0",
"description": "Core functionality to support SDKs generated with IBM's OpenAPI 3 SDK Generator.",

@@ -43,9 +43,10 @@ "main": "./index",

"eslint-plugin-prettier": "~2.6.1",
"jest": "^23.6.0",
"jest": "^24.6.0",
"object.assign": "~4.1.0",
"prettier": "~1.13.5",
"semantic-release": "^15.9.3",
"semantic-release": "^15.13.12",
"tslint": "~5.10.0",
"tslint-config-prettier": "~1.13.0",
"tslint-eslint-rules": "~5.3.1",
"typedoc": "^0.14.2",
"typescript": "~2.9.2"

@@ -52,0 +53,0 @@ },

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