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

@bytescale/sdk

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bytescale/sdk - npm Package Compare versions

Comparing version 3.11.0 to 3.12.0

dist/types/private/dtos/AuthSwConfigDto.d.ts

1

dist/types/private/ConsoleUtils.d.ts
export declare class ConsoleUtils {
static debug(message: string): void;
static warn(message: string): void;

@@ -3,0 +4,0 @@ static error(message: string): void;

@@ -21,2 +21,44 @@ import { BytescaleApiClientConfig } from "../../public/shared";

options?: Pick<BytescaleApiClientConfig, "fetchApi" | "cdnUrl">;
/**
* The Bytescale Auth Service Worker enables JWT-based auth for browsers that block third-party cookies.
*
* You must set this field if you need to support browsers that block third-party cookies (like Safari).
*
* This feature works by running a "service worker" in the background that adds "Authorization" and "Authorization-Token"
* request headers to HTTP requests made to the Bytescale CDN. This allows the Bytescale CDN to authorize requests
* to private files using JWTs issued by your application. Historically, these requests have been authorized using
* JWT cookies (i.e. JWTs sent to the Bytescale CDN via the "Cookies" header). However, modern browsers are starting
* to block these cookies, meaning "Authorization" request headers must be used instead. Authorization headers can
* only be added to requests originating from page elements like "<img>" elements through the use of service workers.
*
* Usage:
*
* 1. Create a JavaScript file that contains the following line:
*
* importScripts("https://js.bytescale.com/auth-sw/v1");
*
* 2. Host this JavaScript file from your website:
*
* 2a. It MUST be under the ROOT directory of your website.
* (e.g. "/bytescale-auth-sw.js")
*
* 2b. It MUST be on the SAME DOMAIN as your website.
* (e.g. "www.example.com" and not "assets.example.com")
*
* 3. Specify the absolute path to your JavaScript file in the 'beginAuthSession' call.
* (e.g. { ..., serviceWorkerScript: "/bytescale-auth-sw.js" })
*
* Examples:
*
* - CORRECT: "/bytescale-auth-sw.js"
* - INCORRECT: "bytescale-auth-sw.js"
* - INCORRECT: "/scripts/bytescale-auth-sw.js"
* - INCORRECT: "https://example.com/bytescale-auth-sw.js"
*
* Why does the script need to be hosted on the website's domain, under the root directory?:
*
* Service workers can only interact with events raised by pages at the same level or below them, hence why your
* script must be hosted on your website's domain in the root directory.
*/
serviceWorkerScript: string | undefined;
}

@@ -23,0 +65,0 @@ export interface AuthManagerInterface {

@@ -5,4 +5,5 @@ import { BeginAuthSessionParams } from "./AuthManagerInterface";

accessTokenRefreshHandle: number | undefined;
authServiceWorker: ServiceWorker | undefined;
isActive: boolean;
params: BeginAuthSessionParams;
}

@@ -15,4 +15,14 @@ import { AuthManagerInterface, BeginAuthSessionParams } from "../../private/model/AuthManagerInterface";

endAuthSession(): Promise<void>;
/**
* Idempotent.
*
* Only returns once the service worker has been activated.
*
* We don't need to unregister it: we just need to clear the config when auth ends.
*/
private registerAuthServiceWorker;
private refreshAccessToken;
private setServiceWorkerConfig;
private getAccessTokenUrl;
private getCdnUrl;
private deleteAccessToken;

@@ -19,0 +29,0 @@ private setAccessToken;

4

dist/types/public/shared/generated/runtime.d.ts

@@ -27,7 +27,7 @@ import { ErrorResponse } from "./models";

/**
* The base URL of the Bytescale API.
* The base URL of the Bytescale API. (Excludes trailing "/".)
*/
apiUrl?: string;
/**
* The base URL of the Bytescale CDN.
* The base URL of the Bytescale CDN. (Excludes trailing "/".)
*/

@@ -34,0 +34,0 @@ cdnUrl?: string;

{
"name": "@bytescale/sdk",
"version": "3.11.0",
"version": "3.12.0",
"description": "Bytescale JavaScript SDK",

@@ -70,3 +70,5 @@ "author": "Bytescale <hello@bytescale.com> (https://www.bytescale.com)",

"publish:createGitHubRelease": "gh release create v$(node -p \"require('./package.json').version\")",
"publish:cdn": "npm run prepack:cdn && aws s3 cp --recursive --content-type application/javascript dist/ s3://upload-js-releases/sdk/ && aws cloudfront create-invalidation --distribution-id E250290WAJ43YY --paths '/sdk/*'"
"publish:cdn": "npm run publish:cdn:sdk && npm run publish:cdn:authSw",
"publish:cdn:sdk": "npm run prepack:cdn && aws s3 cp --recursive --content-type text/javascript dist/ s3://upload-js-releases/sdk/ && aws cloudfront create-invalidation --distribution-id E250290WAJ43YY --paths '/sdk/*'",
"publish:cdn:authSw": "aws s3 cp --content-type text/javascript src/index.auth-sw.js s3://upload-js-releases/auth-sw/v1 && aws cloudfront create-invalidation --distribution-id E250290WAJ43YY --paths '/auth-sw/*'"
},

@@ -73,0 +75,0 @@ "husky": {

Sorry, the diff of this file is too big to display

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