npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mobisysgmbh/msb-custom-auth-api

v2.0.2

Published

API definition for custom authentication scripts in MSB App

Downloads

4

Readme

Custom Authentication API for MSB App

This package contains Custom Authentication API Contract files needed to develop Custom Authentication Scripts for Mobisys MSB App.

Custom Auth Api

export interface CustomAuthApi {
  http: CustomAuthHttpClient;
  logger: CustomAuthLogger;
  appLauncher: CustomAuthAppLauncher;
  cookieStorage: CustomAuthCookieStorage;
  appInfo: CustomAuthAppInfo;
  deviceInfo: CustomAuthDeviceInfo;
  versionInfo: CustomAuthVersionInfo;
  nfc: CustomAuthNfc;
}

Contains available native modules

export interface CustomAuthentication {
  login(profile: CustomAuthProfile): Promise<AuthConfig>;
  logout(profile: CustomAuthProfile): Promise<void>;
}

Interface that has to be implemented as a authentication script

interface CustomAuthProfile

exposes MSB App settings. Those are readonly and can not be changed.

interface ScriptSettingsDescriptor

Interface that describes the data structure the MSB App expects for script settings.

It consists of two parts. A mandatory hide credentials script item and an optional array of script items.

export interface HideCredentialInputsScriptItem {
  key: 'hideCredentialInputs';
  description: 'Hide credential inputs';
  readonly dataType: 'Boolean';
  readonly uiType: 'Checkbox';
  readonly defaultValue: boolean;
}
export type ScriptItem =
  | BooleanScriptItem
  | EnumScriptItem
  | NumberScriptItem
  | StringScriptItem;

The hide credential inputs script item controls the visibility of credential inputs in the MSB App Login Screen. The array of script items represents script settings that should be used in addition to MSB App settings. A separate UI is generated in the MSB App for these settings.

Native modules

App Info

getAppName(): Promise<string>

Returns the name of the app. Most likely "MSB App" unless Mobisys changes the name.

getPackageName(): Promise<string>

Returns the package name of the app - the reversed domain name app identifier like com.example.appname

getVersionCode(): Promise<string>

Returns the build identifier of the app

getVersionNumber(): Promise<string>

Returns the version number of the app

App Launcher

launchByUri(uri: string): Promise<void>

Launches a App by URI. 'https://google.com' would start the browser and open googles website. 'slack://open?team={1234}' would open slack app and go to team chat with team id 1234

Cookie Storage

setCookie(url: string, cookie: string): Promise<void>

Sets a cookie for a specific url. Cookies are cleared after each log out off an MSB application.

Device Info

isAndroid(): Promise<boolean>

isIOs(): Promise<boolean>

isIPad(): Promise<boolean>

isElectron(): Promise<boolean>

isWindows(): Promise<boolean>

Those can be used to check the platform.

getUserAgent(): Promise<string>

Returns current user agent string of current WebView depending on platform.

getDeviceName(): Promise<string>

Returns user-friendly name of the device.

getOem(): Promise<string>

Returns the manufacturer

getOs(): Promise<string>

Returns OS name and version

getPlatformName(): Promise<PlatformName>

Returns the device's operating system name.

getDeviceDescription(): Promise<string>

On mobile platforms returns model name. On Desktop returns current user name.

getSerial(): Promise<string>

Tries to retrieve the serial number on mobile platforms. On Desktop returns the uid.

getUsername(): Promise<string>

Not supported on mobile platforms. Throws error. On Desktop retruns the user name.

getUuid(): Promise<string>

Get the device's Universally Unique Identifier. The details of how a UUID is generated are determined by the device manufacturer and are specific to the device's platform or model. The UUIDs aof a device are not guaranteed to be the same over the lifetime of a device. Sometimes new IDs are generated on factory resets or depending

isScopedStorageEnabled(): Promise<boolean>

Checks wether scoped storage is enabled on Android. This is always the case from SDK Level 30. Retruns false on other platforms.

cordovaVersion(): Promise<string>

Returns the version of Cordova running on the device.

Http

Allows sending HTTP Get and Post requests.

get({ url, headers }: GetParams): Promise<HttpResponse<string>>

Sends a HTTP GET request to provided url containing provided headers. ResponseType is set to text.

getArrayBuffer({ url, headers }: GetArrayBufferParams): Promise<HttpResponse<ArrayBuffer>>

Same as get but ResponseType is ArrayBuffer.

getBlob({ url, headers }: GetBlobParams): Promise<HttpResponse<Blob>>

Same as get but ResponseType is Blob.

post({ url, headers, body }: PostParams): Promise<HttpResponse<string>>

Sends a HTTP POST request to provided url containing provided headers and body. Body has to be a string.

postArrayBuffer({ url, headers, data }: PostArrayBufferParams): Promise<HttpResponse<string>>

Same as post but data has to be an ArrayBuffer.

Logger

log(...message: unknown[]): Promise<void>

error(...message: unknown[]): Promise<void>

warn(...message: unknown[]): Promise<void>

info(...message: unknown[]): Promise<void>

debug(...message: unknown[]): Promise<void>

Use these to write logs to log files of MSB App. The log levels are set in MSB App settings.

Version Info

Provides build time meta data.

getVersionString(): Promise<string>

Returns MSB App version.

getBuildNumber(): Promise<number>

Returns MSB App build number.

getFullVersionString(): Promise<string>

Returns both version and build number in one string.

getDateString(): Promise<string>

Returns the date on which app was built. In ISO 8601 format.

getYearNumber(): Promise<number>

Returns the year in whcih app was built.

getSapVersion(): Promise<string>

Returns current MSB App version in SAP readable format. String length max 4.

isLocalBuild(): Promise<boolean>

Returns if the MSB App was build localy on a dev machine.

getOssLicenseURL(): Promise<string>

Returns the URL to Open Source Software Licenses.

NFC

Provides data from NFC tag scans.

startNfcCapture(captureDataHandler: (data: string) => void): Promise<void>

Provides scanned data to a handler. Handler is called on each new scan.

stopNfcCapture(): Promise<void>;

Stops data capturing.