@tinycloud/sdk-services 2.11.0 → 3.0.0-beta.14
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/encryption/index.cjs +4 -1
- package/dist/encryption/index.cjs.map +1 -1
- package/dist/encryption/index.js +4 -1
- package/dist/encryption/index.js.map +1 -1
- package/dist/index.cjs +80 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +79 -14
- package/dist/index.js.map +1 -1
- package/dist/kv/index.cjs +11 -10
- package/dist/kv/index.cjs.map +1 -1
- package/dist/kv/index.js +11 -10
- package/dist/kv/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2196,15 +2196,27 @@ interface ResolvedSecretPath {
|
|
|
2196
2196
|
vault: string;
|
|
2197
2197
|
};
|
|
2198
2198
|
}
|
|
2199
|
+
interface ParsedSecretCatalogKey {
|
|
2200
|
+
name: string;
|
|
2201
|
+
scope?: string;
|
|
2202
|
+
}
|
|
2199
2203
|
declare function canonicalizeSecretScope(scope: string | undefined): string | undefined;
|
|
2200
2204
|
declare function resolveSecretPath(name: string, options?: SecretScopeOptions): ResolvedSecretPath;
|
|
2201
2205
|
declare function resolveSecretListPrefix(options?: SecretScopeOptions): string;
|
|
2206
|
+
/** Parse a key relative to `secrets/` into its canonical catalog identity. */
|
|
2207
|
+
declare function parseSecretCatalogKey(key: string): ParsedSecretCatalogKey | undefined;
|
|
2202
2208
|
|
|
2203
2209
|
interface SecretPayload {
|
|
2204
2210
|
value: string;
|
|
2205
2211
|
createdAt: string;
|
|
2206
2212
|
updatedAt: string;
|
|
2207
2213
|
}
|
|
2214
|
+
/** One discoverable secret location. Secret values are never included. */
|
|
2215
|
+
interface SecretCatalogEntry {
|
|
2216
|
+
name: string;
|
|
2217
|
+
/** Omitted for the global secret namespace. */
|
|
2218
|
+
scope?: string;
|
|
2219
|
+
}
|
|
2208
2220
|
type SecretsError = VaultError | ServiceError;
|
|
2209
2221
|
interface ISecretsService {
|
|
2210
2222
|
readonly vault: IDataVaultService;
|
|
@@ -2215,6 +2227,8 @@ interface ISecretsService {
|
|
|
2215
2227
|
put(name: string, value: string, options?: SecretScopeOptions): Promise<Result<void, SecretsError>>;
|
|
2216
2228
|
delete(name: string, options?: SecretScopeOptions): Promise<Result<void, SecretsError>>;
|
|
2217
2229
|
list(options?: SecretScopeOptions): Promise<Result<string[], SecretsError>>;
|
|
2230
|
+
/** List global and scoped secrets without decrypting their values. */
|
|
2231
|
+
listAll(): Promise<Result<SecretCatalogEntry[], SecretsError>>;
|
|
2218
2232
|
}
|
|
2219
2233
|
|
|
2220
2234
|
declare class SecretsService implements ISecretsService {
|
|
@@ -2228,6 +2242,7 @@ declare class SecretsService implements ISecretsService {
|
|
|
2228
2242
|
put(name: string, value: string, options?: SecretScopeOptions): Promise<Result<void, SecretsError>>;
|
|
2229
2243
|
delete(name: string, options?: SecretScopeOptions): Promise<Result<void, SecretsError>>;
|
|
2230
2244
|
list(options?: SecretScopeOptions): Promise<Result<string[], SecretsError>>;
|
|
2245
|
+
listAll(): Promise<Result<SecretCatalogEntry[], SecretsError>>;
|
|
2231
2246
|
}
|
|
2232
2247
|
|
|
2233
|
-
export { BaseService, type BaseServiceOptions, type ColumnInfo, type DataVaultConfig, DataVaultService, DecryptCapabilityProof, DuckDbAction, type DuckDbActionType, type DuckDbBatchOptions, type BatchResponse as DuckDbBatchResponse, DuckDbDatabaseHandle, type DuckDbExecuteOptions, type ExecuteResponse as DuckDbExecuteResponse, type DuckDbOptions, type DuckDbQueryOptions, type QueryResponse as DuckDbQueryResponse, DuckDbService, type DuckDbServiceConfig, type DuckDbStatement, type DuckDbValue, EventHandler, FetchFunction, GenericKVResponseSchema, type GenericKVResponseType, GenericResultSchema, type HookEvent, type HookServiceName, type HookStreamEvent, type HookSubscription, type HookWebhookListOptions, type HookWebhookRecord, type HookWebhookRegistration, type HookWebhookScope, type HookWebhookUnregisterOptions, HooksService, type HooksServiceConfig, type IDataVaultService, type IDuckDbDatabaseHandle, type IDuckDbService, IEncryptionService, type IHooksService, IKVService, type ISecretsService, IService, IServiceContext, InvokeAnyFunction, InvokeFunction, KVListResponseSchema, type KVListResponseType, KVListResultSchema, type KVListResultType, KVResponseHeadersSchema, type KVResponseHeadersType, PermissionHint, type QuotaConfig, type QuotaStatus, type ResolvedSecretPath, Result, RetryPolicy, RetryPolicySchema, type RetryPolicyType, SECRET_NAME_RE, type SchemaInfo, type SecretPayload, type SecretScopeOptions, type SecretsError, SecretsService, type ServiceConstructor, ServiceContext, type ServiceContextConfig, ServiceError, ServiceErrorEventSchema, type ServiceErrorEventType, ServiceErrorSchema, type ServiceErrorType, type ServiceRegistration, ServiceRequestEventSchema, type ServiceRequestEventType, ServiceResponseEventSchema, type ServiceResponseEventType, ServiceRetryEventSchema, type ServiceRetryEventType, ServiceSession, ServiceSessionSchema, type ServiceSessionType, StorageQuotaInfo, type SubscribeOptions, type TableInfo, TelemetryConfig, TelemetrySpanEventSchema, type TelemetrySpanEventType, type TinyCloudDebugEnableOptions, type TinyCloudDebugEvent, type TinyCloudDebugLevel, TinyCloudDebugLogger, type TinyCloudDebugTimer, TinyCloudQuota, type ValidationError, type VaultCrypto, type VaultEntry, type VaultError, type VaultGetOptions, type VaultGrantOptions, VaultHeaders, type VaultListOptions, type VaultListPage, type VaultNetworkReadResult, VaultPublicSpaceKVActions, type VaultPutOptions, type ViewInfo, type WasmVaultFunctions, abortedError, authExpiredError, authRequiredError, authUnauthorizedError, canonicalizeSecretScope, clearTinyCloudDebugLogs, createKVResponseSchema, createResultSchema, createVaultCrypto, disableTinyCloudDebug, enableTinyCloudDebug, errorResult, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, networkError, notFoundError, parseAuthError, parsePermissionHint, parsePermissionHintFromErrorText, permissionDeniedError, resolveSecretListPrefix, resolveSecretPath, storageLimitReachedError, storageQuotaExceededError, timeoutError, tinyCloudDebugLogger, validateKVListResponse, validateKVResponseHeaders, validateRetryPolicy, validateServiceError, validateServiceRequestEvent, validateServiceResponseEvent, validateServiceSession, validateTelemetrySpanEvent, wrapError };
|
|
2248
|
+
export { BaseService, type BaseServiceOptions, type ColumnInfo, type DataVaultConfig, DataVaultService, DecryptCapabilityProof, DuckDbAction, type DuckDbActionType, type DuckDbBatchOptions, type BatchResponse as DuckDbBatchResponse, DuckDbDatabaseHandle, type DuckDbExecuteOptions, type ExecuteResponse as DuckDbExecuteResponse, type DuckDbOptions, type DuckDbQueryOptions, type QueryResponse as DuckDbQueryResponse, DuckDbService, type DuckDbServiceConfig, type DuckDbStatement, type DuckDbValue, EventHandler, FetchFunction, GenericKVResponseSchema, type GenericKVResponseType, GenericResultSchema, type HookEvent, type HookServiceName, type HookStreamEvent, type HookSubscription, type HookWebhookListOptions, type HookWebhookRecord, type HookWebhookRegistration, type HookWebhookScope, type HookWebhookUnregisterOptions, HooksService, type HooksServiceConfig, type IDataVaultService, type IDuckDbDatabaseHandle, type IDuckDbService, IEncryptionService, type IHooksService, IKVService, type ISecretsService, IService, IServiceContext, InvokeAnyFunction, InvokeFunction, KVListResponseSchema, type KVListResponseType, KVListResultSchema, type KVListResultType, KVResponseHeadersSchema, type KVResponseHeadersType, type ParsedSecretCatalogKey, PermissionHint, type QuotaConfig, type QuotaStatus, type ResolvedSecretPath, Result, RetryPolicy, RetryPolicySchema, type RetryPolicyType, SECRET_NAME_RE, type SchemaInfo, type SecretCatalogEntry, type SecretPayload, type SecretScopeOptions, type SecretsError, SecretsService, type ServiceConstructor, ServiceContext, type ServiceContextConfig, ServiceError, ServiceErrorEventSchema, type ServiceErrorEventType, ServiceErrorSchema, type ServiceErrorType, type ServiceRegistration, ServiceRequestEventSchema, type ServiceRequestEventType, ServiceResponseEventSchema, type ServiceResponseEventType, ServiceRetryEventSchema, type ServiceRetryEventType, ServiceSession, ServiceSessionSchema, type ServiceSessionType, StorageQuotaInfo, type SubscribeOptions, type TableInfo, TelemetryConfig, TelemetrySpanEventSchema, type TelemetrySpanEventType, type TinyCloudDebugEnableOptions, type TinyCloudDebugEvent, type TinyCloudDebugLevel, TinyCloudDebugLogger, type TinyCloudDebugTimer, TinyCloudQuota, type ValidationError, type VaultCrypto, type VaultEntry, type VaultError, type VaultGetOptions, type VaultGrantOptions, VaultHeaders, type VaultListOptions, type VaultListPage, type VaultNetworkReadResult, VaultPublicSpaceKVActions, type VaultPutOptions, type ViewInfo, type WasmVaultFunctions, abortedError, authExpiredError, authRequiredError, authUnauthorizedError, canonicalizeSecretScope, clearTinyCloudDebugLogs, createKVResponseSchema, createResultSchema, createVaultCrypto, disableTinyCloudDebug, enableTinyCloudDebug, errorResult, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, networkError, notFoundError, parseAuthError, parsePermissionHint, parsePermissionHintFromErrorText, parseSecretCatalogKey, permissionDeniedError, resolveSecretListPrefix, resolveSecretPath, storageLimitReachedError, storageQuotaExceededError, timeoutError, tinyCloudDebugLogger, validateKVListResponse, validateKVResponseHeaders, validateRetryPolicy, validateServiceError, validateServiceRequestEvent, validateServiceResponseEvent, validateServiceSession, validateTelemetrySpanEvent, wrapError };
|
package/dist/index.d.ts
CHANGED
|
@@ -2196,15 +2196,27 @@ interface ResolvedSecretPath {
|
|
|
2196
2196
|
vault: string;
|
|
2197
2197
|
};
|
|
2198
2198
|
}
|
|
2199
|
+
interface ParsedSecretCatalogKey {
|
|
2200
|
+
name: string;
|
|
2201
|
+
scope?: string;
|
|
2202
|
+
}
|
|
2199
2203
|
declare function canonicalizeSecretScope(scope: string | undefined): string | undefined;
|
|
2200
2204
|
declare function resolveSecretPath(name: string, options?: SecretScopeOptions): ResolvedSecretPath;
|
|
2201
2205
|
declare function resolveSecretListPrefix(options?: SecretScopeOptions): string;
|
|
2206
|
+
/** Parse a key relative to `secrets/` into its canonical catalog identity. */
|
|
2207
|
+
declare function parseSecretCatalogKey(key: string): ParsedSecretCatalogKey | undefined;
|
|
2202
2208
|
|
|
2203
2209
|
interface SecretPayload {
|
|
2204
2210
|
value: string;
|
|
2205
2211
|
createdAt: string;
|
|
2206
2212
|
updatedAt: string;
|
|
2207
2213
|
}
|
|
2214
|
+
/** One discoverable secret location. Secret values are never included. */
|
|
2215
|
+
interface SecretCatalogEntry {
|
|
2216
|
+
name: string;
|
|
2217
|
+
/** Omitted for the global secret namespace. */
|
|
2218
|
+
scope?: string;
|
|
2219
|
+
}
|
|
2208
2220
|
type SecretsError = VaultError | ServiceError;
|
|
2209
2221
|
interface ISecretsService {
|
|
2210
2222
|
readonly vault: IDataVaultService;
|
|
@@ -2215,6 +2227,8 @@ interface ISecretsService {
|
|
|
2215
2227
|
put(name: string, value: string, options?: SecretScopeOptions): Promise<Result<void, SecretsError>>;
|
|
2216
2228
|
delete(name: string, options?: SecretScopeOptions): Promise<Result<void, SecretsError>>;
|
|
2217
2229
|
list(options?: SecretScopeOptions): Promise<Result<string[], SecretsError>>;
|
|
2230
|
+
/** List global and scoped secrets without decrypting their values. */
|
|
2231
|
+
listAll(): Promise<Result<SecretCatalogEntry[], SecretsError>>;
|
|
2218
2232
|
}
|
|
2219
2233
|
|
|
2220
2234
|
declare class SecretsService implements ISecretsService {
|
|
@@ -2228,6 +2242,7 @@ declare class SecretsService implements ISecretsService {
|
|
|
2228
2242
|
put(name: string, value: string, options?: SecretScopeOptions): Promise<Result<void, SecretsError>>;
|
|
2229
2243
|
delete(name: string, options?: SecretScopeOptions): Promise<Result<void, SecretsError>>;
|
|
2230
2244
|
list(options?: SecretScopeOptions): Promise<Result<string[], SecretsError>>;
|
|
2245
|
+
listAll(): Promise<Result<SecretCatalogEntry[], SecretsError>>;
|
|
2231
2246
|
}
|
|
2232
2247
|
|
|
2233
|
-
export { BaseService, type BaseServiceOptions, type ColumnInfo, type DataVaultConfig, DataVaultService, DecryptCapabilityProof, DuckDbAction, type DuckDbActionType, type DuckDbBatchOptions, type BatchResponse as DuckDbBatchResponse, DuckDbDatabaseHandle, type DuckDbExecuteOptions, type ExecuteResponse as DuckDbExecuteResponse, type DuckDbOptions, type DuckDbQueryOptions, type QueryResponse as DuckDbQueryResponse, DuckDbService, type DuckDbServiceConfig, type DuckDbStatement, type DuckDbValue, EventHandler, FetchFunction, GenericKVResponseSchema, type GenericKVResponseType, GenericResultSchema, type HookEvent, type HookServiceName, type HookStreamEvent, type HookSubscription, type HookWebhookListOptions, type HookWebhookRecord, type HookWebhookRegistration, type HookWebhookScope, type HookWebhookUnregisterOptions, HooksService, type HooksServiceConfig, type IDataVaultService, type IDuckDbDatabaseHandle, type IDuckDbService, IEncryptionService, type IHooksService, IKVService, type ISecretsService, IService, IServiceContext, InvokeAnyFunction, InvokeFunction, KVListResponseSchema, type KVListResponseType, KVListResultSchema, type KVListResultType, KVResponseHeadersSchema, type KVResponseHeadersType, PermissionHint, type QuotaConfig, type QuotaStatus, type ResolvedSecretPath, Result, RetryPolicy, RetryPolicySchema, type RetryPolicyType, SECRET_NAME_RE, type SchemaInfo, type SecretPayload, type SecretScopeOptions, type SecretsError, SecretsService, type ServiceConstructor, ServiceContext, type ServiceContextConfig, ServiceError, ServiceErrorEventSchema, type ServiceErrorEventType, ServiceErrorSchema, type ServiceErrorType, type ServiceRegistration, ServiceRequestEventSchema, type ServiceRequestEventType, ServiceResponseEventSchema, type ServiceResponseEventType, ServiceRetryEventSchema, type ServiceRetryEventType, ServiceSession, ServiceSessionSchema, type ServiceSessionType, StorageQuotaInfo, type SubscribeOptions, type TableInfo, TelemetryConfig, TelemetrySpanEventSchema, type TelemetrySpanEventType, type TinyCloudDebugEnableOptions, type TinyCloudDebugEvent, type TinyCloudDebugLevel, TinyCloudDebugLogger, type TinyCloudDebugTimer, TinyCloudQuota, type ValidationError, type VaultCrypto, type VaultEntry, type VaultError, type VaultGetOptions, type VaultGrantOptions, VaultHeaders, type VaultListOptions, type VaultListPage, type VaultNetworkReadResult, VaultPublicSpaceKVActions, type VaultPutOptions, type ViewInfo, type WasmVaultFunctions, abortedError, authExpiredError, authRequiredError, authUnauthorizedError, canonicalizeSecretScope, clearTinyCloudDebugLogs, createKVResponseSchema, createResultSchema, createVaultCrypto, disableTinyCloudDebug, enableTinyCloudDebug, errorResult, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, networkError, notFoundError, parseAuthError, parsePermissionHint, parsePermissionHintFromErrorText, permissionDeniedError, resolveSecretListPrefix, resolveSecretPath, storageLimitReachedError, storageQuotaExceededError, timeoutError, tinyCloudDebugLogger, validateKVListResponse, validateKVResponseHeaders, validateRetryPolicy, validateServiceError, validateServiceRequestEvent, validateServiceResponseEvent, validateServiceSession, validateTelemetrySpanEvent, wrapError };
|
|
2248
|
+
export { BaseService, type BaseServiceOptions, type ColumnInfo, type DataVaultConfig, DataVaultService, DecryptCapabilityProof, DuckDbAction, type DuckDbActionType, type DuckDbBatchOptions, type BatchResponse as DuckDbBatchResponse, DuckDbDatabaseHandle, type DuckDbExecuteOptions, type ExecuteResponse as DuckDbExecuteResponse, type DuckDbOptions, type DuckDbQueryOptions, type QueryResponse as DuckDbQueryResponse, DuckDbService, type DuckDbServiceConfig, type DuckDbStatement, type DuckDbValue, EventHandler, FetchFunction, GenericKVResponseSchema, type GenericKVResponseType, GenericResultSchema, type HookEvent, type HookServiceName, type HookStreamEvent, type HookSubscription, type HookWebhookListOptions, type HookWebhookRecord, type HookWebhookRegistration, type HookWebhookScope, type HookWebhookUnregisterOptions, HooksService, type HooksServiceConfig, type IDataVaultService, type IDuckDbDatabaseHandle, type IDuckDbService, IEncryptionService, type IHooksService, IKVService, type ISecretsService, IService, IServiceContext, InvokeAnyFunction, InvokeFunction, KVListResponseSchema, type KVListResponseType, KVListResultSchema, type KVListResultType, KVResponseHeadersSchema, type KVResponseHeadersType, type ParsedSecretCatalogKey, PermissionHint, type QuotaConfig, type QuotaStatus, type ResolvedSecretPath, Result, RetryPolicy, RetryPolicySchema, type RetryPolicyType, SECRET_NAME_RE, type SchemaInfo, type SecretCatalogEntry, type SecretPayload, type SecretScopeOptions, type SecretsError, SecretsService, type ServiceConstructor, ServiceContext, type ServiceContextConfig, ServiceError, ServiceErrorEventSchema, type ServiceErrorEventType, ServiceErrorSchema, type ServiceErrorType, type ServiceRegistration, ServiceRequestEventSchema, type ServiceRequestEventType, ServiceResponseEventSchema, type ServiceResponseEventType, ServiceRetryEventSchema, type ServiceRetryEventType, ServiceSession, ServiceSessionSchema, type ServiceSessionType, StorageQuotaInfo, type SubscribeOptions, type TableInfo, TelemetryConfig, TelemetrySpanEventSchema, type TelemetrySpanEventType, type TinyCloudDebugEnableOptions, type TinyCloudDebugEvent, type TinyCloudDebugLevel, TinyCloudDebugLogger, type TinyCloudDebugTimer, TinyCloudQuota, type ValidationError, type VaultCrypto, type VaultEntry, type VaultError, type VaultGetOptions, type VaultGrantOptions, VaultHeaders, type VaultListOptions, type VaultListPage, type VaultNetworkReadResult, VaultPublicSpaceKVActions, type VaultPutOptions, type ViewInfo, type WasmVaultFunctions, abortedError, authExpiredError, authRequiredError, authUnauthorizedError, canonicalizeSecretScope, clearTinyCloudDebugLogs, createKVResponseSchema, createResultSchema, createVaultCrypto, disableTinyCloudDebug, enableTinyCloudDebug, errorResult, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, networkError, notFoundError, parseAuthError, parsePermissionHint, parsePermissionHintFromErrorText, parseSecretCatalogKey, permissionDeniedError, resolveSecretListPrefix, resolveSecretPath, storageLimitReachedError, storageQuotaExceededError, timeoutError, tinyCloudDebugLogger, validateKVListResponse, validateKVResponseHeaders, validateRetryPolicy, validateServiceError, validateServiceRequestEvent, validateServiceResponseEvent, validateServiceSession, validateTelemetrySpanEvent, wrapError };
|
package/dist/index.js
CHANGED
|
@@ -1478,7 +1478,7 @@ var KVService = class extends BaseService {
|
|
|
1478
1478
|
*/
|
|
1479
1479
|
getFullPath(key, prefixOverride) {
|
|
1480
1480
|
const prefix = prefixOverride ?? this._config.prefix ?? "";
|
|
1481
|
-
return prefix ? `${prefix}/${key}` : key;
|
|
1481
|
+
return prefix ? key === "" ? prefix : `${prefix}/${key}` : key;
|
|
1482
1482
|
}
|
|
1483
1483
|
/**
|
|
1484
1484
|
* Get the host URL.
|
|
@@ -1962,16 +1962,17 @@ var KVService = class extends BaseService {
|
|
|
1962
1962
|
...options?.ifNoneMatch === void 0 ? {} : { "if-none-match": options.ifNoneMatch }
|
|
1963
1963
|
}
|
|
1964
1964
|
);
|
|
1965
|
+
if (response.status === 401 || response.status === 403) {
|
|
1966
|
+
const errorText = await response.text();
|
|
1967
|
+
const message = errorText.trim().length > 0 ? errorText : `Failed to put key "${key}": ${response.status} - ${response.statusText || "authorization failed"}`;
|
|
1968
|
+
const { resource, action: requiredAction } = parseAuthError(errorText);
|
|
1969
|
+
return err(authUnauthorizedError("kv", message, {
|
|
1970
|
+
status: response.status,
|
|
1971
|
+
...requiredAction && { requiredAction },
|
|
1972
|
+
...resource && { resource }
|
|
1973
|
+
}));
|
|
1974
|
+
}
|
|
1965
1975
|
if (!response.ok) {
|
|
1966
|
-
if (response.status === 401) {
|
|
1967
|
-
const errorText2 = await response.text();
|
|
1968
|
-
const { resource, action } = parseAuthError(errorText2);
|
|
1969
|
-
return err(authUnauthorizedError("kv", errorText2, {
|
|
1970
|
-
status: response.status,
|
|
1971
|
-
...action && { requiredAction: action },
|
|
1972
|
-
...resource && { resource }
|
|
1973
|
-
}));
|
|
1974
|
-
}
|
|
1975
1976
|
const errorText = await response.text();
|
|
1976
1977
|
if (response.status === 412) {
|
|
1977
1978
|
return err(serviceError(
|
|
@@ -5611,7 +5612,9 @@ function canonicalizeSecretScope(scope) {
|
|
|
5611
5612
|
}
|
|
5612
5613
|
const trimmed = scope.trim();
|
|
5613
5614
|
if (trimmed === "") {
|
|
5614
|
-
throw new Error(
|
|
5615
|
+
throw new Error(
|
|
5616
|
+
"Secret scope must be non-empty; omit scope for global secrets."
|
|
5617
|
+
);
|
|
5615
5618
|
}
|
|
5616
5619
|
const canonical = trimmed.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
5617
5620
|
if (canonical === "") {
|
|
@@ -5646,6 +5649,28 @@ function resolveSecretListPrefix(options = {}) {
|
|
|
5646
5649
|
const scope = canonicalizeSecretScope(options.scope);
|
|
5647
5650
|
return scope === void 0 ? "vault/secrets/" : `vault/secrets/scoped/${scope}/`;
|
|
5648
5651
|
}
|
|
5652
|
+
function parseSecretCatalogKey(key) {
|
|
5653
|
+
if (SECRET_NAME_RE.test(key)) {
|
|
5654
|
+
return { name: key };
|
|
5655
|
+
}
|
|
5656
|
+
const parts = key.split("/");
|
|
5657
|
+
if (parts.length !== 3 || parts[0] !== "scoped") {
|
|
5658
|
+
return void 0;
|
|
5659
|
+
}
|
|
5660
|
+
const [, rawScope, name] = parts;
|
|
5661
|
+
if (!name || !SECRET_NAME_RE.test(name)) {
|
|
5662
|
+
return void 0;
|
|
5663
|
+
}
|
|
5664
|
+
try {
|
|
5665
|
+
const scope = canonicalizeSecretScope(rawScope);
|
|
5666
|
+
if (scope === void 0 || scope !== rawScope) {
|
|
5667
|
+
return void 0;
|
|
5668
|
+
}
|
|
5669
|
+
return { name, scope };
|
|
5670
|
+
} catch {
|
|
5671
|
+
return void 0;
|
|
5672
|
+
}
|
|
5673
|
+
}
|
|
5649
5674
|
|
|
5650
5675
|
// src/secrets/SecretsService.ts
|
|
5651
5676
|
function invalidSecretInput(message) {
|
|
@@ -5659,7 +5684,9 @@ function resolveSecretPathResult(name, options) {
|
|
|
5659
5684
|
try {
|
|
5660
5685
|
return resolveSecretPath(name, options);
|
|
5661
5686
|
} catch (error) {
|
|
5662
|
-
return invalidSecretInput(
|
|
5687
|
+
return invalidSecretInput(
|
|
5688
|
+
error instanceof Error ? error.message : String(error)
|
|
5689
|
+
);
|
|
5663
5690
|
}
|
|
5664
5691
|
}
|
|
5665
5692
|
var SecretsService = class {
|
|
@@ -5708,7 +5735,9 @@ var SecretsService = class {
|
|
|
5708
5735
|
const scope = canonicalizeSecretScope(options?.scope);
|
|
5709
5736
|
prefix = scope === void 0 ? "secrets/" : `secrets/scoped/${scope}/`;
|
|
5710
5737
|
} catch (error) {
|
|
5711
|
-
return invalidSecretInput(
|
|
5738
|
+
return invalidSecretInput(
|
|
5739
|
+
error instanceof Error ? error.message : String(error)
|
|
5740
|
+
);
|
|
5712
5741
|
}
|
|
5713
5742
|
const result = await this.vault.list({
|
|
5714
5743
|
prefix,
|
|
@@ -5722,6 +5751,38 @@ var SecretsService = class {
|
|
|
5722
5751
|
data: result.data.filter((name) => SECRET_NAME_RE.test(name))
|
|
5723
5752
|
};
|
|
5724
5753
|
}
|
|
5754
|
+
async listAll() {
|
|
5755
|
+
const entries = /* @__PURE__ */ new Map();
|
|
5756
|
+
let cursor;
|
|
5757
|
+
do {
|
|
5758
|
+
const result = await this.vault.listPage({
|
|
5759
|
+
prefix: "secrets/",
|
|
5760
|
+
removePrefix: true,
|
|
5761
|
+
limit: 1e3,
|
|
5762
|
+
...cursor === void 0 ? {} : { cursor }
|
|
5763
|
+
});
|
|
5764
|
+
if (!result.ok) {
|
|
5765
|
+
return result;
|
|
5766
|
+
}
|
|
5767
|
+
for (const key of result.data.keys) {
|
|
5768
|
+
const entry = parseSecretCatalogKey(key);
|
|
5769
|
+
if (!entry) continue;
|
|
5770
|
+
entries.set(`${entry.scope ?? ""}\0${entry.name}`, entry);
|
|
5771
|
+
}
|
|
5772
|
+
cursor = result.data.truncated ? result.data.nextCursor : void 0;
|
|
5773
|
+
if (result.data.truncated && cursor === void 0) {
|
|
5774
|
+
return invalidSecretInput(
|
|
5775
|
+
"Secret catalog listing was truncated without a continuation cursor."
|
|
5776
|
+
);
|
|
5777
|
+
}
|
|
5778
|
+
} while (cursor !== void 0);
|
|
5779
|
+
return {
|
|
5780
|
+
ok: true,
|
|
5781
|
+
data: [...entries.values()].sort(
|
|
5782
|
+
(a, b) => (a.scope ?? "").localeCompare(b.scope ?? "") || a.name.localeCompare(b.name)
|
|
5783
|
+
)
|
|
5784
|
+
};
|
|
5785
|
+
}
|
|
5725
5786
|
};
|
|
5726
5787
|
|
|
5727
5788
|
// src/encryption/canonical.ts
|
|
@@ -6611,7 +6672,10 @@ var EncryptionService = class extends BaseService {
|
|
|
6611
6672
|
const descriptor = usable.data;
|
|
6612
6673
|
const networkPublicKey = base64Decode2(descriptor.publicEncryptionKey);
|
|
6613
6674
|
const result = encryptToNetwork(this.crypto, {
|
|
6614
|
-
|
|
6675
|
+
// Discovery returns the node's canonical network identifier. Persist
|
|
6676
|
+
// that spelling in the envelope so a later response can be compared
|
|
6677
|
+
// byte-for-byte (notably for checksummed did:pkh principals).
|
|
6678
|
+
networkId: descriptor.networkId,
|
|
6615
6679
|
networkPublicKey,
|
|
6616
6680
|
plaintext,
|
|
6617
6681
|
...options?.aad !== void 0 ? { aad: options.aad } : {},
|
|
@@ -6869,6 +6933,7 @@ export {
|
|
|
6869
6933
|
parseNetworkId,
|
|
6870
6934
|
parsePermissionHint,
|
|
6871
6935
|
parsePermissionHintFromErrorText,
|
|
6936
|
+
parseSecretCatalogKey,
|
|
6872
6937
|
permissionDeniedError,
|
|
6873
6938
|
resolveSecretListPrefix,
|
|
6874
6939
|
resolveSecretPath,
|