@byteark/passport-clearkey-web-sdk
v0.2.6
Published
Passport ClearKey Web SDK — cookie-based auth loader for HLS ClearKey playback
Keywords
Readme
@byteark/passport-clearkey-web-sdk
Lightweight loader for the Passport ClearKey Web SDK for HLS ClearKey playback. The package dynamically injects the hosted SDK script at runtime.
Install
npm install @byteark/passport-clearkey-web-sdkUsage
import { loadPassportWebSDK } from '@byteark/passport-clearkey-web-sdk';
const sdk = await loadPassportWebSDK();
// Initialize authentication
const result = await sdk.initAuth(jwt, keyServerBaseUrl);
// Get the XHR setup function for hls.js
const xhrSetup = sdk.getXhrSetup();Pure / side-effect-free import
If you want to control exactly when the script loads (no automatic injection on import):
import { loadPassportWebSDK } from '@byteark/passport-clearkey-web-sdk/pure';
const sdk = await loadPassportWebSDK();API
loadCookieSDK(): Promise<CookieSDK | null>
Returns the CookieSDK instance after loading the hosted script. Resolves to null in server-side environments.
CookieSDK
| Method | Description |
|---|---|
| initAuth(jwt, keyServerBaseUrl) | Initialize cookie-based auth session |
| renewSession() | Renew the current session |
| getXhrSetup() | Returns an XHR setup function for hls.js xhrSetup config |
| destroy() | Clean up the SDK instance |
License
UNLICENSED
