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

@turnkey/http

Package Overview
Dependencies
Maintainers
4
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turnkey/http - npm Package Compare versions

Comparing version 0.14.0 to 0.15.0

4

./dist/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PublicApiService = exports.TurnkeyApi = exports.withAsyncPolling = exports.TurnkeyRequestError = exports.TurnkeyActivityError = exports.init = void 0;
exports.sealAndStampRequestBody = exports.PublicApiService = exports.TurnkeyApi = exports.withAsyncPolling = exports.TurnkeyRequestError = exports.TurnkeyActivityError = exports.init = void 0;
const barrel_1 = require("./__generated__/barrel");

@@ -18,2 +18,4 @@ Object.defineProperty(exports, "TurnkeyApi", { enumerable: true, get: function () { return barrel_1.PublicApiService; } });

exports.PublicApiService = PublicApiService;
var base_1 = require("./base");
Object.defineProperty(exports, "sealAndStampRequestBody", { enumerable: true, get: function () { return base_1.sealAndStampRequestBody; } });
//# sourceMappingURL=index.js.map
# @turnkey/http
## 0.15.0
### Minor Changes
- Export a new helper for offline request signing: `sealAndStampRequestBody(...)`.
## 0.14.0

@@ -4,0 +10,0 @@

@@ -14,4 +14,18 @@ type TBasicType = string;

}): Promise<ResponseData>;
export declare function stableStringify(input: Record<string, any>): string;
/**
* Seals and stamps the request body with your Turnkey API credentials.
*
* You can either:
* - Before calling `sealAndStampRequestBody(...)`, initialize with your Turnkey API credentials via `init(...)`
* - Or, provide `apiPublicKey` and `apiPrivateKey` here as arguments
*/
export declare function sealAndStampRequestBody(input: {
body: Record<string, any>;
apiPublicKey?: string;
apiPrivateKey?: string;
}): Promise<{
sealedBody: string;
xStamp: string;
}>;
export {};
//# sourceMappingURL=base.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stableStringify = exports.request = void 0;
exports.sealAndStampRequestBody = exports.request = void 0;
const universal_1 = require("./universal");

@@ -14,3 +14,2 @@ const config_1 = require("./config");

const { uri: inputUri, method, headers: inputHeaders = {}, query: inputQuery = {}, substitution: inputSubstitution = {}, body: inputBody = {}, } = input;
const { apiPublicKey, apiPrivateKey } = (0, config_1.getConfig)();
const url = constructUrl({

@@ -21,9 +20,5 @@ uri: inputUri,

});
const sealedBody = stableStringify(inputBody);
const sealedStamp = stableStringify(await (0, universal_1.stamp)({
content: sealedBody,
privateKey: apiPrivateKey,
publicKey: apiPublicKey,
}));
const xStamp = (0, encoding_1.stringToBase64urlString)(sealedStamp);
const { sealedBody, xStamp } = await sealAndStampRequestBody({
body: inputBody,
});
const response = await (0, universal_1.fetch)(url.toString(), {

@@ -91,3 +86,33 @@ ...sharedRequestOptions,

}
exports.stableStringify = stableStringify;
/**
* Seals and stamps the request body with your Turnkey API credentials.
*
* You can either:
* - Before calling `sealAndStampRequestBody(...)`, initialize with your Turnkey API credentials via `init(...)`
* - Or, provide `apiPublicKey` and `apiPrivateKey` here as arguments
*/
async function sealAndStampRequestBody(input) {
const { body } = input;
let { apiPublicKey, apiPrivateKey } = input;
if (!apiPublicKey) {
const config = (0, config_1.getConfig)();
apiPublicKey = config.apiPublicKey;
}
if (!apiPrivateKey) {
const config = (0, config_1.getConfig)();
apiPrivateKey = config.apiPrivateKey;
}
const sealedBody = stableStringify(body);
const sealedStamp = stableStringify(await (0, universal_1.stamp)({
content: sealedBody,
privateKey: apiPrivateKey,
publicKey: apiPublicKey,
}));
const xStamp = (0, encoding_1.stringToBase64urlString)(sealedStamp);
return {
sealedBody,
xStamp,
};
}
exports.sealAndStampRequestBody = sealAndStampRequestBody;
//# sourceMappingURL=base.js.map

@@ -11,2 +11,3 @@ import { PublicApiService as TurnkeyApi } from "./__generated__/barrel";

export { PublicApiService };
export { sealAndStampRequestBody } from "./base";
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PublicApiService = exports.TurnkeyApi = exports.withAsyncPolling = exports.TurnkeyRequestError = exports.TurnkeyActivityError = exports.init = void 0;
exports.sealAndStampRequestBody = exports.PublicApiService = exports.TurnkeyApi = exports.withAsyncPolling = exports.TurnkeyRequestError = exports.TurnkeyActivityError = exports.init = void 0;
const barrel_1 = require("./__generated__/barrel");

@@ -18,2 +18,4 @@ Object.defineProperty(exports, "TurnkeyApi", { enumerable: true, get: function () { return barrel_1.PublicApiService; } });

exports.PublicApiService = PublicApiService;
var base_1 = require("./base");
Object.defineProperty(exports, "sealAndStampRequestBody", { enumerable: true, get: function () { return base_1.sealAndStampRequestBody; } });
//# sourceMappingURL=index.js.map
{
"name": "@turnkey/http",
"version": "0.14.0",
"version": "0.15.0",
"main": "./dist/index.js",

@@ -5,0 +5,0 @@ "types": "./dist/index.d.ts",

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