@turnkey/http
Advanced tools
Comparing version 0.17.1 to 0.18.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sealAndStampRequestBody = exports.PublicApiService = exports.TurnkeyApi = exports.withAsyncPolling = exports.TurnkeyRequestError = exports.TurnkeyActivityError = exports.init = void 0; | ||
exports.sealAndStampRequestBody = exports.PublicApiService = exports.TurnkeyApi = exports.withAsyncPolling = exports.getWebAuthnAttestation = exports.TurnkeyRequestError = exports.TurnkeyActivityError = exports.browserInit = exports.init = void 0; | ||
const barrel_1 = require("./__generated__/barrel"); | ||
@@ -8,5 +8,8 @@ Object.defineProperty(exports, "TurnkeyApi", { enumerable: true, get: function () { return barrel_1.PublicApiService; } }); | ||
Object.defineProperty(exports, "init", { enumerable: true, get: function () { return config_1.init; } }); | ||
Object.defineProperty(exports, "browserInit", { enumerable: true, get: function () { return config_1.browserInit; } }); | ||
var shared_1 = require("./shared"); | ||
Object.defineProperty(exports, "TurnkeyActivityError", { enumerable: true, get: function () { return shared_1.TurnkeyActivityError; } }); | ||
Object.defineProperty(exports, "TurnkeyRequestError", { enumerable: true, get: function () { return shared_1.TurnkeyRequestError; } }); | ||
var webauthn_1 = require("./webauthn"); | ||
Object.defineProperty(exports, "getWebAuthnAttestation", { enumerable: true, get: function () { return webauthn_1.getWebAuthnAttestation; } }); | ||
var async_1 = require("./async"); | ||
@@ -13,0 +16,0 @@ Object.defineProperty(exports, "withAsyncPolling", { enumerable: true, get: function () { return async_1.withAsyncPolling; } }); |
# @turnkey/http | ||
## 0.18.0 | ||
### Minor Changes | ||
- Add support for federated requests (an example is included under `sdk/examples/with-federated-passkeys`) | ||
- Routine re-sync protos from mono | ||
## 0.17.1 | ||
@@ -4,0 +11,0 @@ |
"use strict"; | ||
/* @generated by `@turnkey/fetchers`. DO NOT EDIT BY HAND */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.postGetPrivateKeyBackwardsCompat = exports.postUpdateUserTag = exports.postUpdatePrivateKeyTag = exports.postSignTransaction = exports.postSignRawPayload = exports.postRejectActivity = exports.postDeletePolicy = exports.postDeleteInvitation = exports.postDeleteApiKeys = exports.postCreateUsers = exports.postCreatePrivateKeys = exports.postCreatePolicy = exports.postCreateInvitations = exports.postCreateAuthenticators = exports.postCreateApiOnlyUsers = exports.postCreateApiKeys = exports.postApproveActivity = exports.postGetWhoami = exports.postGetUsers = exports.postGetPrivateKeys = exports.postGetPolicies = exports.postGetActivities = exports.postGetUser = exports.postGetPrivateKey = exports.postGetPolicy = exports.postGetOrganization = exports.postGetActivity = void 0; | ||
exports.federatedPostSignTransaction = exports.postSignTransaction = exports.federatedPostSignRawPayload = exports.postSignRawPayload = exports.federatedPostRejectActivity = exports.postRejectActivity = exports.federatedPostDeletePolicy = exports.postDeletePolicy = exports.federatedPostDeleteInvitation = exports.postDeleteInvitation = exports.federatedPostDeleteApiKeys = exports.postDeleteApiKeys = exports.federatedPostCreateUsers = exports.postCreateUsers = exports.federatedPostCreateSubOrganization = exports.postCreateSubOrganization = exports.federatedPostCreatePrivateKeys = exports.postCreatePrivateKeys = exports.federatedPostCreatePolicy = exports.postCreatePolicy = exports.federatedPostCreateInvitations = exports.postCreateInvitations = exports.federatedPostCreateAuthenticators = exports.postCreateAuthenticators = exports.federatedPostCreateApiOnlyUsers = exports.postCreateApiOnlyUsers = exports.federatedPostCreateApiKeys = exports.postCreateApiKeys = exports.federatedPostApproveActivity = exports.postApproveActivity = exports.federatedPostGetWhoami = exports.postGetWhoami = exports.federatedPostGetUsers = exports.postGetUsers = exports.federatedPostGetPrivateKeys = exports.postGetPrivateKeys = exports.federatedPostGetPolicies = exports.postGetPolicies = exports.federatedPostGetActivities = exports.postGetActivities = exports.federatedPostGetUser = exports.postGetUser = exports.federatedPostGetPrivateKey = exports.postGetPrivateKey = exports.federatedPostGetPolicy = exports.postGetPolicy = exports.federatedPostGetOrganization = exports.postGetOrganization = exports.federatedPostGetActivity = exports.postGetActivity = void 0; | ||
exports.federatedPostGetPrivateKeyBackwardsCompat = exports.postGetPrivateKeyBackwardsCompat = exports.federatedPostNOOPCodegenAnchor = exports.postNOOPCodegenAnchor = exports.federatedPostUpdateUserTag = exports.postUpdateUserTag = exports.federatedPostUpdateRootQuorum = exports.postUpdateRootQuorum = exports.federatedPostUpdatePrivateKeyTag = exports.postUpdatePrivateKeyTag = void 0; | ||
const base_1 = require("../../../../../base"); | ||
@@ -20,2 +21,13 @@ /** | ||
/** | ||
* Get Activity | ||
* | ||
* Get details about an Activity | ||
*/ | ||
const federatedPostGetActivity = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/query/get_activity", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostGetActivity = federatedPostGetActivity; | ||
/** | ||
* Get Organization | ||
@@ -34,2 +46,13 @@ * | ||
/** | ||
* Get Organization | ||
* | ||
* Get details about an Organization | ||
*/ | ||
const federatedPostGetOrganization = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/query/get_organization", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostGetOrganization = federatedPostGetOrganization; | ||
/** | ||
* Get Policy | ||
@@ -48,2 +71,13 @@ * | ||
/** | ||
* Get Policy | ||
* | ||
* Get details about a Policy | ||
*/ | ||
const federatedPostGetPolicy = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/query/get_policy", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostGetPolicy = federatedPostGetPolicy; | ||
/** | ||
* Get Private Key | ||
@@ -62,2 +96,13 @@ * | ||
/** | ||
* Get Private Key | ||
* | ||
* Get details about a Private Key | ||
*/ | ||
const federatedPostGetPrivateKey = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/query/get_private_key", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostGetPrivateKey = federatedPostGetPrivateKey; | ||
/** | ||
* Get User | ||
@@ -76,2 +121,13 @@ * | ||
/** | ||
* Get User | ||
* | ||
* Get details about a User | ||
*/ | ||
const federatedPostGetUser = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/query/get_user", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostGetUser = federatedPostGetUser; | ||
/** | ||
* List Activities | ||
@@ -90,2 +146,13 @@ * | ||
/** | ||
* List Activities | ||
* | ||
* List all Activities within an Organization | ||
*/ | ||
const federatedPostGetActivities = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/query/list_activities", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostGetActivities = federatedPostGetActivities; | ||
/** | ||
* List Policies | ||
@@ -104,2 +171,13 @@ * | ||
/** | ||
* List Policies | ||
* | ||
* List all Policies within an Organization | ||
*/ | ||
const federatedPostGetPolicies = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/query/list_policies", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostGetPolicies = federatedPostGetPolicies; | ||
/** | ||
* List Private Keys | ||
@@ -118,2 +196,13 @@ * | ||
/** | ||
* List Private Keys | ||
* | ||
* List all Private Keys within an Organization | ||
*/ | ||
const federatedPostGetPrivateKeys = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/query/list_private_keys", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostGetPrivateKeys = federatedPostGetPrivateKeys; | ||
/** | ||
* List Users | ||
@@ -132,2 +221,13 @@ * | ||
/** | ||
* List Users | ||
* | ||
* List all Users within an Organization | ||
*/ | ||
const federatedPostGetUsers = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/query/list_users", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostGetUsers = federatedPostGetUsers; | ||
/** | ||
* Who am I? | ||
@@ -146,2 +246,13 @@ * | ||
/** | ||
* Who am I? | ||
* | ||
* Get basic information about your current API user and your organization | ||
*/ | ||
const federatedPostGetWhoami = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/query/whoami", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostGetWhoami = federatedPostGetWhoami; | ||
/** | ||
* Approve Activity | ||
@@ -160,2 +271,13 @@ * | ||
/** | ||
* Approve Activity | ||
* | ||
* Approve an Activity | ||
*/ | ||
const federatedPostApproveActivity = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/approve_activity", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostApproveActivity = federatedPostApproveActivity; | ||
/** | ||
* Create API Keys | ||
@@ -174,2 +296,13 @@ * | ||
/** | ||
* Create API Keys | ||
* | ||
* Add api keys to an existing User | ||
*/ | ||
const federatedPostCreateApiKeys = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/create_api_keys", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostCreateApiKeys = federatedPostCreateApiKeys; | ||
/** | ||
* Create API-only Users | ||
@@ -188,2 +321,13 @@ * | ||
/** | ||
* Create API-only Users | ||
* | ||
* Create API-only Users in an existing Organization | ||
*/ | ||
const federatedPostCreateApiOnlyUsers = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/create_api_only_users", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostCreateApiOnlyUsers = federatedPostCreateApiOnlyUsers; | ||
/** | ||
* Create Authenticators | ||
@@ -202,2 +346,13 @@ * | ||
/** | ||
* Create Authenticators | ||
* | ||
* Create Authenticators to authenticate requests to Turnkey | ||
*/ | ||
const federatedPostCreateAuthenticators = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/create_authenticators", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostCreateAuthenticators = federatedPostCreateAuthenticators; | ||
/** | ||
* Create Invitations | ||
@@ -216,2 +371,13 @@ * | ||
/** | ||
* Create Invitations | ||
* | ||
* Create Invitations to join an existing Organization | ||
*/ | ||
const federatedPostCreateInvitations = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/create_invitations", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostCreateInvitations = federatedPostCreateInvitations; | ||
/** | ||
* Create Policy | ||
@@ -230,2 +396,13 @@ * | ||
/** | ||
* Create Policy | ||
* | ||
* Create a new Policy | ||
*/ | ||
const federatedPostCreatePolicy = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/create_policy", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostCreatePolicy = federatedPostCreatePolicy; | ||
/** | ||
* Create Private Keys | ||
@@ -244,2 +421,37 @@ * | ||
/** | ||
* Create Private Keys | ||
* | ||
* Create new Private Keys | ||
*/ | ||
const federatedPostCreatePrivateKeys = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/create_private_keys", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostCreatePrivateKeys = federatedPostCreatePrivateKeys; | ||
/** | ||
* Create Sub-Organization | ||
* | ||
* Create a new Sub-Organization | ||
* | ||
* `POST /public/v1/submit/create_sub_organization` | ||
*/ | ||
const postCreateSubOrganization = (input) => (0, base_1.request)({ | ||
uri: "/public/v1/submit/create_sub_organization", | ||
method: "POST", | ||
body: input.body, | ||
}); | ||
exports.postCreateSubOrganization = postCreateSubOrganization; | ||
/** | ||
* Create Sub-Organization | ||
* | ||
* Create a new Sub-Organization | ||
*/ | ||
const federatedPostCreateSubOrganization = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/create_sub_organization", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostCreateSubOrganization = federatedPostCreateSubOrganization; | ||
/** | ||
* Create Users | ||
@@ -260,2 +472,15 @@ * | ||
/** | ||
* Create Users | ||
* | ||
* Create Users in an existing Organization | ||
* | ||
* @deprecated | ||
*/ | ||
const federatedPostCreateUsers = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/create_users", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostCreateUsers = federatedPostCreateUsers; | ||
/** | ||
* Delete API Keys | ||
@@ -274,2 +499,13 @@ * | ||
/** | ||
* Delete API Keys | ||
* | ||
* Remove api keys from a User | ||
*/ | ||
const federatedPostDeleteApiKeys = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/delete_api_keys", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostDeleteApiKeys = federatedPostDeleteApiKeys; | ||
/** | ||
* Delete Invitation | ||
@@ -288,2 +524,13 @@ * | ||
/** | ||
* Delete Invitation | ||
* | ||
* Delete an existing Invitation | ||
*/ | ||
const federatedPostDeleteInvitation = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/delete_invitations", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostDeleteInvitation = federatedPostDeleteInvitation; | ||
/** | ||
* Delete Policy | ||
@@ -302,2 +549,13 @@ * | ||
/** | ||
* Delete Policy | ||
* | ||
* Delete an existing Policy | ||
*/ | ||
const federatedPostDeletePolicy = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/delete_policy", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostDeletePolicy = federatedPostDeletePolicy; | ||
/** | ||
* Reject Activity | ||
@@ -316,2 +574,13 @@ * | ||
/** | ||
* Reject Activity | ||
* | ||
* Reject an Activity | ||
*/ | ||
const federatedPostRejectActivity = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/reject_activity", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostRejectActivity = federatedPostRejectActivity; | ||
/** | ||
* Sign Raw Payload | ||
@@ -330,2 +599,13 @@ * | ||
/** | ||
* Sign Raw Payload | ||
* | ||
* Sign a raw payload with a Private Key | ||
*/ | ||
const federatedPostSignRawPayload = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/sign_raw_payload", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostSignRawPayload = federatedPostSignRawPayload; | ||
/** | ||
* Sign Transaction | ||
@@ -344,2 +624,13 @@ * | ||
/** | ||
* Sign Transaction | ||
* | ||
* Sign a transaction with a Private Key | ||
*/ | ||
const federatedPostSignTransaction = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/sign_transaction", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostSignTransaction = federatedPostSignTransaction; | ||
/** | ||
* Update Private Key Tag | ||
@@ -358,2 +649,37 @@ * | ||
/** | ||
* Update Private Key Tag | ||
* | ||
* Update human-readable name or associated private keys. Note that this activity is atomic: all of the updates will succeed at once, or all of them will fail. | ||
*/ | ||
const federatedPostUpdatePrivateKeyTag = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/update_private_key_tag", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostUpdatePrivateKeyTag = federatedPostUpdatePrivateKeyTag; | ||
/** | ||
* Set the root quorum | ||
* | ||
* Set the threshold and members of the root quorum. This must be approved by the current root quorum. | ||
* | ||
* `POST /public/v1/submit/update_root_quorum` | ||
*/ | ||
const postUpdateRootQuorum = (input) => (0, base_1.request)({ | ||
uri: "/public/v1/submit/update_root_quorum", | ||
method: "POST", | ||
body: input.body, | ||
}); | ||
exports.postUpdateRootQuorum = postUpdateRootQuorum; | ||
/** | ||
* Set the root quorum | ||
* | ||
* Set the threshold and members of the root quorum. This must be approved by the current root quorum. | ||
*/ | ||
const federatedPostUpdateRootQuorum = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/update_root_quorum", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostUpdateRootQuorum = federatedPostUpdateRootQuorum; | ||
/** | ||
* Update User Tag | ||
@@ -372,2 +698,34 @@ * | ||
/** | ||
* Update User Tag | ||
* | ||
* Update human-readable name or associated users. Note that this activity is atomic: all of the updates will succeed at once, or all of them will fail. | ||
*/ | ||
const federatedPostUpdateUserTag = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/public/v1/submit/update_user_tag", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostUpdateUserTag = federatedPostUpdateUserTag; | ||
/** | ||
* This route does nothing and does not need an implementation, but please don't remove it. | ||
It's used at compile time for generating extra OpenAPI/TypeScript types | ||
that are not directly referenced in requests. | ||
* | ||
* `POST /tkhq/api/v1/noop-codegen-anchor` | ||
*/ | ||
const postNOOPCodegenAnchor = () => (0, base_1.request)({ | ||
uri: "/tkhq/api/v1/noop-codegen-anchor", | ||
method: "POST", | ||
}); | ||
exports.postNOOPCodegenAnchor = postNOOPCodegenAnchor; | ||
/** | ||
* This route does nothing and does not need an implementation, but please don't remove it. | ||
It's used at compile time for generating extra OpenAPI/TypeScript types | ||
that are not directly referenced in requests. | ||
*/ | ||
const federatedPostNOOPCodegenAnchor = () => (0, base_1.federatedRequest)({ | ||
uri: "/tkhq/api/v1/noop-codegen-anchor", | ||
}); | ||
exports.federatedPostNOOPCodegenAnchor = federatedPostNOOPCodegenAnchor; | ||
/** | ||
* Get Private Key | ||
@@ -387,2 +745,15 @@ * | ||
exports.postGetPrivateKeyBackwardsCompat = postGetPrivateKeyBackwardsCompat; | ||
/** | ||
* Get Private Key | ||
* | ||
* Get details about a Private Key | ||
* | ||
* @deprecated | ||
*/ | ||
const federatedPostGetPrivateKeyBackwardsCompat = (input, options) => (0, base_1.federatedRequest)({ | ||
uri: "/tkhq/public/v1/query/get_private_key", | ||
body: input.body, | ||
options, | ||
}); | ||
exports.federatedPostGetPrivateKeyBackwardsCompat = federatedPostGetPrivateKeyBackwardsCompat; | ||
//# sourceMappingURL=public_api.fetcher.js.map |
@@ -0,1 +1,4 @@ | ||
import { FederatedRequest } from "./shared"; | ||
import { TurnkeyCredentialRequestOptions } from "./webauthn"; | ||
export type { TurnkeyCredentialRequestOptions }; | ||
type TBasicType = string; | ||
@@ -6,2 +9,9 @@ type TQueryShape = Record<string, TBasicType | Array<TBasicType>>; | ||
type TSubstitutionShape = Record<string, any>; | ||
export declare function federatedRequest<B extends TBodyShape = never, Q extends TQueryShape = never, S extends TSubstitutionShape = never>(input: { | ||
uri: string; | ||
query?: Q; | ||
body?: B; | ||
substitution?: S; | ||
options?: TurnkeyCredentialRequestOptions | undefined; | ||
}): Promise<FederatedRequest>; | ||
export declare function request<ResponseData = never, B extends TBodyShape = never, Q extends TQueryShape = never, S extends TSubstitutionShape = never, H extends THeadersShape = never>(input: { | ||
@@ -30,3 +40,2 @@ uri: string; | ||
}>; | ||
export {}; | ||
//# sourceMappingURL=base.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sealAndStampRequestBody = exports.request = void 0; | ||
exports.sealAndStampRequestBody = exports.request = exports.federatedRequest = void 0; | ||
const universal_1 = require("./universal"); | ||
@@ -8,2 +8,3 @@ const config_1 = require("./config"); | ||
const shared_1 = require("./shared"); | ||
const webauthn_1 = require("./webauthn"); | ||
const sharedHeaders = {}; | ||
@@ -13,2 +14,18 @@ const sharedRequestOptions = { | ||
}; | ||
async function federatedRequest(input) { | ||
const { uri: inputUri, query: inputQuery = {}, substitution: inputSubstitution = {}, body: inputBody = {}, } = input; | ||
const url = constructUrl({ | ||
uri: inputUri, | ||
query: inputQuery, | ||
substitution: inputSubstitution, | ||
}); | ||
const body = JSON.stringify(inputBody); | ||
const stamp = await (0, webauthn_1.getWebAuthnAssertion)(body, input.options); | ||
return { | ||
url: url.toString(), | ||
body, | ||
stamp, | ||
}; | ||
} | ||
exports.federatedRequest = federatedRequest; | ||
async function request(input) { | ||
@@ -52,3 +69,3 @@ const { uri: inputUri, method, headers: inputHeaders = {}, query: inputQuery = {}, substitution: inputSubstitution = {}, body: inputBody = {}, } = input; | ||
const { uri, query, substitution } = input; | ||
const { baseUrl } = (0, config_1.getConfig)(); | ||
const baseUrl = getBaseUrl(); | ||
const url = new URL(substitutePath(uri, substitution), baseUrl); | ||
@@ -68,2 +85,12 @@ for (const key in query) { | ||
} | ||
function getBaseUrl() { | ||
try { | ||
const { baseUrl } = (0, config_1.getConfig)(); | ||
return baseUrl; | ||
} | ||
catch (e) { | ||
const { baseUrl } = (0, config_1.getBrowserConfig)(); | ||
return baseUrl; | ||
} | ||
} | ||
function substitutePath(uri, substitutionMap) { | ||
@@ -70,0 +97,0 @@ let result = uri; |
@@ -15,5 +15,13 @@ type TConfig = { | ||
}; | ||
type TBrowserConfig = { | ||
/** | ||
* Turnkey API base URL | ||
*/ | ||
baseUrl: string; | ||
}; | ||
export declare function browserInit(value: TBrowserConfig): void; | ||
export declare function init(value: TConfig): void; | ||
export declare function getConfig(): TConfig; | ||
export declare function getBrowserConfig(): TBrowserConfig; | ||
export {}; | ||
//# sourceMappingURL=config.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getConfig = exports.init = void 0; | ||
exports.getBrowserConfig = exports.getConfig = exports.init = exports.browserInit = void 0; | ||
const config = { | ||
@@ -9,2 +9,9 @@ apiPublicKey: null, | ||
}; | ||
const browserConfig = { | ||
baseUrl: null, | ||
}; | ||
function browserInit(value) { | ||
browserConfig.baseUrl = assertNonEmptyString(value.baseUrl, "baseUrl"); | ||
} | ||
exports.browserInit = browserInit; | ||
function init(value) { | ||
@@ -24,2 +31,8 @@ config.apiPublicKey = assertNonEmptyString(value.apiPublicKey, "apiPublicKey"); | ||
exports.getConfig = getConfig; | ||
function getBrowserConfig() { | ||
return { | ||
baseUrl: assertNonEmptyString(browserConfig.baseUrl, "baseUrl"), | ||
}; | ||
} | ||
exports.getBrowserConfig = getBrowserConfig; | ||
function assertNonEmptyString(input, name) { | ||
@@ -26,0 +39,0 @@ if (typeof input !== "string" || !input) { |
@@ -5,2 +5,3 @@ /** | ||
export declare function stringToBase64urlString(input: string): string; | ||
export declare function base64StringToBase64UrlEncodedString(input: string): string; | ||
export declare function uint8ArrayToHexString(input: Uint8Array): string; | ||
@@ -7,0 +8,0 @@ export declare function convertTurnkeyApiKeyToJwk(input: { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.convertTurnkeyApiKeyToJwk = exports.uint8ArrayToHexString = exports.stringToBase64urlString = void 0; | ||
exports.convertTurnkeyApiKeyToJwk = exports.uint8ArrayToHexString = exports.base64StringToBase64UrlEncodedString = exports.stringToBase64urlString = void 0; | ||
const elliptic_curves_1 = require("./tink/elliptic_curves"); | ||
@@ -11,11 +11,9 @@ /** | ||
const base64String = btoa(input); | ||
// base64 to base64url | ||
// We assume that the base64url string is well-formed. | ||
const base64urlString = base64String | ||
.replace(/\+/g, "-") | ||
.replace(/\//g, "_") | ||
.replace(/=/g, ""); | ||
return base64urlString; | ||
return base64StringToBase64UrlEncodedString(base64String); | ||
} | ||
exports.stringToBase64urlString = stringToBase64urlString; | ||
function base64StringToBase64UrlEncodedString(input) { | ||
return input.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, ""); | ||
} | ||
exports.base64StringToBase64UrlEncodedString = base64StringToBase64UrlEncodedString; | ||
function uint8ArrayToHexString(input) { | ||
@@ -22,0 +20,0 @@ return input.reduce((result, x) => result + x.toString(16).padStart(2, "0"), ""); |
import { PublicApiService as TurnkeyApi } from "./__generated__/barrel"; | ||
export { init } from "./config"; | ||
export type { definitions as TurnkeyApiTypes } from "./__generated__/services/coordinator/public/v1/public_api.types"; | ||
export { init, browserInit } from "./config"; | ||
export { TurnkeyActivityError, TurnkeyRequestError } from "./shared"; | ||
export type { FederatedRequest } from "./shared"; | ||
export { getWebAuthnAttestation } from "./webauthn"; | ||
export { withAsyncPolling } from "./async"; | ||
@@ -5,0 +8,0 @@ export { TurnkeyApi }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sealAndStampRequestBody = exports.PublicApiService = exports.TurnkeyApi = exports.withAsyncPolling = exports.TurnkeyRequestError = exports.TurnkeyActivityError = exports.init = void 0; | ||
exports.sealAndStampRequestBody = exports.PublicApiService = exports.TurnkeyApi = exports.withAsyncPolling = exports.getWebAuthnAttestation = exports.TurnkeyRequestError = exports.TurnkeyActivityError = exports.browserInit = exports.init = void 0; | ||
const barrel_1 = require("./__generated__/barrel"); | ||
@@ -8,5 +8,8 @@ Object.defineProperty(exports, "TurnkeyApi", { enumerable: true, get: function () { return barrel_1.PublicApiService; } }); | ||
Object.defineProperty(exports, "init", { enumerable: true, get: function () { return config_1.init; } }); | ||
Object.defineProperty(exports, "browserInit", { enumerable: true, get: function () { return config_1.browserInit; } }); | ||
var shared_1 = require("./shared"); | ||
Object.defineProperty(exports, "TurnkeyActivityError", { enumerable: true, get: function () { return shared_1.TurnkeyActivityError; } }); | ||
Object.defineProperty(exports, "TurnkeyRequestError", { enumerable: true, get: function () { return shared_1.TurnkeyRequestError; } }); | ||
var webauthn_1 = require("./webauthn"); | ||
Object.defineProperty(exports, "getWebAuthnAttestation", { enumerable: true, get: function () { return webauthn_1.getWebAuthnAttestation; } }); | ||
var async_1 = require("./async"); | ||
@@ -13,0 +16,0 @@ Object.defineProperty(exports, "withAsyncPolling", { enumerable: true, get: function () { return async_1.withAsyncPolling; } }); |
@@ -39,2 +39,7 @@ import type { definitions } from "./__generated__/services/coordinator/public/v1/public_api.types"; | ||
} | ||
export type FederatedRequest = { | ||
body: string; | ||
stamp: string; | ||
url: string; | ||
}; | ||
//# sourceMappingURL=shared.d.ts.map |
{ | ||
"name": "@turnkey/http", | ||
"version": "0.17.1", | ||
"version": "0.18.0", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./dist/index.d.ts", |
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
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
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1040456
94
22061