@le-space/core 0.12.8 → 0.12.10

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.
Files changed (3) hide show
  1. package/index.d.ts +9 -1
  2. package/index.js +27 -2
  3. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -551,6 +551,10 @@ declare function normalizeSshPublicKey(value: string): string;
551
551
  declare function isValidSshPublicKey(value: string): boolean;
552
552
  declare function createDeploymentToken(): string;
553
553
  declare function appendDeploymentTokenToSshPublicKey(sshPublicKey: string, ownerAddress: string, deploymentToken: string): string;
554
+ declare const SETUP_SECRET_HEADER = "x-aleph-setup-secret";
555
+ declare function createSetupSecret(): string;
556
+ declare function setupSecretDigest(secret: string): Promise<string>;
557
+ declare function appendSetupMarkerToSshPublicKey(sshPublicKey: string, ownerAddress: string, secretDigest: string): string;
554
558
  declare function createReleaseMetadata(name: string, rootfsVersion: string, deployer?: string): {
555
559
  name: string;
556
560
  rootfs_version: string;
@@ -745,6 +749,8 @@ declare function configureUcGoPeer(args: {
745
749
  bootstrapOwnerAuthorizationBase64?: string | null;
746
750
  bootstrapRegistrationId?: string | null;
747
751
  noStart?: boolean;
752
+ /** Sent as X-Aleph-Setup-Secret; required by guests deployed with a setup marker. */
753
+ setupSecret?: string | null;
748
754
  fetch: FetchLike;
749
755
  timeoutMs?: number;
750
756
  }): Promise<unknown>;
@@ -764,6 +770,8 @@ declare function configureOrbitdbRelaySetup(args: {
764
770
  bootstrapOwnerAuthorizationBase64?: string | null;
765
771
  bootstrapRegistrationId?: string | null;
766
772
  noStart?: boolean;
773
+ /** Sent as X-Aleph-Setup-Secret; required by guests deployed with a setup marker. */
774
+ setupSecret?: string | null;
767
775
  fetch: FetchLike;
768
776
  timeoutMs?: number;
769
777
  }): Promise<unknown>;
@@ -1080,4 +1088,4 @@ declare function reconcileOwnerRelayBootstrapRegistrations(args: {
1080
1088
  } | null;
1081
1089
  }): Promise<OwnerRelayBootstrapReconcileResult>;
1082
1090
 
1083
- export { type ConfidentialRequirement, type CrnCapacitySpec, type CrnEraseResult, type CrnResolutionResult, type CrnSource, type CrnSourceOptions, type CrnSourceResult, DEFAULT_ALEPH_API_HOST, DEFAULT_ALEPH_CHANNEL, DEFAULT_COUNTRY_LOOKUP_BASE_URL, DEFAULT_CRN_AGGREGATE_ADDRESS, DEFAULT_CRN_AGGREGATE_API_HOSTS, DEFAULT_CRN_AGGREGATE_KEY, DEFAULT_CRN_LIST_URL, DEFAULT_DNS_RESOLVE_URL, DEFAULT_INSTANCE_PORT_FORWARDS, DEFAULT_IPFS_GATEWAY_BASE_URL, DEFAULT_SCHEDULER_ALLOCATION_URL, DEFAULT_SEV_SNP_POLICY, DEFAULT_TWO_N_SIX_HASH_URL, type FetchLike, type FetchLikeResponse, type HttpProbeResult, ITEM_HASH_RE, type JsonFetchLike$1 as JsonFetchLike, type JsonFetchLikeResponse, MIN_CONFIDENTIAL_ALEPH_VM_VERSION, type OwnerRelayBootstrapReconcileResult, type PaymentQuote, type RelayBootstrapPublicationResult, type RelayBootstrapVisibilityResult, type RelayMetadataShape, type RetentionRecord, SSH_PUBLIC_KEY_PATTERN, SUCCESSFUL_DEPLOYMENTS_AGGREGATE_KEY, type TcpProbeResult, type TierSpec, VM_BOOTSTRAP_CONFIG_AGGREGATE_KEY, VM_BOOTSTRAP_CONFIG_HISTORY_RETENTION_MS, VM_BOOTSTRAP_CONFIG_SIGNAL_POST_TYPE, VM_BOOTSTRAP_CONFIG_SIGNAL_REF, appendDeploymentTokenToSshPublicKey, assertValidTrustedExecution, broadcastAlephMessage, buildPaymentQuote, cleanupFailedDeployment, compareAlephVmVersions, configureOrbitdbRelaySetup, configureUcGoPeer, configureUcanStore, createDeploymentIntent, createDeploymentToken, createInstanceContent, createPortForwardAggregateContent, createRelayBootstrapRegistrationId, createReleaseMetadata, createUnsignedAggregateMessage, createUnsignedForgetMessage, createUnsignedInstanceMessage, createVmBootstrapConfigAggregateContent, crnExecutionAbsent, deleteVmBootstrapConfig, deployInstance, describeRejectedDeployment, describeRuntimeAvailability, enrichCrnsWithGeo, enrichCrnsWithTee, ensureInstancePortForwards, eraseInstanceOnCrn, extractInsufficientBalanceMessage, extractProxyUrl, extractReferenceHashes, fetch2n6WebAccessUrl, fetchAggregateKey, fetchCrnExecutionMap, fetchCrns, fetchCrnsFromAggregate, fetchCrnsFromList, fetchCrnsWithSource, fetchMessageEnvelope, fetchPortForwardAggregate, fetchRelayMetadataForRuntime, fetchSchedulerAllocation, fetchUcGoPeerMetadata, fetchVmBootstrapConfigAggregate, fetchVmBootstrapConfigSignals, fetchVmRuntime, filterDeployableCrns, filterReachableCrns, findCrnByHash, forgetAlephMessages, inspectDeploymentResult, inspectMessageResult, isConfidentialCrn, isInvalidMessageFormatResponse, isRetryableBroadcastFailure, isTransientMessageLookupError, isValidSshPublicKey, listGeocodedCrns, listStaleVmBootstrapConfigAggregateMessageHashes, mapResourceNodesToCrns, mergePortFlagMaps, mergeRequiredPortForwards, messageTypeFromEnvelope, normalizeBroadcastStatus, normalizeExecution, normalizeExistingPortForwardEntry, normalizeMessageStatus, normalizeProxyUrl, normalizeSshPublicKey, notifyCrnAllocation, notifyCrnAllocationWithRetry, portForwardLabel, postBroadcastPayload, probeCrnAvailability, probeCrnTee, probeRootfsGateway, publishAggregateKey, publishRelayBootstrapRegistration, publishVmBootstrapConfig, quoteRequiredBudgetUnits, rankCandidateCrns, reconcileOwnerRelayBootstrapRegistrations, requestedPortFlags, requiredInstancePortForwards, resolveInstanceCrn, resolveRootfsReference, retainSuccessfulDeployments, selectPreferredCrn, selectedTier, signAlephMessage, signaturePayload, tierSpec, validateRootfsManifest, verifyRootfsExists, verifyUcGoPeerReachability, waitForDeploymentResult, waitForRelayBootstrapRegistration, waitForSetupEndpoint, waitForVmBootstrapConfigSignal, waitForVmRuntime };
1091
+ export { type ConfidentialRequirement, type CrnCapacitySpec, type CrnEraseResult, type CrnResolutionResult, type CrnSource, type CrnSourceOptions, type CrnSourceResult, DEFAULT_ALEPH_API_HOST, DEFAULT_ALEPH_CHANNEL, DEFAULT_COUNTRY_LOOKUP_BASE_URL, DEFAULT_CRN_AGGREGATE_ADDRESS, DEFAULT_CRN_AGGREGATE_API_HOSTS, DEFAULT_CRN_AGGREGATE_KEY, DEFAULT_CRN_LIST_URL, DEFAULT_DNS_RESOLVE_URL, DEFAULT_INSTANCE_PORT_FORWARDS, DEFAULT_IPFS_GATEWAY_BASE_URL, DEFAULT_SCHEDULER_ALLOCATION_URL, DEFAULT_SEV_SNP_POLICY, DEFAULT_TWO_N_SIX_HASH_URL, type FetchLike, type FetchLikeResponse, type HttpProbeResult, ITEM_HASH_RE, type JsonFetchLike$1 as JsonFetchLike, type JsonFetchLikeResponse, MIN_CONFIDENTIAL_ALEPH_VM_VERSION, type OwnerRelayBootstrapReconcileResult, type PaymentQuote, type RelayBootstrapPublicationResult, type RelayBootstrapVisibilityResult, type RelayMetadataShape, type RetentionRecord, SETUP_SECRET_HEADER, SSH_PUBLIC_KEY_PATTERN, SUCCESSFUL_DEPLOYMENTS_AGGREGATE_KEY, type TcpProbeResult, type TierSpec, VM_BOOTSTRAP_CONFIG_AGGREGATE_KEY, VM_BOOTSTRAP_CONFIG_HISTORY_RETENTION_MS, VM_BOOTSTRAP_CONFIG_SIGNAL_POST_TYPE, VM_BOOTSTRAP_CONFIG_SIGNAL_REF, appendDeploymentTokenToSshPublicKey, appendSetupMarkerToSshPublicKey, assertValidTrustedExecution, broadcastAlephMessage, buildPaymentQuote, cleanupFailedDeployment, compareAlephVmVersions, configureOrbitdbRelaySetup, configureUcGoPeer, configureUcanStore, createDeploymentIntent, createDeploymentToken, createInstanceContent, createPortForwardAggregateContent, createRelayBootstrapRegistrationId, createReleaseMetadata, createSetupSecret, createUnsignedAggregateMessage, createUnsignedForgetMessage, createUnsignedInstanceMessage, createVmBootstrapConfigAggregateContent, crnExecutionAbsent, deleteVmBootstrapConfig, deployInstance, describeRejectedDeployment, describeRuntimeAvailability, enrichCrnsWithGeo, enrichCrnsWithTee, ensureInstancePortForwards, eraseInstanceOnCrn, extractInsufficientBalanceMessage, extractProxyUrl, extractReferenceHashes, fetch2n6WebAccessUrl, fetchAggregateKey, fetchCrnExecutionMap, fetchCrns, fetchCrnsFromAggregate, fetchCrnsFromList, fetchCrnsWithSource, fetchMessageEnvelope, fetchPortForwardAggregate, fetchRelayMetadataForRuntime, fetchSchedulerAllocation, fetchUcGoPeerMetadata, fetchVmBootstrapConfigAggregate, fetchVmBootstrapConfigSignals, fetchVmRuntime, filterDeployableCrns, filterReachableCrns, findCrnByHash, forgetAlephMessages, inspectDeploymentResult, inspectMessageResult, isConfidentialCrn, isInvalidMessageFormatResponse, isRetryableBroadcastFailure, isTransientMessageLookupError, isValidSshPublicKey, listGeocodedCrns, listStaleVmBootstrapConfigAggregateMessageHashes, mapResourceNodesToCrns, mergePortFlagMaps, mergeRequiredPortForwards, messageTypeFromEnvelope, normalizeBroadcastStatus, normalizeExecution, normalizeExistingPortForwardEntry, normalizeMessageStatus, normalizeProxyUrl, normalizeSshPublicKey, notifyCrnAllocation, notifyCrnAllocationWithRetry, portForwardLabel, postBroadcastPayload, probeCrnAvailability, probeCrnTee, probeRootfsGateway, publishAggregateKey, publishRelayBootstrapRegistration, publishVmBootstrapConfig, quoteRequiredBudgetUnits, rankCandidateCrns, reconcileOwnerRelayBootstrapRegistrations, requestedPortFlags, requiredInstancePortForwards, resolveInstanceCrn, resolveRootfsReference, retainSuccessfulDeployments, selectPreferredCrn, selectedTier, setupSecretDigest, signAlephMessage, signaturePayload, tierSpec, validateRootfsManifest, verifyRootfsExists, verifyUcGoPeerReachability, waitForDeploymentResult, waitForRelayBootstrapRegistration, waitForSetupEndpoint, waitForVmBootstrapConfigSignal, waitForVmRuntime };
package/index.js CHANGED
@@ -2096,6 +2096,25 @@ function appendDeploymentTokenToSshPublicKey(sshPublicKey, ownerAddress, deploym
2096
2096
  }
2097
2097
  return `${algorithm} ${key} aleph-bootstrap-config:${owner}:${token}`;
2098
2098
  }
2099
+ var SETUP_SECRET_HEADER = "x-aleph-setup-secret";
2100
+ function createSetupSecret() {
2101
+ const bytes = new Uint8Array(32);
2102
+ globalThis.crypto.getRandomValues(bytes);
2103
+ return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
2104
+ }
2105
+ async function setupSecretDigest(secret) {
2106
+ const digest = await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(secret.trim()));
2107
+ return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("");
2108
+ }
2109
+ function appendSetupMarkerToSshPublicKey(sshPublicKey, ownerAddress, secretDigest) {
2110
+ const normalized = normalizeSshPublicKey(sshPublicKey);
2111
+ const owner = ownerAddress.trim().toLowerCase();
2112
+ const digest = secretDigest.trim().toLowerCase();
2113
+ if (!normalized || !owner || /[\s:]/.test(owner) || !/^[0-9a-f]{64}$/.test(digest)) {
2114
+ return normalized;
2115
+ }
2116
+ return `${normalized} aleph-setup:${owner}:${digest}`;
2117
+ }
2099
2118
  function createReleaseMetadata(name, rootfsVersion, deployer = "relay-button") {
2100
2119
  return {
2101
2120
  name,
@@ -2457,7 +2476,8 @@ async function configureUcGoPeer(args) {
2457
2476
  {
2458
2477
  method: "POST",
2459
2478
  headers: {
2460
- "content-type": "application/json"
2479
+ "content-type": "application/json",
2480
+ ...args.setupSecret ? { [SETUP_SECRET_HEADER]: args.setupSecret } : {}
2461
2481
  },
2462
2482
  body: JSON.stringify(payload),
2463
2483
  signal: controller.signal
@@ -2502,7 +2522,8 @@ async function configureOrbitdbRelaySetup(args) {
2502
2522
  {
2503
2523
  method: "POST",
2504
2524
  headers: {
2505
- "content-type": "application/json"
2525
+ "content-type": "application/json",
2526
+ ...args.setupSecret ? { [SETUP_SECRET_HEADER]: args.setupSecret } : {}
2506
2527
  },
2507
2528
  body: JSON.stringify(payload),
2508
2529
  signal: controller.signal
@@ -3875,6 +3896,7 @@ export {
3875
3896
  DEFAULT_TWO_N_SIX_HASH_URL,
3876
3897
  ITEM_HASH_RE,
3877
3898
  MIN_CONFIDENTIAL_ALEPH_VM_VERSION,
3899
+ SETUP_SECRET_HEADER,
3878
3900
  SSH_PUBLIC_KEY_PATTERN,
3879
3901
  SUCCESSFUL_DEPLOYMENTS_AGGREGATE_KEY,
3880
3902
  VM_BOOTSTRAP_CONFIG_AGGREGATE_KEY,
@@ -3882,6 +3904,7 @@ export {
3882
3904
  VM_BOOTSTRAP_CONFIG_SIGNAL_POST_TYPE,
3883
3905
  VM_BOOTSTRAP_CONFIG_SIGNAL_REF,
3884
3906
  appendDeploymentTokenToSshPublicKey,
3907
+ appendSetupMarkerToSshPublicKey,
3885
3908
  assertValidTrustedExecution,
3886
3909
  broadcastAlephMessage,
3887
3910
  buildPaymentQuote,
@@ -3896,6 +3919,7 @@ export {
3896
3919
  createPortForwardAggregateContent,
3897
3920
  createRelayBootstrapRegistrationId,
3898
3921
  createReleaseMetadata,
3922
+ createSetupSecret,
3899
3923
  createUnsignedAggregateMessage2 as createUnsignedAggregateMessage,
3900
3924
  createUnsignedForgetMessage,
3901
3925
  createUnsignedInstanceMessage,
@@ -3970,6 +3994,7 @@ export {
3970
3994
  retainSuccessfulDeployments,
3971
3995
  selectPreferredCrn,
3972
3996
  selectedTier,
3997
+ setupSecretDigest,
3973
3998
  signAlephMessage,
3974
3999
  signaturePayload,
3975
4000
  tierSpec,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@le-space/core",
3
- "version": "0.12.8",
3
+ "version": "0.12.10",
4
4
  "description": "Reusable Aleph deployment, runtime, and guest lifecycle logic.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,7 +24,7 @@
24
24
  "url": "https://github.com/NiKrause/relay-button/issues"
25
25
  },
26
26
  "dependencies": {
27
- "@le-space/aleph-bootstrap": "0.12.8",
28
- "@le-space/shared-types": "0.12.8"
27
+ "@le-space/aleph-bootstrap": "0.12.10",
28
+ "@le-space/shared-types": "0.12.10"
29
29
  }
30
30
  }