@hashproof/sdk 0.2.0 → 0.2.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.cts CHANGED
@@ -1,6 +1,171 @@
1
- import * as _hashproof_shared from '@hashproof/shared';
2
- import { ResolveResult, VerifyResult, ManifestData, PaginatedResponse } from '@hashproof/shared';
3
- export { ApiError, ApiKey, ApiScope, Assertion, ComplianceDetail, ComplianceReport, HardBinding, Ingredient, ManifestData, MerkleAnchor, MerkleProof, PaginatedResponse, ResolveMatch, ResolveResult, SignatureInfo, SoftBinding, SoftBindingAlgorithm, SubscriptionTier, UsageSummary, ValidationError, ValidationResult, ValidationStatus, VerifyResult } from '@hashproof/shared';
1
+ interface ManifestData {
2
+ id: string;
3
+ title?: string;
4
+ format: string;
5
+ instanceId: string;
6
+ claimGenerator: string;
7
+ signatureInfo: SignatureInfo;
8
+ assertions: Assertion[];
9
+ ingredients: Ingredient[];
10
+ hardBinding: HardBinding;
11
+ validationStatus: ValidationStatus;
12
+ rawSize: number;
13
+ createdAt: string;
14
+ /** C-6: IPFS Content Identifier (CIDv1, base32). Set by storeManifest
15
+ * after manifest creation. Null for legacy rows that predate C-6. */
16
+ cid?: string | null;
17
+ }
18
+ interface SignatureInfo {
19
+ issuer: string;
20
+ subject: string;
21
+ algorithm: string;
22
+ certSerialNumber: string;
23
+ signedAt: string;
24
+ certChain: string[];
25
+ }
26
+ interface Assertion {
27
+ label: string;
28
+ data: Record<string, unknown>;
29
+ kind: 'cbor' | 'json' | 'binary';
30
+ }
31
+ interface Ingredient {
32
+ title: string;
33
+ format: string;
34
+ instanceId: string;
35
+ relationship: 'parentOf' | 'componentOf' | 'inputTo';
36
+ hash: string;
37
+ }
38
+ interface HardBinding {
39
+ algorithm: 'SHA-256' | 'SHA-384' | 'SHA-512';
40
+ hash: string;
41
+ padding?: number[];
42
+ }
43
+ type ValidationStatus = 'well_formed' | 'valid' | 'trusted' | 'unknown';
44
+ interface ValidationResult {
45
+ status: ValidationStatus;
46
+ errors: ValidationError[];
47
+ warnings: string[];
48
+ trustChainValid: boolean;
49
+ signerTrusted: boolean;
50
+ trustDetails?: {
51
+ inTrustList: boolean;
52
+ issuer: string;
53
+ subject: string;
54
+ signedAt: string | null;
55
+ signedAtValid: boolean;
56
+ revocationChecked: false;
57
+ };
58
+ }
59
+ interface ValidationError {
60
+ code: string;
61
+ message: string;
62
+ path?: string;
63
+ }
64
+ type SoftBindingAlgorithm = 'phash-dct-64' | 'dhash-64' | 'chromaprint' | 'iscc' | 'neural-sscd-v1';
65
+ interface SoftBinding {
66
+ id: string;
67
+ manifestId: string;
68
+ bindingType: 'phash' | 'dhash' | 'watermark' | 'fingerprint';
69
+ bindingValue: string;
70
+ algorithm: SoftBindingAlgorithm;
71
+ createdAt: string;
72
+ }
73
+ interface ResolveResult {
74
+ matches: ResolveMatch[];
75
+ query: {
76
+ fingerprint: string;
77
+ algorithm: SoftBindingAlgorithm;
78
+ };
79
+ searchTimeMs: number;
80
+ }
81
+ interface ResolveMatch {
82
+ manifestId: string;
83
+ distance: number;
84
+ similarity: number;
85
+ manifest: ManifestData;
86
+ /** Set by federation cascade (C-2) to indicate which peer served the match:
87
+ * 'local' | 'federation:<nodeId>' | 'federation:cascade:<nodeId-1>→<nodeId-2>'. */
88
+ resolvedVia?: string;
89
+ }
90
+ interface VerifyResult {
91
+ hasProvenance: boolean;
92
+ source: 'embedded' | 'resolved' | 'none';
93
+ manifest: ManifestData | null;
94
+ validation: ValidationResult | null;
95
+ trustStatus: 'trusted' | 'untrusted' | 'unknown';
96
+ resolvedVia?: string;
97
+ }
98
+ interface ApiKey {
99
+ id: string;
100
+ name: string;
101
+ keyPrefix: string;
102
+ scopes: ApiScope[];
103
+ rateLimit: number;
104
+ tier: SubscriptionTier;
105
+ createdAt: string;
106
+ lastUsedAt: string | null;
107
+ expiresAt: string | null;
108
+ }
109
+ type ApiScope = 'manifests:read' | 'manifests:write' | 'resolve' | 'verify' | 'sign' | 'reports';
110
+ type SubscriptionTier = 'free' | 'growth' | 'scale' | 'enterprise';
111
+ interface UsageSummary {
112
+ period: string;
113
+ manifestStores: number;
114
+ resolutionQueries: number;
115
+ verificationCalls: number;
116
+ signingRequests: number;
117
+ }
118
+ interface ComplianceReport {
119
+ id: string;
120
+ organizationId: string;
121
+ reportType: 'eu-ai-act' | 'general';
122
+ generatedAt: string;
123
+ summary: {
124
+ totalAssets: number;
125
+ assetsWithProvenance: number;
126
+ compliancePercentage: number;
127
+ aiGeneratedCount: number;
128
+ aiDisclosedCount: number;
129
+ certificateIssues: number;
130
+ };
131
+ details: ComplianceDetail[];
132
+ }
133
+ interface ComplianceDetail {
134
+ manifestId: string;
135
+ assetTitle: string;
136
+ issues: string[];
137
+ status: 'compliant' | 'non_compliant' | 'needs_review';
138
+ }
139
+ interface MerkleAnchor {
140
+ id: string;
141
+ merkleRoot: string;
142
+ transactionHash: string;
143
+ chainId: number;
144
+ blockNumber: number;
145
+ batchSize: number;
146
+ anchoredAt: string;
147
+ }
148
+ interface MerkleProof {
149
+ manifestId: string;
150
+ root: string;
151
+ proof: string[];
152
+ index: number;
153
+ anchor: MerkleAnchor;
154
+ verified: boolean;
155
+ }
156
+ interface PaginatedResponse<T> {
157
+ data: T[];
158
+ total: number;
159
+ page: number;
160
+ perPage: number;
161
+ hasMore: boolean;
162
+ }
163
+ interface ApiError {
164
+ error: string;
165
+ code: string;
166
+ statusCode: number;
167
+ details?: Record<string, unknown>;
168
+ }
4
169
 
5
170
  /** Options for constructing the HashproofClient. */
6
171
  interface HashproofClientOptions {
@@ -14,7 +179,7 @@ interface HashproofClientOptions {
14
179
  /** Result returned from the store() method. */
15
180
  interface StoreResult {
16
181
  manifestId: string;
17
- manifest: _hashproof_shared.ManifestData;
182
+ manifest: ManifestData;
18
183
  softBindings: Array<{
19
184
  algorithm: string;
20
185
  value: string;
@@ -23,14 +188,14 @@ interface StoreResult {
23
188
  /** Result returned from the sign() method. */
24
189
  interface SignResult {
25
190
  manifestId: string;
26
- manifest: _hashproof_shared.ManifestData;
191
+ manifest: ManifestData;
27
192
  signedAssetUrl: string | null;
28
193
  message: string;
29
194
  }
30
195
  /** Result returned from the computeFingerprint() method. */
31
196
  interface FingerprintResult {
32
197
  fingerprint: string;
33
- algorithm: _hashproof_shared.SoftBindingAlgorithm;
198
+ algorithm: SoftBindingAlgorithm;
34
199
  bitLength: number;
35
200
  }
36
201
  /** Error thrown by the SDK for API error responses. */
@@ -228,4 +393,4 @@ declare class HashproofClient {
228
393
  private request;
229
394
  }
230
395
 
231
- export { type FingerprintResult, HashproofApiError, HashproofClient, type HashproofClientOptions, type SignResult, type StoreResult };
396
+ export { type ApiError, type ApiKey, type ApiScope, type Assertion, type ComplianceDetail, type ComplianceReport, type FingerprintResult, type HardBinding, HashproofApiError, HashproofClient, type HashproofClientOptions, type Ingredient, type ManifestData, type MerkleAnchor, type MerkleProof, type PaginatedResponse, type ResolveMatch, type ResolveResult, type SignResult, type SignatureInfo, type SoftBinding, type SoftBindingAlgorithm, type StoreResult, type SubscriptionTier, type UsageSummary, type ValidationError, type ValidationResult, type ValidationStatus, type VerifyResult };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,171 @@
1
- import * as _hashproof_shared from '@hashproof/shared';
2
- import { ResolveResult, VerifyResult, ManifestData, PaginatedResponse } from '@hashproof/shared';
3
- export { ApiError, ApiKey, ApiScope, Assertion, ComplianceDetail, ComplianceReport, HardBinding, Ingredient, ManifestData, MerkleAnchor, MerkleProof, PaginatedResponse, ResolveMatch, ResolveResult, SignatureInfo, SoftBinding, SoftBindingAlgorithm, SubscriptionTier, UsageSummary, ValidationError, ValidationResult, ValidationStatus, VerifyResult } from '@hashproof/shared';
1
+ interface ManifestData {
2
+ id: string;
3
+ title?: string;
4
+ format: string;
5
+ instanceId: string;
6
+ claimGenerator: string;
7
+ signatureInfo: SignatureInfo;
8
+ assertions: Assertion[];
9
+ ingredients: Ingredient[];
10
+ hardBinding: HardBinding;
11
+ validationStatus: ValidationStatus;
12
+ rawSize: number;
13
+ createdAt: string;
14
+ /** C-6: IPFS Content Identifier (CIDv1, base32). Set by storeManifest
15
+ * after manifest creation. Null for legacy rows that predate C-6. */
16
+ cid?: string | null;
17
+ }
18
+ interface SignatureInfo {
19
+ issuer: string;
20
+ subject: string;
21
+ algorithm: string;
22
+ certSerialNumber: string;
23
+ signedAt: string;
24
+ certChain: string[];
25
+ }
26
+ interface Assertion {
27
+ label: string;
28
+ data: Record<string, unknown>;
29
+ kind: 'cbor' | 'json' | 'binary';
30
+ }
31
+ interface Ingredient {
32
+ title: string;
33
+ format: string;
34
+ instanceId: string;
35
+ relationship: 'parentOf' | 'componentOf' | 'inputTo';
36
+ hash: string;
37
+ }
38
+ interface HardBinding {
39
+ algorithm: 'SHA-256' | 'SHA-384' | 'SHA-512';
40
+ hash: string;
41
+ padding?: number[];
42
+ }
43
+ type ValidationStatus = 'well_formed' | 'valid' | 'trusted' | 'unknown';
44
+ interface ValidationResult {
45
+ status: ValidationStatus;
46
+ errors: ValidationError[];
47
+ warnings: string[];
48
+ trustChainValid: boolean;
49
+ signerTrusted: boolean;
50
+ trustDetails?: {
51
+ inTrustList: boolean;
52
+ issuer: string;
53
+ subject: string;
54
+ signedAt: string | null;
55
+ signedAtValid: boolean;
56
+ revocationChecked: false;
57
+ };
58
+ }
59
+ interface ValidationError {
60
+ code: string;
61
+ message: string;
62
+ path?: string;
63
+ }
64
+ type SoftBindingAlgorithm = 'phash-dct-64' | 'dhash-64' | 'chromaprint' | 'iscc' | 'neural-sscd-v1';
65
+ interface SoftBinding {
66
+ id: string;
67
+ manifestId: string;
68
+ bindingType: 'phash' | 'dhash' | 'watermark' | 'fingerprint';
69
+ bindingValue: string;
70
+ algorithm: SoftBindingAlgorithm;
71
+ createdAt: string;
72
+ }
73
+ interface ResolveResult {
74
+ matches: ResolveMatch[];
75
+ query: {
76
+ fingerprint: string;
77
+ algorithm: SoftBindingAlgorithm;
78
+ };
79
+ searchTimeMs: number;
80
+ }
81
+ interface ResolveMatch {
82
+ manifestId: string;
83
+ distance: number;
84
+ similarity: number;
85
+ manifest: ManifestData;
86
+ /** Set by federation cascade (C-2) to indicate which peer served the match:
87
+ * 'local' | 'federation:<nodeId>' | 'federation:cascade:<nodeId-1>→<nodeId-2>'. */
88
+ resolvedVia?: string;
89
+ }
90
+ interface VerifyResult {
91
+ hasProvenance: boolean;
92
+ source: 'embedded' | 'resolved' | 'none';
93
+ manifest: ManifestData | null;
94
+ validation: ValidationResult | null;
95
+ trustStatus: 'trusted' | 'untrusted' | 'unknown';
96
+ resolvedVia?: string;
97
+ }
98
+ interface ApiKey {
99
+ id: string;
100
+ name: string;
101
+ keyPrefix: string;
102
+ scopes: ApiScope[];
103
+ rateLimit: number;
104
+ tier: SubscriptionTier;
105
+ createdAt: string;
106
+ lastUsedAt: string | null;
107
+ expiresAt: string | null;
108
+ }
109
+ type ApiScope = 'manifests:read' | 'manifests:write' | 'resolve' | 'verify' | 'sign' | 'reports';
110
+ type SubscriptionTier = 'free' | 'growth' | 'scale' | 'enterprise';
111
+ interface UsageSummary {
112
+ period: string;
113
+ manifestStores: number;
114
+ resolutionQueries: number;
115
+ verificationCalls: number;
116
+ signingRequests: number;
117
+ }
118
+ interface ComplianceReport {
119
+ id: string;
120
+ organizationId: string;
121
+ reportType: 'eu-ai-act' | 'general';
122
+ generatedAt: string;
123
+ summary: {
124
+ totalAssets: number;
125
+ assetsWithProvenance: number;
126
+ compliancePercentage: number;
127
+ aiGeneratedCount: number;
128
+ aiDisclosedCount: number;
129
+ certificateIssues: number;
130
+ };
131
+ details: ComplianceDetail[];
132
+ }
133
+ interface ComplianceDetail {
134
+ manifestId: string;
135
+ assetTitle: string;
136
+ issues: string[];
137
+ status: 'compliant' | 'non_compliant' | 'needs_review';
138
+ }
139
+ interface MerkleAnchor {
140
+ id: string;
141
+ merkleRoot: string;
142
+ transactionHash: string;
143
+ chainId: number;
144
+ blockNumber: number;
145
+ batchSize: number;
146
+ anchoredAt: string;
147
+ }
148
+ interface MerkleProof {
149
+ manifestId: string;
150
+ root: string;
151
+ proof: string[];
152
+ index: number;
153
+ anchor: MerkleAnchor;
154
+ verified: boolean;
155
+ }
156
+ interface PaginatedResponse<T> {
157
+ data: T[];
158
+ total: number;
159
+ page: number;
160
+ perPage: number;
161
+ hasMore: boolean;
162
+ }
163
+ interface ApiError {
164
+ error: string;
165
+ code: string;
166
+ statusCode: number;
167
+ details?: Record<string, unknown>;
168
+ }
4
169
 
5
170
  /** Options for constructing the HashproofClient. */
6
171
  interface HashproofClientOptions {
@@ -14,7 +179,7 @@ interface HashproofClientOptions {
14
179
  /** Result returned from the store() method. */
15
180
  interface StoreResult {
16
181
  manifestId: string;
17
- manifest: _hashproof_shared.ManifestData;
182
+ manifest: ManifestData;
18
183
  softBindings: Array<{
19
184
  algorithm: string;
20
185
  value: string;
@@ -23,14 +188,14 @@ interface StoreResult {
23
188
  /** Result returned from the sign() method. */
24
189
  interface SignResult {
25
190
  manifestId: string;
26
- manifest: _hashproof_shared.ManifestData;
191
+ manifest: ManifestData;
27
192
  signedAssetUrl: string | null;
28
193
  message: string;
29
194
  }
30
195
  /** Result returned from the computeFingerprint() method. */
31
196
  interface FingerprintResult {
32
197
  fingerprint: string;
33
- algorithm: _hashproof_shared.SoftBindingAlgorithm;
198
+ algorithm: SoftBindingAlgorithm;
34
199
  bitLength: number;
35
200
  }
36
201
  /** Error thrown by the SDK for API error responses. */
@@ -228,4 +393,4 @@ declare class HashproofClient {
228
393
  private request;
229
394
  }
230
395
 
231
- export { type FingerprintResult, HashproofApiError, HashproofClient, type HashproofClientOptions, type SignResult, type StoreResult };
396
+ export { type ApiError, type ApiKey, type ApiScope, type Assertion, type ComplianceDetail, type ComplianceReport, type FingerprintResult, type HardBinding, HashproofApiError, HashproofClient, type HashproofClientOptions, type Ingredient, type ManifestData, type MerkleAnchor, type MerkleProof, type PaginatedResponse, type ResolveMatch, type ResolveResult, type SignResult, type SignatureInfo, type SoftBinding, type SoftBindingAlgorithm, type StoreResult, type SubscriptionTier, type UsageSummary, type ValidationError, type ValidationResult, type ValidationStatus, type VerifyResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashproof/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Hashproof Content Provenance API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -21,14 +21,15 @@
21
21
  "files": [
22
22
  "dist"
23
23
  ],
24
- "dependencies": {
25
- "@hashproof/shared": "0.1.0"
24
+ "engines": {
25
+ "node": ">=18"
26
26
  },
27
27
  "devDependencies": {
28
28
  "typescript": "^5.4.0",
29
29
  "tsup": "^8.0.0",
30
30
  "vitest": "^1.3.0",
31
- "@types/node": "^20.11.0"
31
+ "@types/node": "^20.11.0",
32
+ "@hashproof/shared": "0.1.0"
32
33
  },
33
34
  "keywords": [
34
35
  "hashproof",
@@ -44,7 +45,7 @@
44
45
  "directory": "packages/sdk-js"
45
46
  },
46
47
  "scripts": {
47
- "build": "tsup src/index.ts --format cjs,esm --dts --out-dir dist",
48
+ "build": "tsup",
48
49
  "build:tsc": "tsc",
49
50
  "test": "vitest run",
50
51
  "test:watch": "vitest",