@tinycloud/sdk-services 2.11.0 → 3.0.0-beta.8
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 +69 -4
- 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 +68 -4
- package/dist/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
|
@@ -5611,7 +5611,9 @@ function canonicalizeSecretScope(scope) {
|
|
|
5611
5611
|
}
|
|
5612
5612
|
const trimmed = scope.trim();
|
|
5613
5613
|
if (trimmed === "") {
|
|
5614
|
-
throw new Error(
|
|
5614
|
+
throw new Error(
|
|
5615
|
+
"Secret scope must be non-empty; omit scope for global secrets."
|
|
5616
|
+
);
|
|
5615
5617
|
}
|
|
5616
5618
|
const canonical = trimmed.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
5617
5619
|
if (canonical === "") {
|
|
@@ -5646,6 +5648,28 @@ function resolveSecretListPrefix(options = {}) {
|
|
|
5646
5648
|
const scope = canonicalizeSecretScope(options.scope);
|
|
5647
5649
|
return scope === void 0 ? "vault/secrets/" : `vault/secrets/scoped/${scope}/`;
|
|
5648
5650
|
}
|
|
5651
|
+
function parseSecretCatalogKey(key) {
|
|
5652
|
+
if (SECRET_NAME_RE.test(key)) {
|
|
5653
|
+
return { name: key };
|
|
5654
|
+
}
|
|
5655
|
+
const parts = key.split("/");
|
|
5656
|
+
if (parts.length !== 3 || parts[0] !== "scoped") {
|
|
5657
|
+
return void 0;
|
|
5658
|
+
}
|
|
5659
|
+
const [, rawScope, name] = parts;
|
|
5660
|
+
if (!name || !SECRET_NAME_RE.test(name)) {
|
|
5661
|
+
return void 0;
|
|
5662
|
+
}
|
|
5663
|
+
try {
|
|
5664
|
+
const scope = canonicalizeSecretScope(rawScope);
|
|
5665
|
+
if (scope === void 0 || scope !== rawScope) {
|
|
5666
|
+
return void 0;
|
|
5667
|
+
}
|
|
5668
|
+
return { name, scope };
|
|
5669
|
+
} catch {
|
|
5670
|
+
return void 0;
|
|
5671
|
+
}
|
|
5672
|
+
}
|
|
5649
5673
|
|
|
5650
5674
|
// src/secrets/SecretsService.ts
|
|
5651
5675
|
function invalidSecretInput(message) {
|
|
@@ -5659,7 +5683,9 @@ function resolveSecretPathResult(name, options) {
|
|
|
5659
5683
|
try {
|
|
5660
5684
|
return resolveSecretPath(name, options);
|
|
5661
5685
|
} catch (error) {
|
|
5662
|
-
return invalidSecretInput(
|
|
5686
|
+
return invalidSecretInput(
|
|
5687
|
+
error instanceof Error ? error.message : String(error)
|
|
5688
|
+
);
|
|
5663
5689
|
}
|
|
5664
5690
|
}
|
|
5665
5691
|
var SecretsService = class {
|
|
@@ -5708,7 +5734,9 @@ var SecretsService = class {
|
|
|
5708
5734
|
const scope = canonicalizeSecretScope(options?.scope);
|
|
5709
5735
|
prefix = scope === void 0 ? "secrets/" : `secrets/scoped/${scope}/`;
|
|
5710
5736
|
} catch (error) {
|
|
5711
|
-
return invalidSecretInput(
|
|
5737
|
+
return invalidSecretInput(
|
|
5738
|
+
error instanceof Error ? error.message : String(error)
|
|
5739
|
+
);
|
|
5712
5740
|
}
|
|
5713
5741
|
const result = await this.vault.list({
|
|
5714
5742
|
prefix,
|
|
@@ -5722,6 +5750,38 @@ var SecretsService = class {
|
|
|
5722
5750
|
data: result.data.filter((name) => SECRET_NAME_RE.test(name))
|
|
5723
5751
|
};
|
|
5724
5752
|
}
|
|
5753
|
+
async listAll() {
|
|
5754
|
+
const entries = /* @__PURE__ */ new Map();
|
|
5755
|
+
let cursor;
|
|
5756
|
+
do {
|
|
5757
|
+
const result = await this.vault.listPage({
|
|
5758
|
+
prefix: "secrets/",
|
|
5759
|
+
removePrefix: true,
|
|
5760
|
+
limit: 1e3,
|
|
5761
|
+
...cursor === void 0 ? {} : { cursor }
|
|
5762
|
+
});
|
|
5763
|
+
if (!result.ok) {
|
|
5764
|
+
return result;
|
|
5765
|
+
}
|
|
5766
|
+
for (const key of result.data.keys) {
|
|
5767
|
+
const entry = parseSecretCatalogKey(key);
|
|
5768
|
+
if (!entry) continue;
|
|
5769
|
+
entries.set(`${entry.scope ?? ""}\0${entry.name}`, entry);
|
|
5770
|
+
}
|
|
5771
|
+
cursor = result.data.truncated ? result.data.nextCursor : void 0;
|
|
5772
|
+
if (result.data.truncated && cursor === void 0) {
|
|
5773
|
+
return invalidSecretInput(
|
|
5774
|
+
"Secret catalog listing was truncated without a continuation cursor."
|
|
5775
|
+
);
|
|
5776
|
+
}
|
|
5777
|
+
} while (cursor !== void 0);
|
|
5778
|
+
return {
|
|
5779
|
+
ok: true,
|
|
5780
|
+
data: [...entries.values()].sort(
|
|
5781
|
+
(a, b) => (a.scope ?? "").localeCompare(b.scope ?? "") || a.name.localeCompare(b.name)
|
|
5782
|
+
)
|
|
5783
|
+
};
|
|
5784
|
+
}
|
|
5725
5785
|
};
|
|
5726
5786
|
|
|
5727
5787
|
// src/encryption/canonical.ts
|
|
@@ -6611,7 +6671,10 @@ var EncryptionService = class extends BaseService {
|
|
|
6611
6671
|
const descriptor = usable.data;
|
|
6612
6672
|
const networkPublicKey = base64Decode2(descriptor.publicEncryptionKey);
|
|
6613
6673
|
const result = encryptToNetwork(this.crypto, {
|
|
6614
|
-
|
|
6674
|
+
// Discovery returns the node's canonical network identifier. Persist
|
|
6675
|
+
// that spelling in the envelope so a later response can be compared
|
|
6676
|
+
// byte-for-byte (notably for checksummed did:pkh principals).
|
|
6677
|
+
networkId: descriptor.networkId,
|
|
6615
6678
|
networkPublicKey,
|
|
6616
6679
|
plaintext,
|
|
6617
6680
|
...options?.aad !== void 0 ? { aad: options.aad } : {},
|
|
@@ -6869,6 +6932,7 @@ export {
|
|
|
6869
6932
|
parseNetworkId,
|
|
6870
6933
|
parsePermissionHint,
|
|
6871
6934
|
parsePermissionHintFromErrorText,
|
|
6935
|
+
parseSecretCatalogKey,
|
|
6872
6936
|
permissionDeniedError,
|
|
6873
6937
|
resolveSecretListPrefix,
|
|
6874
6938
|
resolveSecretPath,
|