Socket
Socket
Sign inDemoInstall

aws-crt

Package Overview
Dependencies
Maintainers
4
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-crt - npm Package Compare versions

Comparing version 1.12.2 to 1.12.3

dist.browser/common/aws_iot_shared.d.ts

32

dist.browser/browser/aws_iot.d.ts

@@ -32,2 +32,8 @@ /**

/**
* For API compatibility with the native version. Alias for {@link new_builder_for_websocket}.
*
* @returns a new websocket connection builder object with default TLS configuration
*/
static new_default_builder(): AwsIotMqttConnectionConfigBuilder;
/**
* Creates a new builder using MQTT over websockets (the only option in browser)

@@ -128,2 +134,28 @@ *

/**
* Sets the custom authorizer settings. This function will modify the username, port, and TLS options.
*
* @param username The username to use with the custom authorizer. If an empty string is passed, it will
* check to see if a username has already been set (via WithUsername function). If no
* username is set then no username will be passed with the MQTT connection.
* @param authorizerName The name of the custom authorizer. If an empty string is passed, then
* 'x-amz-customauthorizer-name' will not be added with the MQTT connection.
* @param authorizerSignature The signature of the custom authorizer. If an empty string is passed, then
* 'x-amz-customauthorizer-signature' will not be added with the MQTT connection.
* @param password The password to use with the custom authorizer. If null is passed, then no password will
* be set.
*/
with_custom_authorizer(username: string, authorizer_name: string, authorizer_signature: string, password: string): this;
/**
* Sets username for the connection
*
* @param username the username that will be passed with the MQTT connection
*/
with_username(username: string): this;
/**
* Sets password for the connection
*
* @param password the password that will be passed with the MQTT connection
*/
with_password(password: string): this;
/**
* Returns the configured MqttConnectionConfig

@@ -130,0 +162,0 @@ * @returns The configured MqttConnectionConfig

65

dist.browser/browser/aws_iot.js

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

var platform = __importStar(require("../common/platform"));
var iot_shared = __importStar(require("../common/aws_iot_shared"));
/**

@@ -53,3 +54,3 @@ * Builder functions to create a {@link MqttConnectionConfig} which can then be used to create

will: undefined,
username: "?SDK=BrowserJSv2&Version=" + platform.crt_version(),
username: '',
password: undefined,

@@ -84,2 +85,10 @@ websocket: {},

/**
* For API compatibility with the native version. Alias for {@link new_builder_for_websocket}.
*
* @returns a new websocket connection builder object with default TLS configuration
*/
AwsIotMqttConnectionConfigBuilder.new_default_builder = function () {
return AwsIotMqttConnectionConfigBuilder.new_builder_for_websocket();
};
/**
* Creates a new builder using MQTT over websockets (the only option in browser)

@@ -224,2 +233,43 @@ *

/**
* Sets the custom authorizer settings. This function will modify the username, port, and TLS options.
*
* @param username The username to use with the custom authorizer. If an empty string is passed, it will
* check to see if a username has already been set (via WithUsername function). If no
* username is set then no username will be passed with the MQTT connection.
* @param authorizerName The name of the custom authorizer. If an empty string is passed, then
* 'x-amz-customauthorizer-name' will not be added with the MQTT connection.
* @param authorizerSignature The signature of the custom authorizer. If an empty string is passed, then
* 'x-amz-customauthorizer-signature' will not be added with the MQTT connection.
* @param password The password to use with the custom authorizer. If null is passed, then no password will
* be set.
*/
AwsIotMqttConnectionConfigBuilder.prototype.with_custom_authorizer = function (username, authorizer_name, authorizer_signature, password) {
var username_string = iot_shared.populate_username_string_with_custom_authorizer("", username, authorizer_name, authorizer_signature, this.params.username);
this.params.username = username_string;
this.params.password = password;
// Tells the websocket connection we are using a custom authorizer
if (this.params.websocket) {
this.params.websocket.protocol = "wss-custom-auth";
}
return this;
};
/**
* Sets username for the connection
*
* @param username the username that will be passed with the MQTT connection
*/
AwsIotMqttConnectionConfigBuilder.prototype.with_username = function (username) {
this.params.username = username;
return this;
};
/**
* Sets password for the connection
*
* @param password the password that will be passed with the MQTT connection
*/
AwsIotMqttConnectionConfigBuilder.prototype.with_password = function (password) {
this.params.password = password;
return this;
};
/**
* Returns the configured MqttConnectionConfig

@@ -232,2 +282,15 @@ * @returns The configured MqttConnectionConfig

}
// Add the metrics string
if (this.params.username == undefined || this.params.username == null || this.params.username == "") {
this.params.username = "?SDK=NodeJSv2&Version=";
}
else {
if (this.params.username.indexOf("?") != -1) {
this.params.username += "&SDK=NodeJSv2&Version=";
}
else {
this.params.username += "?SDK=NodeJSv2&Version=";
}
}
this.params.username += platform.crt_version();
return this.params;

@@ -234,0 +297,0 @@ };

@@ -49,2 +49,3 @@ /**

private params;
private is_using_custom_authorizer;
private constructor();

@@ -79,2 +80,6 @@ /**

static new_mtls_windows_cert_store_path_builder(certificate_path: string): AwsIotMqttConnectionConfigBuilder;
/**
* Creates a new builder with default Tls options. This requires setting the connection details manually.
*/
static new_default_builder(): AwsIotMqttConnectionConfigBuilder;
static new_websocket_builder(...args: any[]): AwsIotMqttConnectionConfigBuilder;

@@ -163,2 +168,28 @@ private static configure_websocket_handshake;

/**
* Sets the custom authorizer settings. This function will modify the username, port, and TLS options.
*
* @param username The username to use with the custom authorizer. If an empty string is passed, it will
* check to see if a username has already been set (via WithUsername function). If no
* username is set then no username will be passed with the MQTT connection.
* @param authorizerName The name of the custom authorizer. If an empty string is passed, then
* 'x-amz-customauthorizer-name' will not be added with the MQTT connection.
* @param authorizerSignature The signature of the custom authorizer. If an empty string is passed, then
* 'x-amz-customauthorizer-signature' will not be added with the MQTT connection.
* @param password The password to use with the custom authorizer. If null is passed, then no password will
* be set.
*/
with_custom_authorizer(username: string, authorizer_name: string, authorizer_signature: string, password: string): this;
/**
* Sets username for the connection
*
* @param username the username that will be passed with the MQTT connection
*/
with_username(username: string): this;
/**
* Sets password for the connection
*
* @param password the password that will be passed with the MQTT connection
*/
with_password(password: string): this;
/**
* Returns the configured MqttConnectionConfig. On the first invocation of this function, the TLS context is cached

@@ -165,0 +196,0 @@ * and re-used on all subsequent calls to build().

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

const auth_1 = require("./auth");
const iot_shared = __importStar(require("../common/aws_iot_shared"));
/**

@@ -59,6 +60,7 @@ * Builder functions to create a {@link MqttConnectionConfig} which can then be used to create

will: undefined,
username: `?SDK=NodeJSv2&Version=${platform.crt_version()}`,
username: "",
password: undefined,
tls_ctx: undefined,
};
this.is_using_custom_authorizer = false;
}

@@ -121,2 +123,10 @@ /**

}
/**
* Creates a new builder with default Tls options. This requires setting the connection details manually.
*/
static new_default_builder() {
let ctx_options = new io.TlsContextOptions();
let builder = new AwsIotMqttConnectionConfigBuilder(ctx_options);
return builder;
}
static new_websocket_builder(...args) {

@@ -289,2 +299,42 @@ return this.new_with_websockets(...args);

/**
* Sets the custom authorizer settings. This function will modify the username, port, and TLS options.
*
* @param username The username to use with the custom authorizer. If an empty string is passed, it will
* check to see if a username has already been set (via WithUsername function). If no
* username is set then no username will be passed with the MQTT connection.
* @param authorizerName The name of the custom authorizer. If an empty string is passed, then
* 'x-amz-customauthorizer-name' will not be added with the MQTT connection.
* @param authorizerSignature The signature of the custom authorizer. If an empty string is passed, then
* 'x-amz-customauthorizer-signature' will not be added with the MQTT connection.
* @param password The password to use with the custom authorizer. If null is passed, then no password will
* be set.
*/
with_custom_authorizer(username, authorizer_name, authorizer_signature, password) {
this.is_using_custom_authorizer = true;
let username_string = iot_shared.populate_username_string_with_custom_authorizer("", username, authorizer_name, authorizer_signature, this.params.username);
this.params.username = username_string;
this.params.password = password;
this.tls_ctx_options.alpn_list = ["mqtt"];
this.params.port = 443;
return this;
}
/**
* Sets username for the connection
*
* @param username the username that will be passed with the MQTT connection
*/
with_username(username) {
this.params.username = username;
return this;
}
/**
* Sets password for the connection
*
* @param password the password that will be passed with the MQTT connection
*/
with_password(password) {
this.params.password = password;
return this;
}
/**
* Returns the configured MqttConnectionConfig. On the first invocation of this function, the TLS context is cached

@@ -295,5 +345,23 @@ * and re-used on all subsequent calls to build().

build() {
var _a, _b, _c;
if (this.params.client_id === undefined || this.params.host_name === undefined) {
throw 'client_id and endpoint are required';
}
// Check to see if a custom authorizer is being used but not through the builder
if (this.is_using_custom_authorizer == false) {
if (iot_shared.is_string_and_not_empty(this.params.username)) {
if (((_a = this.params.username) === null || _a === void 0 ? void 0 : _a.indexOf("x-amz-customauthorizer-name=")) != -1 || ((_b = this.params.username) === null || _b === void 0 ? void 0 : _b.indexOf("x-amz-customauthorizer-signature=")) != -1) {
this.is_using_custom_authorizer = true;
}
}
}
// Is the user trying to connect using a custom authorizer?
if (this.is_using_custom_authorizer == true) {
if (this.params.port != 443) {
console.log("Warning: Attempting to connect to authorizer with unsupported port. Port is not 443...");
}
if (this.tls_ctx_options.alpn_list != ["mqtt"]) {
this.tls_ctx_options.alpn_list = ["mqtt"];
}
}
/*

@@ -308,2 +376,15 @@ * By caching and reusing the TLS context we get an enormous memory savings on a per-connection basis.

}
// Add the metrics string
if (iot_shared.is_string_and_not_empty(this.params.username) == false) {
this.params.username = "?SDK=NodeJSv2&Version=";
}
else {
if (((_c = this.params.username) === null || _c === void 0 ? void 0 : _c.indexOf("?")) != -1) {
this.params.username += "&SDK=NodeJSv2&Version=";
}
else {
this.params.username += "?SDK=NodeJSv2&Version=";
}
}
this.params.username += platform.crt_version();
return this.params;

@@ -310,0 +391,0 @@ }

2

package.json
{
"name": "aws-crt",
"version": "1.12.2",
"version": "1.12.3",
"description": "NodeJS/browser bindings to the aws-c-* libraries",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/awslabs/aws-crt-nodejs",

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

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