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 1.3.0 to 2.0.0

12

CHANGELOG.md
# @turnkey/http
## 2.0.0
### Major Changes
- Synced protos from mono
### Upgrade notes
- `signRawPayload` and `signTransaction` now expect a `signWith` param instead of `privateKeyId` previously
- `signRawPayload` and `signTransaction` have been updated to expect a new type: `ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2` and `ACTIVITY_TYPE_SIGN_TRANSACTION_V2`, respectively
- If you have policies authorizing `ACTIVITY_TYPE_SIGN_RAW_PAYLOAD` or `ACTIVITY_TYPE_SIGN_TRANSACTION` specifically, they will need to be updated to authorize `ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2` and `ACTIVITY_TYPE_SIGN_TRANSACTION_V2` (or better yet, update your policies to allow all signing actions categorically using policy resources and actions. See https://docs.turnkey.com/managing-policies/examples)
## 1.3.0

@@ -4,0 +16,0 @@

72

dist/__generated__/services/coordinator/public/v1/public_api.client.d.ts

@@ -32,3 +32,5 @@ import { THttpConfig, TSignedRequest, TStamper } from "../../../../../base";

import type { TExportPrivateKeyBody, TExportPrivateKeyResponse } from "./public_api.fetcher";
import type { TExportWalletBody, TExportWalletResponse } from "./public_api.fetcher";
import type { TInitUserEmailRecoveryBody, TInitUserEmailRecoveryResponse } from "./public_api.fetcher";
import type { TRecoverUserBody, TRecoverUserResponse } from "./public_api.fetcher";
import type { TRejectActivityBody, TRejectActivityResponse } from "./public_api.fetcher";

@@ -38,5 +40,3 @@ import type { TRemoveOrganizationFeatureBody, TRemoveOrganizationFeatureResponse } from "./public_api.fetcher";

import type { TSignRawPayloadBody, TSignRawPayloadResponse } from "./public_api.fetcher";
import type { TSignRawPayloadV2Body, TSignRawPayloadV2Response } from "./public_api.fetcher";
import type { TSignTransactionBody, TSignTransactionResponse } from "./public_api.fetcher";
import type { TSignTransactionV2Body, TSignTransactionV2Response } from "./public_api.fetcher";
import type { TUpdateAllowedOriginsBody, TUpdateAllowedOriginsResponse } from "./public_api.fetcher";

@@ -376,3 +376,3 @@ import type { TUpdatePolicyBody, TUpdatePolicyResponse } from "./public_api.fetcher";

/**
* Create a Wallet
* Create a Wallet and derive addresses
*

@@ -391,3 +391,3 @@ * Sign the provided `TCreateWalletBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/create_wallet).

/**
* Create Wallet accounts
* Derive additional addresses using an existing wallet
*

@@ -436,3 +436,3 @@ * Sign the provided `TCreateWalletAccountsBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/create_wallet_accounts).

*
* Sign the provided `TDeleteInvitationBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/delete_invitations).
* Sign the provided `TDeleteInvitationBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/delete_invitation).
*

@@ -477,4 +477,18 @@ * See also {@link stampDeleteInvitation}.

/**
* Initializes a new recovery
* Exports a Wallet
*
* Sign the provided `TExportWalletBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/export_wallet).
*
* See also {@link stampExportWallet}.
*/
exportWallet: (input: TExportWalletBody) => Promise<TExportWalletResponse>;
/**
* Produce a `SignedRequest` from `TExportWalletBody` by using the client's `stamp` function.
*
* See also {@link ExportWallet}.
*/
stampExportWallet: (input: TExportWalletBody) => Promise<TSignedRequest>;
/**
* Initializes a new email recovery
*
* Sign the provided `TInitUserEmailRecoveryBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/init_user_email_recovery).

@@ -492,2 +506,16 @@ *

/**
* Completes the process of recovering a user by adding an authenticator
*
* Sign the provided `TRecoverUserBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/recover_user).
*
* See also {@link stampRecoverUser}.
*/
recoverUser: (input: TRecoverUserBody) => Promise<TRecoverUserResponse>;
/**
* Produce a `SignedRequest` from `TRecoverUserBody` by using the client's `stamp` function.
*
* See also {@link RecoverUser}.
*/
stampRecoverUser: (input: TRecoverUserBody) => Promise<TSignedRequest>;
/**
* Reject an Activity

@@ -535,3 +563,3 @@ *

/**
* Sign a raw payload with a Private Key
* Sign a raw payload
*

@@ -550,18 +578,4 @@ * Sign the provided `TSignRawPayloadBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/sign_raw_payload).

/**
* Sign a raw payload with a Private Key id or address
* Sign a transaction
*
* Sign the provided `TSignRawPayloadV2Body` with the client's `stamp` function, and submit the request (POST /public/v1/submit/sign_raw_payload_v2).
*
* See also {@link stampSignRawPayloadV2}.
*/
signRawPayloadV2: (input: TSignRawPayloadV2Body) => Promise<TSignRawPayloadV2Response>;
/**
* Produce a `SignedRequest` from `TSignRawPayloadV2Body` by using the client's `stamp` function.
*
* See also {@link SignRawPayloadV2}.
*/
stampSignRawPayloadV2: (input: TSignRawPayloadV2Body) => Promise<TSignedRequest>;
/**
* Sign a transaction with a Private Key
*
* Sign the provided `TSignTransactionBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/sign_transaction).

@@ -579,16 +593,2 @@ *

/**
* Sign a transaction with a Private Key id or address
*
* Sign the provided `TSignTransactionV2Body` with the client's `stamp` function, and submit the request (POST /public/v1/submit/sign_transaction_v2).
*
* See also {@link stampSignTransactionV2}.
*/
signTransactionV2: (input: TSignTransactionV2Body) => Promise<TSignTransactionV2Response>;
/**
* Produce a `SignedRequest` from `TSignTransactionV2Body` by using the client's `stamp` function.
*
* See also {@link SignTransactionV2}.
*/
stampSignTransactionV2: (input: TSignTransactionV2Body) => Promise<TSignedRequest>;
/**
* Update the allowable origins for credentials and requests

@@ -595,0 +595,0 @@ *

@@ -584,3 +584,3 @@ "use strict";

/**
* Create a Wallet
* Create a Wallet and derive addresses
*

@@ -610,3 +610,3 @@ * Sign the provided `TCreateWalletBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/create_wallet).

/**
* Create Wallet accounts
* Derive additional addresses using an existing wallet
*

@@ -688,3 +688,3 @@ * Sign the provided `TCreateWalletAccountsBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/create_wallet_accounts).

*
* Sign the provided `TDeleteInvitationBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/delete_invitations).
* Sign the provided `TDeleteInvitationBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/delete_invitation).
*

@@ -694,3 +694,3 @@ * See also {@link stampDeleteInvitation}.

this.deleteInvitation = async (input) => {
return this.request("/public/v1/submit/delete_invitations", input);
return this.request("/public/v1/submit/delete_invitation", input);
};

@@ -703,3 +703,3 @@ /**

this.stampDeleteInvitation = async (input) => {
const fullUrl = this.config.baseUrl + "/public/v1/submit/delete_invitations";
const fullUrl = this.config.baseUrl + "/public/v1/submit/delete_invitation";
const body = JSON.stringify(input);

@@ -764,4 +764,29 @@ const stamp = await this.stamper.stamp(body);

/**
* Initializes a new recovery
* Exports a Wallet
*
* Sign the provided `TExportWalletBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/export_wallet).
*
* See also {@link stampExportWallet}.
*/
this.exportWallet = async (input) => {
return this.request("/public/v1/submit/export_wallet", input);
};
/**
* Produce a `SignedRequest` from `TExportWalletBody` by using the client's `stamp` function.
*
* See also {@link ExportWallet}.
*/
this.stampExportWallet = async (input) => {
const fullUrl = this.config.baseUrl + "/public/v1/submit/export_wallet";
const body = JSON.stringify(input);
const stamp = await this.stamper.stamp(body);
return {
body: body,
stamp: stamp,
url: fullUrl,
};
};
/**
* Initializes a new email recovery
*
* Sign the provided `TInitUserEmailRecoveryBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/init_user_email_recovery).

@@ -790,2 +815,27 @@ *

/**
* Completes the process of recovering a user by adding an authenticator
*
* Sign the provided `TRecoverUserBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/recover_user).
*
* See also {@link stampRecoverUser}.
*/
this.recoverUser = async (input) => {
return this.request("/public/v1/submit/recover_user", input);
};
/**
* Produce a `SignedRequest` from `TRecoverUserBody` by using the client's `stamp` function.
*
* See also {@link RecoverUser}.
*/
this.stampRecoverUser = async (input) => {
const fullUrl = this.config.baseUrl + "/public/v1/submit/recover_user";
const body = JSON.stringify(input);
const stamp = await this.stamper.stamp(body);
return {
body: body,
stamp: stamp,
url: fullUrl,
};
};
/**
* Reject an Activity

@@ -866,3 +916,3 @@ *

/**
* Sign a raw payload with a Private Key
* Sign a raw payload
*

@@ -892,29 +942,4 @@ * Sign the provided `TSignRawPayloadBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/sign_raw_payload).

/**
* Sign a raw payload with a Private Key id or address
* Sign a transaction
*
* Sign the provided `TSignRawPayloadV2Body` with the client's `stamp` function, and submit the request (POST /public/v1/submit/sign_raw_payload_v2).
*
* See also {@link stampSignRawPayloadV2}.
*/
this.signRawPayloadV2 = async (input) => {
return this.request("/public/v1/submit/sign_raw_payload_v2", input);
};
/**
* Produce a `SignedRequest` from `TSignRawPayloadV2Body` by using the client's `stamp` function.
*
* See also {@link SignRawPayloadV2}.
*/
this.stampSignRawPayloadV2 = async (input) => {
const fullUrl = this.config.baseUrl + "/public/v1/submit/sign_raw_payload_v2";
const body = JSON.stringify(input);
const stamp = await this.stamper.stamp(body);
return {
body: body,
stamp: stamp,
url: fullUrl,
};
};
/**
* Sign a transaction with a Private Key
*
* Sign the provided `TSignTransactionBody` with the client's `stamp` function, and submit the request (POST /public/v1/submit/sign_transaction).

@@ -943,27 +968,2 @@ *

/**
* Sign a transaction with a Private Key id or address
*
* Sign the provided `TSignTransactionV2Body` with the client's `stamp` function, and submit the request (POST /public/v1/submit/sign_transaction_v2).
*
* See also {@link stampSignTransactionV2}.
*/
this.signTransactionV2 = async (input) => {
return this.request("/public/v1/submit/sign_transaction_v2", input);
};
/**
* Produce a `SignedRequest` from `TSignTransactionV2Body` by using the client's `stamp` function.
*
* See also {@link SignTransactionV2}.
*/
this.stampSignTransactionV2 = async (input) => {
const fullUrl = this.config.baseUrl + "/public/v1/submit/sign_transaction_v2";
const body = JSON.stringify(input);
const stamp = await this.stamper.stamp(body);
return {
body: body,
stamp: stamp,
url: fullUrl,
};
};
/**
* Update the allowable origins for credentials and requests

@@ -970,0 +970,0 @@ *

@@ -5,3 +5,3 @@ "use strict";

exports.signCreateWalletAccounts = exports.createWalletAccounts = exports.signCreateWallet = exports.createWallet = exports.signCreateUsers = exports.createUsers = exports.signCreateUserTag = exports.createUserTag = exports.signCreateSubOrganization = exports.createSubOrganization = exports.signCreatePrivateKeys = exports.createPrivateKeys = exports.signCreatePrivateKeyTag = exports.createPrivateKeyTag = exports.signCreatePolicy = exports.createPolicy = exports.signCreateInvitations = exports.createInvitations = exports.signCreateAuthenticators = exports.createAuthenticators = exports.signCreateApiOnlyUsers = exports.createApiOnlyUsers = exports.signCreateApiKeys = exports.createApiKeys = exports.signApproveActivity = exports.approveActivity = exports.signGetWhoami = exports.getWhoami = exports.signGetUsers = exports.getUsers = exports.signGetPrivateKeys = exports.getPrivateKeys = exports.signGetPolicies = exports.getPolicies = exports.signGetActivities = exports.getActivities = exports.signGetUser = exports.getUser = exports.signGetPrivateKey = exports.getPrivateKey = exports.signGetPolicy = exports.getPolicy = exports.signGetOrganization = exports.getOrganization = exports.signGetAuthenticators = exports.getAuthenticators = exports.signGetAuthenticator = exports.getAuthenticator = exports.signGetActivity = exports.getActivity = void 0;
exports.signNOOPCodegenAnchor = exports.nOOPCodegenAnchor = exports.signUpdateUserTag = exports.updateUserTag = exports.signUpdateUser = exports.updateUser = exports.signUpdateRootQuorum = exports.updateRootQuorum = exports.signUpdatePrivateKeyTag = exports.updatePrivateKeyTag = exports.signUpdatePolicy = exports.updatePolicy = exports.signUpdateAllowedOrigins = exports.updateAllowedOrigins = exports.signSignTransactionV2 = exports.signTransactionV2 = exports.signSignTransaction = exports.signTransaction = exports.signSignRawPayloadV2 = exports.signRawPayloadV2 = exports.signSignRawPayload = exports.signRawPayload = exports.signSetOrganizationFeature = exports.setOrganizationFeature = exports.signRemoveOrganizationFeature = exports.removeOrganizationFeature = exports.signRejectActivity = exports.rejectActivity = exports.signInitUserEmailRecovery = exports.initUserEmailRecovery = exports.signExportPrivateKey = exports.exportPrivateKey = exports.signDeletePolicy = exports.deletePolicy = exports.signDeleteInvitation = exports.deleteInvitation = exports.signDeleteAuthenticators = exports.deleteAuthenticators = exports.signDeleteApiKeys = exports.deleteApiKeys = void 0;
exports.signNOOPCodegenAnchor = exports.nOOPCodegenAnchor = exports.signUpdateUserTag = exports.updateUserTag = exports.signUpdateUser = exports.updateUser = exports.signUpdateRootQuorum = exports.updateRootQuorum = exports.signUpdatePrivateKeyTag = exports.updatePrivateKeyTag = exports.signUpdatePolicy = exports.updatePolicy = exports.signUpdateAllowedOrigins = exports.updateAllowedOrigins = exports.signSignTransaction = exports.signTransaction = exports.signSignRawPayload = exports.signRawPayload = exports.signSetOrganizationFeature = exports.setOrganizationFeature = exports.signRemoveOrganizationFeature = exports.removeOrganizationFeature = exports.signRejectActivity = exports.rejectActivity = exports.signRecoverUser = exports.recoverUser = exports.signInitUserEmailRecovery = exports.initUserEmailRecovery = exports.signExportWallet = exports.exportWallet = exports.signExportPrivateKey = exports.exportPrivateKey = exports.signDeletePolicy = exports.deletePolicy = exports.signDeleteInvitation = exports.deleteInvitation = exports.signDeleteAuthenticators = exports.deleteAuthenticators = exports.signDeleteApiKeys = exports.deleteApiKeys = void 0;
const base_1 = require("../../../../../base");

@@ -563,3 +563,3 @@ /**

*
* Create a Wallet
* Create a Wallet and derive addresses
*

@@ -586,5 +586,5 @@ * `POST /public/v1/submit/create_wallet`

/**
* Create Wallet accounts
* Create Wallet Accounts
*
* Create Wallet accounts
* Derive additional addresses using an existing wallet
*

@@ -663,6 +663,6 @@ * `POST /public/v1/submit/create_wallet_accounts`

*
* `POST /public/v1/submit/delete_invitations`
* `POST /public/v1/submit/delete_invitation`
*/
const deleteInvitation = (input) => (0, base_1.request)({
uri: "/public/v1/submit/delete_invitations",
uri: "/public/v1/submit/delete_invitation",
method: "POST",

@@ -678,3 +678,3 @@ body: input.body,

const signDeleteInvitation = (input, options) => (0, base_1.signedRequest)({
uri: "/public/v1/submit/delete_invitations",
uri: "/public/v1/submit/delete_invitation",
body: input.body,

@@ -733,6 +733,30 @@ options,

/**
* Init Recovery
* Export Wallet
*
* Initializes a new recovery
* Exports a Wallet
*
* `POST /public/v1/submit/export_wallet`
*/
const exportWallet = (input) => (0, base_1.request)({
uri: "/public/v1/submit/export_wallet",
method: "POST",
body: input.body,
});
exports.exportWallet = exportWallet;
/**
* Request a WebAuthn assertion and return a signed `ExportWallet` request, ready to be POSTed to Turnkey.
*
* See {@link ExportWallet}
*/
const signExportWallet = (input, options) => (0, base_1.signedRequest)({
uri: "/public/v1/submit/export_wallet",
body: input.body,
options,
});
exports.signExportWallet = signExportWallet;
/**
* Init Email Recovery
*
* Initializes a new email recovery
*
* `POST /public/v1/submit/init_user_email_recovery`

@@ -758,2 +782,26 @@ */

/**
* Recover a user
*
* Completes the process of recovering a user by adding an authenticator
*
* `POST /public/v1/submit/recover_user`
*/
const recoverUser = (input) => (0, base_1.request)({
uri: "/public/v1/submit/recover_user",
method: "POST",
body: input.body,
});
exports.recoverUser = recoverUser;
/**
* Request a WebAuthn assertion and return a signed `RecoverUser` request, ready to be POSTed to Turnkey.
*
* See {@link RecoverUser}
*/
const signRecoverUser = (input, options) => (0, base_1.signedRequest)({
uri: "/public/v1/submit/recover_user",
body: input.body,
options,
});
exports.signRecoverUser = signRecoverUser;
/**
* Reject Activity

@@ -833,3 +881,3 @@ *

*
* Sign a raw payload with a Private Key
* Sign a raw payload
*

@@ -856,29 +904,5 @@ * `POST /public/v1/submit/sign_raw_payload`

/**
* Sign Raw Payload
*
* Sign a raw payload with a Private Key id or address
*
* `POST /public/v1/submit/sign_raw_payload_v2`
*/
const signRawPayloadV2 = (input) => (0, base_1.request)({
uri: "/public/v1/submit/sign_raw_payload_v2",
method: "POST",
body: input.body,
});
exports.signRawPayloadV2 = signRawPayloadV2;
/**
* Request a WebAuthn assertion and return a signed `SignRawPayloadV2` request, ready to be POSTed to Turnkey.
*
* See {@link SignRawPayloadV2}
*/
const signSignRawPayloadV2 = (input, options) => (0, base_1.signedRequest)({
uri: "/public/v1/submit/sign_raw_payload_v2",
body: input.body,
options,
});
exports.signSignRawPayloadV2 = signSignRawPayloadV2;
/**
* Sign Transaction
*
* Sign a transaction with a Private Key
* Sign a transaction
*

@@ -905,26 +929,2 @@ * `POST /public/v1/submit/sign_transaction`

/**
* Sign Transaction
*
* Sign a transaction with a Private Key id or address
*
* `POST /public/v1/submit/sign_transaction_v2`
*/
const signTransactionV2 = (input) => (0, base_1.request)({
uri: "/public/v1/submit/sign_transaction_v2",
method: "POST",
body: input.body,
});
exports.signTransactionV2 = signTransactionV2;
/**
* Request a WebAuthn assertion and return a signed `SignTransactionV2` request, ready to be POSTed to Turnkey.
*
* See {@link SignTransactionV2}
*/
const signSignTransactionV2 = (input, options) => (0, base_1.signedRequest)({
uri: "/public/v1/submit/sign_transaction_v2",
body: input.body,
options,
});
exports.signSignTransactionV2 = signSignTransactionV2;
/**
* Update Allowable Origins

@@ -931,0 +931,0 @@ *

@@ -65,2 +65,6 @@ "use strict";

async function getWebAuthnAssertion(payload, options) {
const webAuthnSupported = hasWebAuthnSupport();
if (!webAuthnSupported) {
throw new Error("webauthn is not supported by this browser");
}
const signingOptions = await getCredentialRequestOptions(payload, options);

@@ -79,2 +83,6 @@ const clientGetResult = await (0, webauthn_json_1.get)(signingOptions);

async function getWebAuthnAttestation(options) {
const webAuthnSupported = hasWebAuthnSupport();
if (!webAuthnSupported) {
throw new Error("webauthn is not supported by this browser");
}
const res = await (0, webauthn_json_1.create)(options);

@@ -84,2 +92,8 @@ return toInternalAttestation(res.toJSON());

exports.getWebAuthnAttestation = getWebAuthnAttestation;
// `hasWebAuthnSupport` checks for barebones webauthn support.
// For additional details and granular settings, see:
// https://web.dev/articles/passkey-form-autofill#feature-detection, https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredential
function hasWebAuthnSupport() {
return !!window.PublicKeyCredential;
}
//# sourceMappingURL=webauthn.js.map
{
"name": "@turnkey/http",
"version": "1.3.0",
"version": "2.0.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 too big to display

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

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

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