@hauska-sdk/vda 0.1.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.
@@ -0,0 +1,138 @@
1
+ /**
2
+ * @hauska-sdk/vda
3
+ * Ownership Verification Implementation
4
+ */
5
+ /**
6
+ * Ownership Verification Service
7
+ */
8
+ export class OwnershipVerificationService {
9
+ storageAdapter;
10
+ constructor(storageAdapter) {
11
+ this.storageAdapter = storageAdapter;
12
+ }
13
+ /**
14
+ * Verify if a wallet has access to a VDA
15
+ *
16
+ * Checks both direct ownership and access pass ownership.
17
+ *
18
+ * @param vdaId - VDA ID to verify access for
19
+ * @param wallet - Wallet address to verify
20
+ * @param requiredPermissions - Optional permissions required (default: ["view"])
21
+ * @returns Ownership verification result
22
+ */
23
+ async verifyOwnership(vdaId, wallet, requiredPermissions = ["view"]) {
24
+ // Get the VDA
25
+ const vda = await this.storageAdapter.getVDA(vdaId);
26
+ if (!vda) {
27
+ return {
28
+ hasAccess: false,
29
+ accessType: null,
30
+ reason: `VDA ${vdaId} not found`,
31
+ };
32
+ }
33
+ // Check direct ownership first (fastest check)
34
+ if (vda.metadata.ownerWallet === wallet) {
35
+ return {
36
+ hasAccess: true,
37
+ accessType: "direct",
38
+ };
39
+ }
40
+ // Check access pass ownership
41
+ const accessPasses = await this.storageAdapter.listAccessPassesByOwner(wallet);
42
+ for (const accessPass of accessPasses) {
43
+ // Check if access pass grants access to this VDA
44
+ if (accessPass.metadata.accessibleVDAs?.includes(vdaId) &&
45
+ accessPass.metadata.assetType === "access-pass") {
46
+ // Check if revoked
47
+ if (accessPass.metadata.revoked) {
48
+ continue; // Access pass revoked, try next one
49
+ }
50
+ // Verify expiry is in the future
51
+ if (accessPass.metadata.expiry &&
52
+ accessPass.metadata.expiry <= Date.now()) {
53
+ continue; // Access pass expired, try next one
54
+ }
55
+ // Verify required permissions are included
56
+ const hasRequiredPermissions = requiredPermissions.every((perm) => accessPass.metadata.permissions?.includes(perm));
57
+ if (!hasRequiredPermissions) {
58
+ return {
59
+ hasAccess: false,
60
+ accessType: "access-pass",
61
+ accessPass,
62
+ reason: `Access pass does not include required permissions: ${requiredPermissions.join(", ")}`,
63
+ };
64
+ }
65
+ // Access granted via access pass
66
+ return {
67
+ hasAccess: true,
68
+ accessType: "access-pass",
69
+ accessPass,
70
+ };
71
+ }
72
+ }
73
+ // No access found
74
+ return {
75
+ hasAccess: false,
76
+ accessType: null,
77
+ reason: "Wallet does not own this VDA and has no valid access passes",
78
+ };
79
+ }
80
+ /**
81
+ * Check if a wallet has a specific permission for a VDA
82
+ *
83
+ * @param vdaId - VDA ID
84
+ * @param wallet - Wallet address
85
+ * @param permission - Permission to check
86
+ * @returns True if wallet has the permission
87
+ */
88
+ async hasPermission(vdaId, wallet, permission) {
89
+ const result = await this.verifyOwnership(vdaId, wallet, [permission]);
90
+ return result.hasAccess;
91
+ }
92
+ /**
93
+ * Check if a wallet is the direct owner of a VDA
94
+ *
95
+ * @param vdaId - VDA ID
96
+ * @param wallet - Wallet address
97
+ * @returns True if wallet is the direct owner
98
+ */
99
+ async isDirectOwner(vdaId, wallet) {
100
+ const vda = await this.storageAdapter.getVDA(vdaId);
101
+ if (!vda) {
102
+ return false;
103
+ }
104
+ return vda.metadata.ownerWallet === wallet;
105
+ }
106
+ /**
107
+ * Get all access passes that grant access to a VDA for a wallet
108
+ *
109
+ * @param vdaId - VDA ID
110
+ * @param wallet - Wallet address
111
+ * @returns Array of valid access pass VDAs
112
+ */
113
+ async getAccessPassesForVDA(vdaId, wallet) {
114
+ const accessPasses = await this.storageAdapter.listAccessPassesByOwner(wallet);
115
+ const now = Date.now();
116
+ return accessPasses.filter((accessPass) => {
117
+ // Must be an access pass
118
+ if (accessPass.metadata.assetType !== "access-pass") {
119
+ return false;
120
+ }
121
+ // Must grant access to this VDA
122
+ if (!accessPass.metadata.accessibleVDAs?.includes(vdaId)) {
123
+ return false;
124
+ }
125
+ // Must not be revoked
126
+ if (accessPass.metadata.revoked) {
127
+ return false;
128
+ }
129
+ // Must not be expired
130
+ if (accessPass.metadata.expiry &&
131
+ accessPass.metadata.expiry <= now) {
132
+ return false;
133
+ }
134
+ return true;
135
+ });
136
+ }
137
+ }
138
+ //# sourceMappingURL=ownership.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ownership.js","sourceRoot":"","sources":["../src/ownership.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+BH;;GAEG;AACH,MAAM,OAAO,4BAA4B;IAC/B,cAAc,CAAoB;IAE1C,YAAY,cAAiC;QAC3C,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,eAAe,CACnB,KAAa,EACb,MAAc,EACd,sBAAwC,CAAC,MAAM,CAAC;QAEhD,cAAc;QACd,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEpD,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO;gBACL,SAAS,EAAE,KAAK;gBAChB,UAAU,EAAE,IAAI;gBAChB,MAAM,EAAE,OAAO,KAAK,YAAY;aACjC,CAAC;QACJ,CAAC;QAED,+CAA+C;QAC/C,IAAI,GAAG,CAAC,QAAQ,CAAC,WAAW,KAAK,MAAM,EAAE,CAAC;YACxC,OAAO;gBACL,SAAS,EAAE,IAAI;gBACf,UAAU,EAAE,QAAQ;aACrB,CAAC;QACJ,CAAC;QAED,8BAA8B;QAC9B,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,uBAAuB,CACpE,MAAM,CACP,CAAC;QAEF,KAAK,MAAM,UAAU,IAAI,YAAY,EAAE,CAAC;YACtC,iDAAiD;YACjD,IACE,UAAU,CAAC,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,KAAK,CAAC;gBACnD,UAAU,CAAC,QAAQ,CAAC,SAAS,KAAK,aAAa,EAC/C,CAAC;gBACD,mBAAmB;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AAG,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAEpD,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,GAAG,CAAC,QAAQ,CAAC,WAAW,KAAK,MAAM,CAAC;IAC7C,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,qBAAqB,CACzB,KAAa,EACb,MAAc;QAEd,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,uBAAuB,CACpE,MAAM,CACP,CAAC;QACF,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEvB,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE;YACxC,yBAAyB;YACzB,IAAI,UAAU,CAAC,QAAQ,CAAC,SAAS,KAAK,aAAa,EAAE,CAAC;gBACpD,OAAO,KAAK,CAAC;YACf,CAAC;YAED,gCAAgC;YAChC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzD,OAAO,KAAK,CAAC;YACf,CAAC;YAED,sBAAsB;YACtB,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;gBAChC,OAAO,KAAK,CAAC;YACf,CAAC;YAED,sBAAsB;YACtB,IACE,UAAU,CAAC,QAAQ,CAAC,MAAM;gBAC1B,UAAU,CAAC,QAAQ,CAAC,MAAM,IAAI,GAAG,EACjC,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @hauska-sdk/vda
3
+ * Cross-Spoke Search Service
4
+ */
5
+ import type { VDAStorageAdapter, SearchOptions, SearchResult } from "./minting";
6
+ /**
7
+ * Configuration for VDA search service
8
+ */
9
+ export interface VDASearchConfig {
10
+ /**
11
+ * Storage adapter for searching VDAs
12
+ */
13
+ storageAdapter: VDAStorageAdapter;
14
+ }
15
+ /**
16
+ * VDA Search Service
17
+ *
18
+ * Provides unified search functionality across all spokes using universal metadata keys.
19
+ */
20
+ export declare class VDASearchService {
21
+ private storageAdapter;
22
+ constructor(config: VDASearchConfig);
23
+ /**
24
+ * Search VDAs by address (supports partial matching)
25
+ *
26
+ * @param address - Address to search for (supports partial matching)
27
+ * @param options - Search options (pagination, etc.)
28
+ * @returns Search results with pagination metadata
29
+ */
30
+ searchByAddress(address: string, options?: SearchOptions): Promise<SearchResult>;
31
+ /**
32
+ * Search VDAs by patient ID (exact match)
33
+ *
34
+ * @param patientId - Patient ID to search for
35
+ * @param options - Search options (pagination, etc.)
36
+ * @returns Search results with pagination metadata
37
+ */
38
+ searchByPatientId(patientId: string, options?: SearchOptions): Promise<SearchResult>;
39
+ /**
40
+ * Search VDAs by API14 (exact match)
41
+ *
42
+ * @param api14 - API14 well number to search for
43
+ * @param options - Search options (pagination, etc.)
44
+ * @returns Search results with pagination metadata
45
+ */
46
+ searchByAPI14(api14: string, options?: SearchOptions): Promise<SearchResult>;
47
+ /**
48
+ * Search VDAs across all spokes by any universal metadata key
49
+ *
50
+ * This is a convenience method that tries to search by address, patientId, or api14
51
+ * based on what's provided.
52
+ *
53
+ * @param query - Search query (address, patientId, or api14)
54
+ * @param options - Search options (pagination, etc.)
55
+ * @returns Search results with pagination metadata
56
+ */
57
+ searchUniversal(query: string, options?: SearchOptions): Promise<SearchResult>;
58
+ }
59
+ //# sourceMappingURL=search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGhF;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,cAAc,EAAE,iBAAiB,CAAC;CACnC;AAED;;;;GAIG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,cAAc,CAAoB;gBAE9B,MAAM,EAAE,eAAe;IAInC;;;;;;OAMG;IACG,eAAe,CACnB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC;IAOxB;;;;;;OAMG;IACG,iBAAiB,CACrB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC;IAIxB;;;;;;OAMG;IACG,aAAa,CACjB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC;IAIxB;;;;;;;;;OASG;IACG,eAAe,CACnB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC;CAuBzB"}
package/dist/search.js ADDED
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @hauska-sdk/vda
3
+ * Cross-Spoke Search Service
4
+ */
5
+ import { normalizeAddress } from "./validation";
6
+ /**
7
+ * VDA Search Service
8
+ *
9
+ * Provides unified search functionality across all spokes using universal metadata keys.
10
+ */
11
+ export class VDASearchService {
12
+ storageAdapter;
13
+ constructor(config) {
14
+ this.storageAdapter = config.storageAdapter;
15
+ }
16
+ /**
17
+ * Search VDAs by address (supports partial matching)
18
+ *
19
+ * @param address - Address to search for (supports partial matching)
20
+ * @param options - Search options (pagination, etc.)
21
+ * @returns Search results with pagination metadata
22
+ */
23
+ async searchByAddress(address, options) {
24
+ // Normalize address for consistent searching
25
+ const normalizedAddress = normalizeAddress(address);
26
+ return this.storageAdapter.searchByAddress(normalizedAddress, options);
27
+ }
28
+ /**
29
+ * Search VDAs by patient ID (exact match)
30
+ *
31
+ * @param patientId - Patient ID to search for
32
+ * @param options - Search options (pagination, etc.)
33
+ * @returns Search results with pagination metadata
34
+ */
35
+ async searchByPatientId(patientId, options) {
36
+ return this.storageAdapter.searchByPatientId(patientId, options);
37
+ }
38
+ /**
39
+ * Search VDAs by API14 (exact match)
40
+ *
41
+ * @param api14 - API14 well number to search for
42
+ * @param options - Search options (pagination, etc.)
43
+ * @returns Search results with pagination metadata
44
+ */
45
+ async searchByAPI14(api14, options) {
46
+ return this.storageAdapter.searchByAPI14(api14, options);
47
+ }
48
+ /**
49
+ * Search VDAs across all spokes by any universal metadata key
50
+ *
51
+ * This is a convenience method that tries to search by address, patientId, or api14
52
+ * based on what's provided.
53
+ *
54
+ * @param query - Search query (address, patientId, or api14)
55
+ * @param options - Search options (pagination, etc.)
56
+ * @returns Search results with pagination metadata
57
+ */
58
+ async searchUniversal(query, options) {
59
+ // Try to determine what type of query this is
60
+ // API14 format: XX-XXX-XXXXX-XX-XX (e.g., 42-123-12345-00-00)
61
+ const api14Pattern = /^\d{2}-\d{3}-\d{5}-\d{2}-\d{2}$/;
62
+ if (api14Pattern.test(query)) {
63
+ // Looks like an API14
64
+ return this.searchByAPI14(query, options);
65
+ }
66
+ // Check if it looks like a patient ID (alphanumeric, often with dashes or underscores)
67
+ // For now, we'll try patientId first if it doesn't contain spaces
68
+ if (!query.includes(" ") && query.length < 50) {
69
+ // Could be a patient ID, try it
70
+ const patientResults = await this.searchByPatientId(query, options);
71
+ if (patientResults.total > 0) {
72
+ return patientResults;
73
+ }
74
+ }
75
+ // Default to address search (supports partial matching)
76
+ return this.searchByAddress(query, options);
77
+ }
78
+ }
79
+ //# sourceMappingURL=search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.js","sourceRoot":"","sources":["../src/search.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAYhD;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IACnB,cAAc,CAAoB;IAE1C,YAAY,MAAuB;QACjC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;IAC9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e,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;CACF"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * @hauska-sdk/vda
3
+ * VDA Type Definitions
4
+ */
5
+ /**
6
+ * Asset types supported by the VDA system
7
+ */
8
+ export type AssetType = "deed" | "blueprint" | "permit" | "contract" | "health-record" | "well-log" | "access-pass" | "invoice";
9
+ /**
10
+ * Spoke types (industry verticals)
11
+ */
12
+ export type SpokeType = "real-estate" | "healthcare" | "oil-gas" | "architect" | "municipal";
13
+ /**
14
+ * Permission types for access passes
15
+ */
16
+ export type PermissionType = "view" | "download" | "write" | "annotate";
17
+ /**
18
+ * VDA (Verified Digital Asset) interface
19
+ *
20
+ * VDAs are metadata-only ownership proofs (regulatory safe - not tokens, not NFTs).
21
+ * The actual asset is stored on IPFS, and the VDA contains only metadata about ownership.
22
+ */
23
+ export interface VDA {
24
+ /**
25
+ * VDA ID (UUID)
26
+ */
27
+ id: string;
28
+ /**
29
+ * VDA metadata
30
+ */
31
+ metadata: VDAMetadata;
32
+ }
33
+ /**
34
+ * VDA Metadata interface
35
+ *
36
+ * Contains all metadata about a Verified Digital Asset, including universal
37
+ * metadata keys that enable cross-spoke search.
38
+ */
39
+ export interface VDAMetadata {
40
+ /**
41
+ * Asset ID (UUID) - unique identifier for the asset
42
+ */
43
+ assetId: string;
44
+ /**
45
+ * Asset type
46
+ */
47
+ assetType: AssetType;
48
+ /**
49
+ * Universal metadata keys (at least one required for cross-spoke search)
50
+ */
51
+ address?: string;
52
+ legalDesc?: string;
53
+ patientId?: string;
54
+ api14?: string;
55
+ /**
56
+ * Ownership
57
+ */
58
+ ownerWallet: string;
59
+ grantorWallet?: string;
60
+ /**
61
+ * Spoke (industry vertical)
62
+ */
63
+ spoke: SpokeType;
64
+ /**
65
+ * IPFS CID pointing to the actual asset/document
66
+ */
67
+ ipfsCid?: string;
68
+ /**
69
+ * Access pass fields (only for assetType === 'access-pass')
70
+ */
71
+ expiry?: number;
72
+ accessibleVDAs?: string[];
73
+ permissions?: PermissionType[];
74
+ revoked?: boolean;
75
+ revokedAt?: number;
76
+ /**
77
+ * Spoke-specific metadata
78
+ */
79
+ metadata?: Record<string, any>;
80
+ /**
81
+ * Timestamps
82
+ */
83
+ createdAt: number;
84
+ updatedAt: number;
85
+ }
86
+ /**
87
+ * Options for minting a VDA
88
+ */
89
+ export interface MintVDAParams {
90
+ /**
91
+ * Asset ID (optional, will be generated if not provided)
92
+ */
93
+ assetId?: string;
94
+ /**
95
+ * Asset type
96
+ */
97
+ assetType: AssetType;
98
+ /**
99
+ * Universal metadata (at least one required)
100
+ */
101
+ address?: string;
102
+ legalDesc?: string;
103
+ patientId?: string;
104
+ api14?: string;
105
+ /**
106
+ * Owner wallet address (optional, will be auto-created if not provided)
107
+ */
108
+ ownerWallet?: string;
109
+ /**
110
+ * Grantor wallet (for access passes)
111
+ */
112
+ grantorWallet?: string;
113
+ /**
114
+ * Spoke
115
+ */
116
+ spoke: SpokeType;
117
+ /**
118
+ * IPFS CID
119
+ */
120
+ ipfsCid?: string;
121
+ /**
122
+ * Access pass fields (only for assetType === 'access-pass')
123
+ */
124
+ expiry?: number;
125
+ accessibleVDAs?: string[];
126
+ permissions?: PermissionType[];
127
+ /**
128
+ * Spoke-specific metadata
129
+ */
130
+ metadata?: Record<string, any>;
131
+ /**
132
+ * User ID for automatic wallet creation (if ownerWallet not provided)
133
+ */
134
+ userId?: string;
135
+ password?: string;
136
+ }
137
+ /**
138
+ * Validation error
139
+ */
140
+ export interface ValidationError {
141
+ field: string;
142
+ message: string;
143
+ }
144
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,WAAW,GACX,QAAQ,GACR,UAAU,GACV,eAAe,GACf,UAAU,GACV,aAAa,GACb,SAAS,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IAEjB;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE/B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB"}
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @hauska-sdk/vda
3
+ * VDA Type Definitions
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @hauska-sdk/vda
3
+ * VDA Metadata Validation
4
+ */
5
+ import type { VDAMetadata, AssetType, SpokeType, PermissionType, ValidationError } from "./types";
6
+ /**
7
+ * Valid asset types
8
+ */
9
+ export declare const VALID_ASSET_TYPES: AssetType[];
10
+ /**
11
+ * Valid spoke types
12
+ */
13
+ export declare const VALID_SPOKE_TYPES: SpokeType[];
14
+ /**
15
+ * Valid permission types
16
+ */
17
+ export declare const VALID_PERMISSION_TYPES: PermissionType[];
18
+ /**
19
+ * Validate VDA metadata
20
+ */
21
+ export declare function validateVDAMetadata(metadata: Partial<VDAMetadata>): {
22
+ valid: boolean;
23
+ errors: ValidationError[];
24
+ };
25
+ /**
26
+ * Normalize address for search (basic normalization)
27
+ */
28
+ export declare function normalizeAddress(address: string): string;
29
+ /**
30
+ * Check if metadata has required universal key for spoke
31
+ */
32
+ export declare function hasRequiredUniversalKey(metadata: Partial<VDAMetadata>, spoke: SpokeType): boolean;
33
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,cAAc,EACd,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,EASxC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,EAMxC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,cAAc,EAKlD,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG;IACnE,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B,CA0IA;AAUD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGxD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,EAC9B,KAAK,EAAE,SAAS,GACf,OAAO,CAcT"}