@develit-io/backend-sdk 8.6.0 → 8.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts
CHANGED
|
@@ -740,6 +740,10 @@ interface UseFetchOptions extends RequestInit {
|
|
|
740
740
|
}
|
|
741
741
|
declare function useFetch<T = unknown>(url: string, { parseAs, ...options }?: UseFetchOptions): Promise<Result<T>>;
|
|
742
742
|
|
|
743
|
+
declare const createSignatureKeyPair: () => Promise<{
|
|
744
|
+
publicKey: string;
|
|
745
|
+
privateKey: string;
|
|
746
|
+
}>;
|
|
743
747
|
declare const signPayload: ({ payload, privateKey, }: {
|
|
744
748
|
payload: string;
|
|
745
749
|
privateKey: string;
|
|
@@ -849,5 +853,5 @@ interface WithRetryCounterOptions {
|
|
|
849
853
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
850
854
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
851
855
|
|
|
852
|
-
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, handleActionResponse, ibanSchema, isInternalError, nullToOptional, optionalToNull, paginationQuerySchema, paginationSchema, resolveColumn, service, signPayload, useFetch, useResult, useResultSync, uuidv4, verifyPayloadSignature, workflowInstanceStatusSchema };
|
|
856
|
+
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, createSignatureKeyPair, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, handleActionResponse, ibanSchema, isInternalError, nullToOptional, optionalToNull, paginationQuerySchema, paginationSchema, resolveColumn, service, signPayload, useFetch, useResult, useResultSync, uuidv4, verifyPayloadSignature, workflowInstanceStatusSchema };
|
|
853
857
|
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, AuthUser, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IdempotencyVariables, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, UserRole, UserVariables, ValidatedInput, WorkflowInstanceStatus };
|
package/dist/index.d.ts
CHANGED
|
@@ -740,6 +740,10 @@ interface UseFetchOptions extends RequestInit {
|
|
|
740
740
|
}
|
|
741
741
|
declare function useFetch<T = unknown>(url: string, { parseAs, ...options }?: UseFetchOptions): Promise<Result<T>>;
|
|
742
742
|
|
|
743
|
+
declare const createSignatureKeyPair: () => Promise<{
|
|
744
|
+
publicKey: string;
|
|
745
|
+
privateKey: string;
|
|
746
|
+
}>;
|
|
743
747
|
declare const signPayload: ({ payload, privateKey, }: {
|
|
744
748
|
payload: string;
|
|
745
749
|
privateKey: string;
|
|
@@ -849,5 +853,5 @@ interface WithRetryCounterOptions {
|
|
|
849
853
|
type AsyncMethod<TArgs extends unknown[] = unknown[], TResult = unknown> = (...args: TArgs) => Promise<TResult>;
|
|
850
854
|
declare function cloudflareQueue<TArgs extends unknown[] = unknown[], TResult = unknown>(options: WithRetryCounterOptions): (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<AsyncMethod<TArgs, TResult>>) => void;
|
|
851
855
|
|
|
852
|
-
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, handleActionResponse, ibanSchema, isInternalError, nullToOptional, optionalToNull, paginationQuerySchema, paginationSchema, resolveColumn, service, signPayload, useFetch, useResult, useResultSync, uuidv4, verifyPayloadSignature, workflowInstanceStatusSchema };
|
|
856
|
+
export { DatabaseTransaction, ENVIRONMENT, RPCResponse, USER_ROLES, action, asNonEmpty, bankAccount, bankAccountMetadataSchema, base, bicSchema, buildMultiFilterConditions, buildRangeFilterConditions, buildSearchConditions, calculateExponentialBackoff, cloudflareQueue, composeWranglerBase, createAuditLogWriter, createInternalError, createSignatureKeyPair, defineCommand, derivePortFromId, develitWorker, durableObjectNamespaceIdFromName, first, firstOrError, getD1Credentials, getD1DatabaseIdFromWrangler, getDrizzleD1Config, getSecret, handleAction, handleActionResponse, ibanSchema, isInternalError, nullToOptional, optionalToNull, paginationQuerySchema, paginationSchema, resolveColumn, service, signPayload, useFetch, useResult, useResultSync, uuidv4, verifyPayloadSignature, workflowInstanceStatusSchema };
|
|
853
857
|
export type { ActionExecution, ActionHandlerOptions, AuditLogWriter, AuthUser, BankAccountMetadata, BaseEvent, BuildSearchOptions, Command, CommandLogPayload, DevelitWorkerMethods, Environment, GatewayResponse, IRPCResponse, IdempotencyVariables, IncludeRelation, InferResultType, InternalError, InternalErrorResponseStatus, Project, UserRole, UserVariables, ValidatedInput, WorkflowInstanceStatus };
|
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import fs from 'node:fs';
|
|
|
9
9
|
import crypto$1 from 'node:crypto';
|
|
10
10
|
import path from 'node:path';
|
|
11
11
|
import { parse } from 'comment-json';
|
|
12
|
-
export { s as signPayload, v as verifyPayloadSignature } from './shared/backend-sdk.
|
|
12
|
+
export { c as createSignatureKeyPair, s as signPayload, v as verifyPayloadSignature } from './shared/backend-sdk.BRwKpes3.mjs';
|
|
13
13
|
import superjson from 'superjson';
|
|
14
14
|
|
|
15
15
|
const ENVIRONMENT = ["dev", "test", "staging", "production"];
|
package/dist/middlewares.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import 'node:crypto';
|
|
|
8
8
|
import 'node:path';
|
|
9
9
|
import 'comment-json';
|
|
10
10
|
import 'drizzle-orm';
|
|
11
|
-
import { v as verifyPayloadSignature } from './shared/backend-sdk.
|
|
11
|
+
import { v as verifyPayloadSignature } from './shared/backend-sdk.BRwKpes3.mjs';
|
|
12
12
|
|
|
13
13
|
const validateBearerScheme = (header) => {
|
|
14
14
|
return header.startsWith("Bearer ") && header.length > 7 && !header.slice(7).includes(" ");
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const createSignatureKeyPair = async () => {
|
|
2
|
+
const { publicKey, privateKey } = await crypto.subtle.generateKey(
|
|
3
|
+
{
|
|
4
|
+
name: "RSASSA-PKCS1-v1_5",
|
|
5
|
+
modulusLength: 4096,
|
|
6
|
+
publicExponent: new Uint8Array([1, 0, 1]),
|
|
7
|
+
hash: "SHA-256"
|
|
8
|
+
},
|
|
9
|
+
true,
|
|
10
|
+
["sign", "verify"]
|
|
11
|
+
);
|
|
12
|
+
const exportedPublicKey = await crypto.subtle.exportKey("spki", publicKey);
|
|
13
|
+
const exportedPrivateKey = await crypto.subtle.exportKey("pkcs8", privateKey);
|
|
14
|
+
return {
|
|
15
|
+
publicKey: Buffer.from(exportedPublicKey).toString("base64"),
|
|
16
|
+
privateKey: Buffer.from(exportedPrivateKey).toString("base64")
|
|
17
|
+
};
|
|
18
|
+
};
|
|
3
19
|
const signPayload = async ({
|
|
4
20
|
payload,
|
|
5
21
|
privateKey
|
|
@@ -77,4 +93,4 @@ const verifyPayloadSignature = async ({
|
|
|
77
93
|
return isValid;
|
|
78
94
|
};
|
|
79
95
|
|
|
80
|
-
export { signPayload as s, verifyPayloadSignature as v };
|
|
96
|
+
export { createSignatureKeyPair as c, signPayload as s, verifyPayloadSignature as v };
|