space-data-module-sdk 0.6.1 → 0.8.0

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 (35) hide show
  1. package/README.md +16 -23
  2. package/bin/space-data-module.js +5 -3
  3. package/package.json +6 -2
  4. package/src/AGENTS.md +1 -1
  5. package/src/browser.js +1 -0
  6. package/src/bundle/AGENTS.md +6 -5
  7. package/src/bundle/codec.js +163 -48
  8. package/src/bundle/constants.js +1 -1
  9. package/src/bundle/wasm.js +22 -23
  10. package/src/compiler/compileModule.js +9 -1
  11. package/src/index.d.ts +189 -1
  12. package/src/index.js +1 -0
  13. package/src/licensing/index.d.ts +20 -0
  14. package/src/licensing/index.js +11 -0
  15. package/src/licensing/records.js +858 -0
  16. package/src/transport/records.js +34 -3
  17. package/schemas/ModuleBundle.fbs +0 -108
  18. package/src/generated/orbpro/module/canonicalization-rule.d.ts +0 -48
  19. package/src/generated/orbpro/module/canonicalization-rule.js +0 -95
  20. package/src/generated/orbpro/module/canonicalization-rule.ts +0 -142
  21. package/src/generated/orbpro/module/module-bundle-entry-role.d.ts +0 -11
  22. package/src/generated/orbpro/module/module-bundle-entry-role.js +0 -14
  23. package/src/generated/orbpro/module/module-bundle-entry-role.ts +0 -15
  24. package/src/generated/orbpro/module/module-bundle-entry.d.ts +0 -97
  25. package/src/generated/orbpro/module/module-bundle-entry.js +0 -219
  26. package/src/generated/orbpro/module/module-bundle-entry.ts +0 -287
  27. package/src/generated/orbpro/module/module-bundle.d.ts +0 -86
  28. package/src/generated/orbpro/module/module-bundle.js +0 -213
  29. package/src/generated/orbpro/module/module-bundle.ts +0 -277
  30. package/src/generated/orbpro/module/module-payload-encoding.d.ts +0 -9
  31. package/src/generated/orbpro/module/module-payload-encoding.js +0 -12
  32. package/src/generated/orbpro/module/module-payload-encoding.ts +0 -13
  33. package/src/generated/orbpro/module.d.ts +0 -5
  34. package/src/generated/orbpro/module.js +0 -7
  35. package/src/generated/orbpro/module.ts +0 -9
package/src/index.d.ts CHANGED
@@ -937,7 +937,7 @@ export function validateManifestAgainstStandardsCatalog(
937
937
 
938
938
  // --- Bundle ---
939
939
 
940
- export const SDS_BUNDLE_SECTION_NAME: string;
940
+ export const SDS_MBL_CONTAINER_NAME: string;
941
941
  export const DEFAULT_HASH_ALGORITHM: string;
942
942
  export const SDS_GUEST_LINK_OBJECT_ENTRY_ID: string;
943
943
  export const SDS_GUEST_LINK_METADATA_ENTRY_ID: string;
@@ -1783,6 +1783,194 @@ export function inspectModule(source: Uint8Array | ArrayBuffer | WebAssembly.Mod
1783
1783
  imports: WebAssembly.ModuleImportDescriptor[];
1784
1784
  }>;
1785
1785
 
1786
+ // --- Licensing ---
1787
+
1788
+ export class LicensingProtocolError extends Error {
1789
+ code: string;
1790
+ constructor(code: string, message: string);
1791
+ }
1792
+
1793
+ export interface LicensingChallengeMessage {
1794
+ messageType: string;
1795
+ role: string;
1796
+ reqId: string;
1797
+ moduleId: string;
1798
+ moduleVersion?: string;
1799
+ requesterPeerId?: string;
1800
+ requesterXpub?: string;
1801
+ requesterSigningPublicKey?: Uint8Array;
1802
+ requesterEphemeralPublicKey?: Uint8Array;
1803
+ requestedDomain?: string;
1804
+ requestedTimeoutMs?: number;
1805
+ requestedAtMs?: number;
1806
+ challengeNonce?: Uint8Array;
1807
+ expiresAtMs?: number;
1808
+ providerPeerId?: string;
1809
+ errorCode?: string;
1810
+ errorMessage?: string;
1811
+ rawBytes: Uint8Array;
1812
+ }
1813
+
1814
+ export interface LicensingProofMessage {
1815
+ messageType: string;
1816
+ reqId: string;
1817
+ moduleId: string;
1818
+ moduleVersion?: string;
1819
+ requesterPeerId?: string;
1820
+ requesterXpub?: string;
1821
+ requestedDomain?: string;
1822
+ requestedTimeoutMs: number;
1823
+ requesterEphemeralPublicKey: Uint8Array;
1824
+ challengeNonce: Uint8Array;
1825
+ challengeExpiresAtMs: number;
1826
+ providerPeerId?: string;
1827
+ signature: Uint8Array;
1828
+ requesterSigningPublicKey: Uint8Array;
1829
+ timestampMs: number;
1830
+ rejectionCode?: string;
1831
+ rejectionMessage?: string;
1832
+ rawBytes: Uint8Array;
1833
+ }
1834
+
1835
+ export interface LicensingGrantModuleDescriptor {
1836
+ cid: string;
1837
+ contentHash: Uint8Array;
1838
+ sizeBytes: number;
1839
+ moduleId: string;
1840
+ moduleVersion?: string;
1841
+ requiredScope?: string;
1842
+ keyId?: string;
1843
+ allowedDomains: string[];
1844
+ maxGrantTimeoutMs: number;
1845
+ encrypted: boolean;
1846
+ }
1847
+
1848
+ export interface LicensingWrappedContentKeyHeader {
1849
+ version: number;
1850
+ keyExchange: string;
1851
+ symmetric: string;
1852
+ keyDerivation: string;
1853
+ ephemeralPublicKey: Uint8Array;
1854
+ nonceStart: Uint8Array;
1855
+ recipientKeyId: Uint8Array;
1856
+ context?: string;
1857
+ schemaHash: Uint8Array;
1858
+ rootType?: string;
1859
+ timestamp?: number;
1860
+ }
1861
+
1862
+ export interface LicensingWrappedContentKey {
1863
+ wrappingAlgorithm: string;
1864
+ contentKeyId?: string;
1865
+ contentKeyRole?: string;
1866
+ contentKeyAlgorithm?: string;
1867
+ contentKeyEncoding?: string;
1868
+ keyBytes: Uint8Array;
1869
+ contentKeyVersion?: number;
1870
+ recipientKeyId?: string;
1871
+ requesterEphemeralPublicKey: Uint8Array;
1872
+ providerEphemeralPublicKey: Uint8Array;
1873
+ hkdfSalt: Uint8Array;
1874
+ iv: Uint8Array;
1875
+ ciphertext: Uint8Array;
1876
+ tag: Uint8Array;
1877
+ expiresAtMs: number;
1878
+ recipientPublicKey: Uint8Array;
1879
+ ephemeralPublicKey: Uint8Array;
1880
+ nonce: Uint8Array;
1881
+ header: LicensingWrappedContentKeyHeader;
1882
+ encryptedPayload: Uint8Array;
1883
+ recipientKeyIdBytes: Uint8Array;
1884
+ schemaHash: Uint8Array;
1885
+ keyMaterialRootType?: string;
1886
+ }
1887
+
1888
+ export interface LicensingGrantMessage {
1889
+ messageType: string;
1890
+ reqId: string;
1891
+ moduleId: string;
1892
+ moduleVersion?: string;
1893
+ requesterPeerId?: string;
1894
+ requesterXpub?: string;
1895
+ requestedDomain?: string;
1896
+ requestedTimeoutMs: number;
1897
+ grantedDomain?: string;
1898
+ grantedTimeoutMs: number;
1899
+ expiresAtMs: number;
1900
+ requiredScope?: string;
1901
+ grantStatus?: string;
1902
+ denialReason?: string;
1903
+ capabilityToken: Uint8Array;
1904
+ grantVerifierPublicKey: Uint8Array;
1905
+ providerSignature: Uint8Array;
1906
+ moduleDescriptor: LicensingGrantModuleDescriptor | null;
1907
+ wrappedContentKey: LicensingWrappedContentKey | null;
1908
+ rawBytes: Uint8Array;
1909
+ }
1910
+
1911
+ export function encodeLicensingChallengeRequest(options: {
1912
+ reqId: string;
1913
+ moduleId: string;
1914
+ moduleVersion?: string;
1915
+ requesterPeerId: string;
1916
+ requesterXpub?: string;
1917
+ requesterSigningPublicKey: Uint8Array;
1918
+ requesterEphemeralPublicKey: Uint8Array;
1919
+ requesterDomain: string;
1920
+ requestedTimeoutMs: number;
1921
+ requestedAtMs: number;
1922
+ providerPeerId: string;
1923
+ }): Uint8Array;
1924
+
1925
+ export function decodeLicensingChallengeMessage(
1926
+ bytes: Uint8Array | ArrayBuffer | ArrayBufferView,
1927
+ ): LicensingChallengeMessage;
1928
+
1929
+ export function encodeLicensingProof(options: {
1930
+ reqId: string;
1931
+ moduleId: string;
1932
+ moduleVersion?: string;
1933
+ requesterPeerId: string;
1934
+ requesterXpub?: string;
1935
+ requesterDomain: string;
1936
+ requestedTimeoutMs: number;
1937
+ requesterEphemeralPublicKey: Uint8Array;
1938
+ challengeNonce: Uint8Array;
1939
+ challengeExpiresAtMs: number;
1940
+ providerPeerId: string;
1941
+ signature: Uint8Array;
1942
+ requesterSigningPublicKey: Uint8Array;
1943
+ timestampMs: number;
1944
+ }): Uint8Array;
1945
+
1946
+ export function decodeLicensingProofMessage(
1947
+ bytes: Uint8Array | ArrayBuffer | ArrayBufferView,
1948
+ ): LicensingProofMessage;
1949
+
1950
+ export function decodeLicensingGrant(
1951
+ bytes: Uint8Array | ArrayBuffer | ArrayBufferView,
1952
+ ): LicensingGrantMessage;
1953
+
1954
+ export function validateLicensingGrant(
1955
+ grant: LicensingGrantMessage,
1956
+ options?: {
1957
+ reqId?: string;
1958
+ moduleId?: string;
1959
+ moduleVersion?: string;
1960
+ expectedDomain?: string;
1961
+ requestedTimeoutMs?: number;
1962
+ grantVerifierPublicKeyLength?: number;
1963
+ },
1964
+ ): LicensingGrantMessage;
1965
+
1966
+ export function extractGrantModuleDescriptor(
1967
+ grant: LicensingGrantMessage,
1968
+ ): LicensingGrantModuleDescriptor;
1969
+
1970
+ export function extractWrappedContentKey(
1971
+ grant: LicensingGrantMessage,
1972
+ ): LicensingWrappedContentKey;
1973
+
1786
1974
  // --- Runtime constants ---
1787
1975
 
1788
1976
  export const DefaultManifestExports: {
package/src/index.js CHANGED
@@ -2,6 +2,7 @@ export * from "./manifest/index.js";
2
2
  export * from "./compliance/index.js";
3
3
  export * from "./auth/index.js";
4
4
  export * from "./transport/index.js";
5
+ export * from "./licensing/index.js";
5
6
  export * from "./compiler/index.js";
6
7
  export * from "./bundle/index.js";
7
8
  export * from "./capabilities.js";
@@ -0,0 +1,20 @@
1
+ export { LicensingProtocolError } from "../index.js";
2
+ export {
3
+ decodeLicensingChallengeMessage,
4
+ decodeLicensingGrant,
5
+ decodeLicensingProofMessage,
6
+ encodeLicensingChallengeRequest,
7
+ encodeLicensingProof,
8
+ extractGrantModuleDescriptor,
9
+ extractWrappedContentKey,
10
+ validateLicensingGrant,
11
+ } from "../index.js";
12
+
13
+ export type {
14
+ LicensingChallengeMessage,
15
+ LicensingGrantMessage,
16
+ LicensingGrantModuleDescriptor,
17
+ LicensingProofMessage,
18
+ LicensingWrappedContentKey,
19
+ LicensingWrappedContentKeyHeader,
20
+ } from "../index.js";
@@ -0,0 +1,11 @@
1
+ export {
2
+ LicensingProtocolError,
3
+ decodeLicensingChallengeMessage,
4
+ decodeLicensingGrant,
5
+ decodeLicensingProofMessage,
6
+ encodeLicensingChallengeRequest,
7
+ encodeLicensingProof,
8
+ extractGrantModuleDescriptor,
9
+ extractWrappedContentKey,
10
+ validateLicensingGrant,
11
+ } from "./records.js";