Socket
Socket
Sign inDemoInstall

@blinkmobile/bm-identity

Package Overview
Dependencies
Maintainers
4
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blinkmobile/bm-identity

Helper functions for Blink Mobiles single identity


Version published
Weekly downloads
11
Maintainers
4
Weekly downloads
 
Created
Source

bm-identity.js npm AppVeyor Status Travis CI Status Greenkeeper badge

Provides easy management of authenication for our CLI via a single identity.

Getting Started

npm install @blinkmobile/bm-identity --save
const pkg = require('./package.json');
const BlinkMobileIdentity = require('@blinkmobile/bm-identity');
const blinkMobileIdentity = new BlinkMobileIdentity(pkg.name);

Usage

Login

If no LoginOptions are passed, a browser based login process will start. This is how users can login using a social account e.g. Google.

login (options: LoginOptions) => Promise{String}
interface LoginOptions {
  username? : String|Boolean, // Can also pass true, and username will be prompted for
  password? : String, // Will be prompted for password if username is truthy
  storeJwt? : Boolean, // Set to true to store jwt on local file system, defaults to false
  refreshToken? : Boolean, // Set to true will request a refresh token as well as an access token
}
blinkMobileIdentity.login()
  .then(jwt => {
    // Use jwt access token.
  });
storeJwt Option

Logout

logout () => Promise
blinkMobileIdentity.logout();

Assume AWS Role

assumeAWSRole (additionalParameters: Object) => Promise{AssumedRoleCredentials}
interface AssumedRoleCredentials {
  accessKeyId : String,
  secretAccessKey : String,
  sessionToken : String
}
blinkMobileIdentity.assumeAWSRole()
  .then(credentials => {
    // Use AWS credentials
  });

Get Access Token

To create an AccessToken using BlinkM Deployment Keys or retrieve the AccessToken stored after a successful login:

Using Deployment Keys

If the following environment variables are set:

  • BLINKM_ACCESS_KEY
  • BLINKM_SECRET_KEY

These will be used to create an AccessToken

getAccessToken () => Promise{string}
blinkMobileIdentity.getAccessToken()
  .then(jwt => {
    // Use access token
  });

Get Access Token Payload

Helper function to get the payload for a JWT

getPayload () => Promise{Object}
blinkMobileIdentity.getPayload()
  .then(payload => {
    // Use payload
  });

Manage Tenants

Get and set the current tenant. Also get and remove list of previously used tenants.

getTenants () => Promise{Tenants}
setTenant (tenantName: String) => Promise{Tenants}
removeTenant (tenantName: String) => Promise{Tenants}
interface Tenants {
  current : String,
  previous : Array{String}
}
blinkMobileIdentity.getTenants()
  .then(tenants => {
    // Use tenants
  });

blinkMobileIdentity.setTenant('TenantName')
  .then(tenants => {
    // Tenant was set
  });

blinkMobileIdentity.removeTenant('TenantName')
  .then(tenants => {
    // Tenant was removed
  });

FAQs

Package last updated on 20 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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