The grant file to generate a hash for
The keccak256 hash of the grant file as a hex string
Creates a deterministic keccak256 hash of the grant file by first sorting all object keys recursively to ensure consistent hashing regardless of property order. This hash can be used to verify grant file integrity or as a unique identifier.
const grantFile = {
grantee: '0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36',
operation: 'read',
parameters: { version: '1.0', mode: 'full' }
};
const hash = getGrantFileHash(grantFile);
console.log(`Grant file hash: ${hash}`);
// "0x1234567890abcdef..."
// Same grant file with different property order produces same hash
const grantFile2 = {
operation: 'read',
parameters: { mode: 'full', version: '1.0' },
grantee: '0x742d35Cc6558Fd4D9e9E0E888F0462ef6919Bd36'
};
const hash2 = getGrantFileHash(grantFile2);
console.log(hash === hash2); // true
Generates a content hash for a grant file. This can be used for integrity verification.