diff --git a/README.md b/README.md index f3b7a5a3..c864e288 100644 --- a/README.md +++ b/README.md @@ -118,8 +118,8 @@ await myErc725.getData(); name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', value: { - hashFunction: 'keccak256(utf8)', - hash: '0x70546a2accab18748420b63c63b5af4cf710848ae83afc0c51dd8ad17fb5e8b3', + verificationFunction: 'keccak256(utf8)', + verificationData: '0x70546a2accab18748420b63c63b5af4cf710848ae83afc0c51dd8ad17fb5e8b3', url: 'ipfs://QmecrGejUQVXpW4zS948pNvcnQrJ1KiAoM6bdfrVcWZsn5', }, }, diff --git a/docs/classes/ERC725.md b/docs/classes/ERC725.md index c6a41019..efb68640 100644 --- a/docs/classes/ERC725.md +++ b/docs/classes/ERC725.md @@ -147,8 +147,8 @@ myErc725.decodeData([ name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', value: { - hashFunction: 'keccak256(utf8)', - hash: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', + verificationFunction: 'keccak256(utf8)', + verificationData: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', url: 'ipfs://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx', }, }, @@ -165,8 +165,8 @@ myErc725.decodeData({ name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', value: { - hashFunction: 'keccak256(utf8)', - hash: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', + verificationFunction: 'keccak256(utf8)', + verificationData: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', url: 'ipfs://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx', }, } @@ -206,8 +206,8 @@ myErc725.decodeData([ name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', value: { - hash: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', - hashFunction: 'keccak256(utf8)', + verificationData: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', + verificationFunction: 'keccak256(utf8)', url: 'ipfs://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx', }, }, @@ -256,8 +256,8 @@ myErc725.decodeData( name: 'MyKeyName:aaaabbbbccccddddeeeeffff111122223333444455556666777788889999aaaa:true', key: '0x35e6950bc8d2aaaabbbb00000000000000000000000000000000000000000001', value: { - hashFunction: 'keccak256(utf8)', - hash: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', + verificationFunction: 'keccak256(utf8)', + verificationData: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', url: 'ifps://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx', }, }, @@ -479,8 +479,9 @@ myErc725.encodeData([ { keyName: 'LSP3Profile', value: { - hashFunction: 'keccak256(utf8)', - hash: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', + verificationFunction: 'keccak256(utf8)', + verificationData: + '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', url: 'ipfs://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx', }, }, @@ -564,8 +565,9 @@ myErc725.encodeData([ { keyName: 'LSP3Profile', value: { - hashFunction: 'keccak256(utf8)', - hash: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', + verificationFunction: 'keccak256(utf8)', + verificationData: + '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', url: 'ipfs://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx', }, }, @@ -1063,8 +1065,8 @@ await myErc725.getData(); name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', value: { - hashFunction: 'keccak256(utf8)', - hash: '0x70546a2accab18748420b63c63b5af4cf710848ae83afc0c51dd8ad17fb5e8b3', + verificationFunction: 'keccak256(utf8)', + verificationData: '0x70546a2accab18748420b63c63b5af4cf710848ae83afc0c51dd8ad17fb5e8b3', url: 'ipfs://QmecrGejUQVXpW4zS948pNvcnQrJ1KiAoM6bdfrVcWZsn5', }, }, @@ -1081,8 +1083,8 @@ await myErc725.getData('LSP3Profile'); name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', value: { - hashFunction: 'keccak256(utf8)', - hash: '0xd96ff7776660095f661d16010c4349aa7478a9129ce0670f771596a6ff2d864a', + verificationFunction: 'keccak256(utf8)', + verificationData: '0xd96ff7776660095f661d16010c4349aa7478a9129ce0670f771596a6ff2d864a', url: 'ipfs://QmbTmcbp8ZW23vkQrqkasMFqNg2z1iP4e3BCUMz9PKDsSV' }, } @@ -1095,8 +1097,8 @@ await myErc725.getData(['LSP3Profile']); name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', value: { - hashFunction: 'keccak256(utf8)', - hash: '0xd96ff7776660095f661d16010c4349aa7478a9129ce0670f771596a6ff2d864a', + verificationFunction: 'keccak256(utf8)', + verificationData: '0xd96ff7776660095f661d16010c4349aa7478a9129ce0670f771596a6ff2d864a', url: 'ipfs://QmbTmcbp8ZW23vkQrqkasMFqNg2z1iP4e3BCUMz9PKDsSV' }, } @@ -1123,8 +1125,8 @@ await myErc725.getData(['LSP3Profile', 'LSP1UniversalReceiverDelegate']); name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', value: { - hashFunction: 'keccak256(utf8)', - hash: '0xeeafeebeb416923dfb0dcf4c66b045c72742121ce2a06f93ae044ee0efb70777', + verificationFunction: 'keccak256(utf8)', + verificationData: '0xeeafeebeb416923dfb0dcf4c66b045c72742121ce2a06f93ae044ee0efb70777', url: 'ipfs://QmZnG5Z5B5Dq8iFFtsL5i7AnrgH16P4DJ8UhY7j8RzX51p' } }, @@ -1183,8 +1185,8 @@ await myErc725.getData([ name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', value: { - hashFunction: 'keccak256(utf8)', - hash: '0xeeafeebeb416923dfb0dcf4c66b045c72742121ce2a06f93ae044ee0efb70777', + verificationFunction: 'keccak256(utf8)', + verificationData: '0xeeafeebeb416923dfb0dcf4c66b045c72742121ce2a06f93ae044ee0efb70777', url: 'ipfs://QmZnG5Z5B5Dq8iFFtsL5i7AnrgH16P4DJ8UhY7j8RzX51p' } }, diff --git a/docs/getting-started.md b/docs/getting-started.md index cbe47702..da6b1e98 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -84,8 +84,8 @@ await erc725.getData(['LSP3Profile', 'SupportedStandards:LSP3Profile']); { LSP3Profile: { url: 'ipfs://QmXybv2LdJWscy1C6yRKUjvnaj6aqKktZX4g4xmz2nyYj2', - hash: '0xb4f9d72e83bbe7e250ed9ec80332c493b7b3d73e0d72f7b2c7ab01c39216eb1a', - hashFunction: 'keccak256(utf8)' + verificationData: '0xb4f9d72e83bbe7e250ed9ec80332c493b7b3d73e0d72f7b2c7ab01c39216eb1a', + verificationFunction: 'keccak256(utf8)' }, 'SupportedStandards:LSP3Profile': '0x5ef83ad9' } diff --git a/examples/src/decodeData.js b/examples/src/decodeData.js index 474c9d45..b10fd05a 100644 --- a/examples/src/decodeData.js +++ b/examples/src/decodeData.js @@ -17,8 +17,8 @@ const decodedDataOneKey = myERC725.decodeData([ name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', value: { - hashFunction: 'keccak256(utf8)', - hash: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', + verificationFunction: 'keccak256(utf8)', + verificationData: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', url: 'ipfs://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx' } } @@ -56,8 +56,8 @@ const decodedDataManyKeys = myERC725.decodeData([ name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', value: { - hashFunction: 'keccak256(utf8)', - hash: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', + verificationFunction: 'keccak256(utf8)', + verificationData: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', url: 'ipfs://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx' } }, diff --git a/examples/src/encodeData.js b/examples/src/encodeData.js index 39e7e3e6..85dd69c8 100644 --- a/examples/src/encodeData.js +++ b/examples/src/encodeData.js @@ -25,8 +25,9 @@ const encodedDataOneKey = myERC725.encodeData({ const encodedDataOneKeyV2 = myERC725.encodeData({ keyName: 'LSP3Profile', value: { - hashFunction: 'keccak256(utf8)', - hash: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', + verificationFunction: 'keccak256(utf8)', + verificationData: + '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', url: 'ipfs://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx', }, }); @@ -45,8 +46,9 @@ const encodedDataManyKeys = myERC725.encodeData([ { keyName: 'LSP3Profile', value: { - hashFunction: 'keccak256(utf8)', - hash: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', + verificationFunction: 'keccak256(utf8)', + verificationData: + '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', url: 'ipfs://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx', }, }, diff --git a/examples/src/getData.js b/examples/src/getData.js index 447ab21b..e34ac0d3 100644 --- a/examples/src/getData.js +++ b/examples/src/getData.js @@ -11,8 +11,8 @@ const dataAllKeys = await myERC725.getData(); name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', value: { - hashFunction: 'keccak256(utf8)', - hash: '0xd96ff7776660095f661d16010c4349aa7478a9129ce0670f771596a6ff2d864a', + verificationFunction: 'keccak256(utf8)', + verificationData: '0xd96ff7776660095f661d16010c4349aa7478a9129ce0670f771596a6ff2d864a', url: 'ipfs://QmbTmcbp8ZW23vkQrqkasMFqNg2z1iP4e3BCUMz9PKDsSV' } }, @@ -46,8 +46,8 @@ const dataOneKey = await myERC725.getData('LSP3Profile'); key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', name: 'LSP3Profile', value: { - hashFunction: 'keccak256(utf8)', - hash: '0xd96ff7776660095f661d16010c4349aa7478a9129ce0670f771596a6ff2d864a', + verificationFunction: 'keccak256(utf8)', + verificationData: '0xd96ff7776660095f661d16010c4349aa7478a9129ce0670f771596a6ff2d864a', url: 'ipfs://QmbTmcbp8ZW23vkQrqkasMFqNg2z1iP4e3BCUMz9PKDsSV' } } @@ -63,8 +63,8 @@ const dataManyKeys = await myERC725.getData([ key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', name: 'LSP3Profile', value: { - hashFunction: 'keccak256(utf8)', - hash: '0xd96ff7776660095f661d16010c4349aa7478a9129ce0670f771596a6ff2d864a', + verificationFunction: 'keccak256(utf8)', + verificationData: '0xd96ff7776660095f661d16010c4349aa7478a9129ce0670f771596a6ff2d864a', url: 'ipfs://QmbTmcbp8ZW23vkQrqkasMFqNg2z1iP4e3BCUMz9PKDsSV' } }, diff --git a/examples/src/instantiation.js b/examples/src/instantiation.js index cdaab9b2..21c05cec 100644 --- a/examples/src/instantiation.js +++ b/examples/src/instantiation.js @@ -61,36 +61,41 @@ export const profileJson = { { width: 1800, height: 1712, - hashFunction: 'keccak256(bytes)', - hash: '0xfbcfcbbc86d886e862419361c48251d778884a90429d36c8d002559cbcb52972', + verificationFunction: 'keccak256(bytes)', + verificationData: + '0xfbcfcbbc86d886e862419361c48251d778884a90429d36c8d002559cbcb52972', url: 'ipfs://QmNPh6hP5igFzPf4mPtKBa6Wttnmi3YNVMAptC7drzyeDB', }, { width: 1024, height: 974, - hashFunction: 'keccak256(bytes)', - hash: '0xa9399df007997de92a820c6c2ec1cb2d3f5aa5fc1adf294157de563eba39bb6e', + verificationFunction: 'keccak256(bytes)', + verificationData: + '0xa9399df007997de92a820c6c2ec1cb2d3f5aa5fc1adf294157de563eba39bb6e', url: 'ipfs://QmW4wM4r9yWeY1gUCtt7c6v3ve7Fzdg8CKvTS96NU9Uiwr', }, { width: 640, height: 609, - hashFunction: 'keccak256(bytes)', - hash: '0xb316a695125cb0566da252266cfc9d5750a740bbdffa86712bb17508e70e6a31', + verificationFunction: 'keccak256(bytes)', + verificationData: + '0xb316a695125cb0566da252266cfc9d5750a740bbdffa86712bb17508e70e6a31', url: 'ipfs://QmXGELsqGidAHMwYRsEv6Z4emzMggtc5GXZYGFK7r6zFBg', }, { width: 320, height: 304, - hashFunction: 'keccak256(bytes)', - hash: '0xd22a272ff5b257056cc302bcdcca1c0ea00bf912aef310eb3fa7556696b1e780', + verificationFunction: 'keccak256(bytes)', + verificationData: + '0xd22a272ff5b257056cc302bcdcca1c0ea00bf912aef310eb3fa7556696b1e780', url: 'ipfs://QmRr2urTVi12VzYa5cSHDjJXACfapaeGZW2BuNmQ8rHjCG', }, { width: 180, height: 171, - hashFunction: 'keccak256(bytes)', - hash: '0xf80d0c1492de5e148392b3a724739682e9b9564ef5fb97c06c1574bbb5e5f340', + verificationFunction: 'keccak256(bytes)', + verificationData: + '0xf80d0c1492de5e148392b3a724739682e9b9564ef5fb97c06c1574bbb5e5f340', url: 'ipfs://QmVeFyhHtdXR34UZanqU2qSuBTfGtBraG7hhN5byjJNAY5', }, ], @@ -98,22 +103,25 @@ export const profileJson = { { width: 1800, height: 1013, - hashFunction: 'keccak256(bytes)', - hash: '0x98fe032f81c43426fbcfb21c780c879667a08e2a65e8ae38027d4d61cdfe6f55', + verificationFunction: 'keccak256(bytes)', + verificationData: + '0x98fe032f81c43426fbcfb21c780c879667a08e2a65e8ae38027d4d61cdfe6f55', url: 'ipfs://QmPJESHbVkPtSaHntNVY5F6JDLW8v69M2d6khXEYGUMn7N', }, { width: 1024, height: 576, - hashFunction: 'keccak256(bytes)', - hash: '0xfce1c7436a77a009a97e48e4e10c92e89fd95fe1556fc5c62ecef57cea51aa37', + verificationFunction: 'keccak256(bytes)', + verificationData: + '0xfce1c7436a77a009a97e48e4e10c92e89fd95fe1556fc5c62ecef57cea51aa37', url: 'ipfs://QmZc9uMJxyUeUpuowJ7AD6MKoNTaWdVNcBj72iisRyM9Su', }, { width: 640, height: 360, - hashFunction: 'keccak256(bytes)', - hash: '0x10a5cf2479992f1c555ad71e0a2866827f66fef6941a0c99f8d3b03e6b8b4009', + verificationFunction: 'keccak256(bytes)', + verificationData: + '0x10a5cf2479992f1c555ad71e0a2866827f66fef6941a0c99f8d3b03e6b8b4009', url: 'ipfs://QmbP3eTmUx1UQ2eZ8hrDz8j98yP2CTmsJvfp72LZKnkKj1', }, ], diff --git a/src/constants/constants.ts b/src/constants/constants.ts index 4915183d..468774e3 100644 --- a/src/constants/constants.ts +++ b/src/constants/constants.ts @@ -104,22 +104,22 @@ export const METHODS: Record = { }, }; -export enum SUPPORTED_HASH_FUNCTION_STRINGS { +export enum SUPPORTED_VERIFICATION_FUNCTION_STRINGS { KECCAK256_UTF8 = 'keccak256(utf8)', KECCAK256_BYTES = 'keccak256(bytes)', } -export enum SUPPORTED_HASH_FUNCTION_HASHES { +export enum SUPPORTED_VERIFICATION_FUNCTION_HASHES { HASH_KECCAK256_UTF8 = '0x6f357c6a', HASH_KECCAK256_BYTES = '0x8019f9b1', } -export type SUPPORTED_HASH_FUNCTIONS = - | SUPPORTED_HASH_FUNCTION_STRINGS - | SUPPORTED_HASH_FUNCTION_HASHES; +export type SUPPORTED_VERIFICATION_FUNCTIONS = + | SUPPORTED_VERIFICATION_FUNCTION_STRINGS + | SUPPORTED_VERIFICATION_FUNCTION_HASHES; -export const SUPPORTED_HASH_FUNCTIONS_LIST = Object.values( - SUPPORTED_HASH_FUNCTION_STRINGS, +export const SUPPORTED_VERIFICATION_FUNCTIONS_LIST = Object.values( + SUPPORTED_VERIFICATION_FUNCTION_STRINGS, ); function keccak256Utf8(data) { @@ -128,27 +128,28 @@ function keccak256Utf8(data) { const KECCAK256_UTF8 = { method: keccak256Utf8, - name: SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_UTF8, - sig: SUPPORTED_HASH_FUNCTION_HASHES.HASH_KECCAK256_UTF8, + name: SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_UTF8, + sig: SUPPORTED_VERIFICATION_FUNCTION_HASHES.HASH_KECCAK256_UTF8, }; const KECCAK256_BYTES = { method: keccak256, - name: SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_BYTES, - sig: SUPPORTED_HASH_FUNCTION_HASHES.HASH_KECCAK256_BYTES, + name: SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_BYTES, + sig: SUPPORTED_VERIFICATION_FUNCTION_HASHES.HASH_KECCAK256_BYTES, }; export const HASH_FUNCTIONS: { [key: string]: { method: Function; - name: SUPPORTED_HASH_FUNCTION_STRINGS; - sig: SUPPORTED_HASH_FUNCTIONS; + name: SUPPORTED_VERIFICATION_FUNCTION_STRINGS; + sig: SUPPORTED_VERIFICATION_FUNCTIONS; }; } = { - [SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_UTF8]: KECCAK256_UTF8, - [SUPPORTED_HASH_FUNCTION_HASHES.HASH_KECCAK256_UTF8]: KECCAK256_UTF8, - [SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_BYTES]: KECCAK256_BYTES, - [SUPPORTED_HASH_FUNCTION_HASHES.HASH_KECCAK256_BYTES]: KECCAK256_BYTES, + [SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_UTF8]: KECCAK256_UTF8, + [SUPPORTED_VERIFICATION_FUNCTION_HASHES.HASH_KECCAK256_UTF8]: KECCAK256_UTF8, + [SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_BYTES]: KECCAK256_BYTES, + [SUPPORTED_VERIFICATION_FUNCTION_HASHES.HASH_KECCAK256_BYTES]: + KECCAK256_BYTES, }; // TODO: These values can be imported from lsp-smartcontracts lib after release diff --git a/src/index.test.ts b/src/index.test.ts index 93aef0b0..6081a1b3 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -45,7 +45,7 @@ import 'isomorphic-fetch'; import { ERC725Y_INTERFACE_IDS, - SUPPORTED_HASH_FUNCTION_STRINGS, + SUPPORTED_VERIFICATION_FUNCTION_STRINGS, } from './constants/constants'; import { decodeKey } from './lib/decodeData'; import { INTERFACE_IDS_0_12_0 } from './constants/interfaces'; @@ -271,8 +271,9 @@ describe('Running @erc725/erc725.js tests...', () => { name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', value: { - hashFunction: 'keccak256(utf8)', - hash: '0x70546a2accab18748420b63c63b5af4cf710848ae83afc0c51dd8ad17fb5e8b3', + verificationFunction: 'keccak256(utf8)', + verificationData: + '0x70546a2accab18748420b63c63b5af4cf710848ae83afc0c51dd8ad17fb5e8b3', url: 'ipfs://QmecrGejUQVXpW4zS948pNvcnQrJ1KiAoM6bdfrVcWZsn5', }, }, @@ -370,8 +371,9 @@ describe('Running @erc725/erc725.js tests...', () => { name: 'LSP3Profile', key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', value: { - hashFunction: 'keccak256(utf8)', - hash: '0x70546a2accab18748420b63c63b5af4cf710848ae83afc0c51dd8ad17fb5e8b3', + verificationFunction: 'keccak256(utf8)', + verificationData: + '0x70546a2accab18748420b63c63b5af4cf710848ae83afc0c51dd8ad17fb5e8b3', url: 'ipfs://QmecrGejUQVXpW4zS948pNvcnQrJ1KiAoM6bdfrVcWZsn5', }, }, @@ -678,8 +680,8 @@ describe('Running @erc725/erc725.js tests...', () => { // Encoded value of: // { - // hashFunction: 'keccak256(bytes)', // 0x8019f9b1 - // hash: '0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec', + // verificationFunction: 'keccak256(bytes)', // 0x8019f9b1 + // verificationData: '0xc41589e7559804ea4a2080dad19d876a024ccb05117835447d72ce08c1d020ec', // url: 'ipfs://QmYo8yg4zzmdu26NSvtsoKeU5oVR6h2ohmoa2Cx5i91mPf', // }, ], @@ -971,15 +973,17 @@ describe('Running @erc725/erc725.js tests...', () => { { width: 1350, height: 1800, - hashFunction: 'keccak256(bytes)', - hash: '0x229b60ea5b58e1ab8e6f1063300be110bb4fa663ba75d3814d60104ac6b74497', + verificationFunction: 'keccak256(bytes)', + verificationData: + '0x229b60ea5b58e1ab8e6f1063300be110bb4fa663ba75d3814d60104ac6b74497', url: 'ipfs://Qmbv9j6iCDDYJ1NXHTZnNHDJ6qaaKkZsf79jhUMFAXcfDR', }, { width: 768, height: 1024, - hashFunction: 'keccak256(bytes)', - hash: '0x320db57770084f114988c8a94bcf219ca66c69421590466a45f382cd84995c2b', + verificationFunction: 'keccak256(bytes)', + verificationData: + '0x320db57770084f114988c8a94bcf219ca66c69421590466a45f382cd84995c2b', url: 'ipfs://QmS4m2LmRpay7Jij4DCpvaW5zKZYy43ATZdRxUkUND6nG3', }, ], @@ -987,15 +991,17 @@ describe('Running @erc725/erc725.js tests...', () => { { width: 1024, height: 768, - hashFunction: 'keccak256(bytes)', - hash: '0xbe2d39fe1e0b1911155afc74010db3483528a2b645dea8fcf47bdc34147769be', + verificationFunction: 'keccak256(bytes)', + verificationData: + '0xbe2d39fe1e0b1911155afc74010db3483528a2b645dea8fcf47bdc34147769be', url: 'ipfs://QmQ6ujfKSc91F44KtMe6WRTSCXoSdCjomQUy8hCUxHMr28', }, { width: 640, height: 480, - hashFunction: 'keccak256(bytes)', - hash: '0xb115f2bf09994e79726db27a7b8d5a0de41a5b81d11b59b3038fa158718266ff', + verificationFunction: 'keccak256(bytes)', + verificationData: + '0xb115f2bf09994e79726db27a7b8d5a0de41a5b81d11b59b3038fa158718266ff', url: 'ipfs://QmakaRZxJMMqwQFJY98J3wjbqYVDnaSZ9sEqBF9iMv3GNX', }, ], @@ -1025,12 +1031,12 @@ describe('Running @erc725/erc725.js tests...', () => { 'ipfs://QmbKvCVEePiDKxuouyty9bMsWBAxZDGr2jhxd4pLGLx95D', ); assert.deepStrictEqual( - decodedData[0].value.hash, - hashData(json, SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_UTF8), + decodedData[0].value.verificationData, + hashData(json, SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_UTF8), ); assert.deepStrictEqual( - decodedData[0].value.hashFunction, - SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_UTF8, + decodedData[0].value.verificationFunction, + SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_UTF8, ); }); diff --git a/src/lib/encoder.test.ts b/src/lib/encoder.test.ts index b425bcf0..9200705f 100644 --- a/src/lib/encoder.test.ts +++ b/src/lib/encoder.test.ts @@ -26,8 +26,8 @@ import { decodeValueContent, } from './encoder'; import { - SUPPORTED_HASH_FUNCTION_HASHES, - SUPPORTED_HASH_FUNCTION_STRINGS, + SUPPORTED_VERIFICATION_FUNCTION_HASHES, + SUPPORTED_VERIFICATION_FUNCTION_STRINGS, } from '../constants/constants'; import { JSONURLDataToEncode, URLDataWithHash } from '../types'; @@ -867,8 +867,10 @@ describe('encoder', () => { { valueContent: 'AssetURL', decodedValue: { - hashFunction: SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_UTF8, - hash: '0x027547537d35728a741470df1ccf65de10b454ca0def7c5c20b257b7b8d16168', + verificationFunction: + SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_UTF8, + verificationData: + '0x027547537d35728a741470df1ccf65de10b454ca0def7c5c20b257b7b8d16168', url: 'http://test.com/asset.glb', }, encodedValue: @@ -922,19 +924,21 @@ describe('encoder', () => { }; const encodedValue = encodeValueContent('JSONURL', dataToEncode); - const hashFunction = SUPPORTED_HASH_FUNCTION_HASHES.HASH_KECCAK256_UTF8; + const verificationFunction = + SUPPORTED_VERIFICATION_FUNCTION_HASHES.HASH_KECCAK256_UTF8; const hexUrl = utf8ToHex(dataToEncode.url).substring(2); - const jsonDataHash = keccak256( + const jsonVerificationData = keccak256( JSON.stringify(dataToEncode.json), ).substring(2); assert.deepStrictEqual( encodedValue, - hashFunction + jsonDataHash + hexUrl, + verificationFunction + jsonVerificationData + hexUrl, ); const expectedDecodedValue: URLDataWithHash = { - hash: `0x${jsonDataHash}`, - hashFunction: SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_UTF8, + verificationData: `0x${jsonVerificationData}`, + verificationFunction: + SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_UTF8, url: dataToEncode.url, }; @@ -977,37 +981,37 @@ describe('encoder', () => { }); describe('JSONURL', () => { - it('throws when the hashFunction of JSON of JSONURL to encode is not keccak256(utf8)', () => { + it('throws when the verificationFunction of JSON of JSONURL to encode is not keccak256(utf8)', () => { assert.throws( () => { valueContentEncodingMap('JSONURL').encode({ // @ts-ignore to still run the test (incase someone is using the library in a non TS environment) - hashFunction: 'whatever', + verificationFunction: 'whatever', url: 'https://file-desination.com/file-name', - hash: '0x321', + verificationData: '0x321', }); }, (error: any) => { return ( error.message === - `Chosen hashFunction 'whatever' is not supported. Supported hashFunctions: keccak256(utf8),keccak256(bytes)` + `Chosen verificationFunction 'whatever' is not supported. Supported verificationFunctions: keccak256(utf8),keccak256(bytes)` ); }, ); }); - it('throws when JSONURL encode a JSON without json or hash key', () => { + it('throws when JSONURL encode a JSON without json or verificationData key', () => { assert.throws( () => { valueContentEncodingMap('JSONURL').encode({ // @ts-ignore to still run the test (incase someone is using the library in a non TS environment) - hashFunction: 'keccak256(utf8)', + verificationFunction: 'keccak256(utf8)', url: 'https://file-desination.com/file-name', }); }, (error: any) => error.message === - 'You have to provide either the hash or the json via the respective properties', + 'You have to provide either the verificationData or the json via the respective properties', ); }); }); diff --git a/src/lib/encoder.ts b/src/lib/encoder.ts index bde305fc..f9f27e97 100644 --- a/src/lib/encoder.ts +++ b/src/lib/encoder.ts @@ -48,10 +48,10 @@ import { JSONURLDataToEncode, URLDataWithHash } from '../types'; import { AssetURLEncode } from '../types/encodeData'; import { - SUPPORTED_HASH_FUNCTIONS, - SUPPORTED_HASH_FUNCTION_STRINGS, + SUPPORTED_VERIFICATION_FUNCTIONS, + SUPPORTED_VERIFICATION_FUNCTION_STRINGS, } from '../constants/constants'; -import { getHashFunction, hashData, countNumberOfBytes } from './utils'; +import { getVerificationFunction, hashData, countNumberOfBytes } from './utils'; const abiCoder = AbiCoder; @@ -60,28 +60,32 @@ const bytesNRegex = /Bytes(\d+)/; const ALLOWED_BYTES_SIZES = [2, 4, 8, 16, 32, 64, 128, 256]; const encodeDataSourceWithHash = ( - hashType: SUPPORTED_HASH_FUNCTIONS, + hashType: SUPPORTED_VERIFICATION_FUNCTIONS, dataHash: string, dataSource: string, ): string => { - const hashFunction = getHashFunction(hashType); + const verificationFunction = getVerificationFunction(hashType); return ( - keccak256(hashFunction.name).slice(0, 10) + + keccak256(verificationFunction.name).slice(0, 10) + dataHash.slice(2) + utf8ToHex(dataSource).slice(2) ); }; const decodeDataSourceWithHash = (value: string): URLDataWithHash => { - const hashFunctionSig = value.slice(0, 10); - const hashFunction = getHashFunction(hashFunctionSig); + const verificationFunctionSig = value.slice(0, 10); + const verificationFunction = getVerificationFunction(verificationFunctionSig); const encodedData = value.replace('0x', '').slice(8); // Rest of data string after function hash const dataHash = '0x' + encodedData.slice(0, 64); // Get jsonHash 32 bytes const dataSource = hexToUtf8('0x' + encodedData.slice(64)); // Get remainder as URI - return { hashFunction: hashFunction.name, hash: dataHash, url: dataSource }; + return { + verificationFunction: verificationFunction.name, + verificationData: dataHash, + url: dataSource, + }; }; const encodeToBytesN = ( @@ -563,7 +567,11 @@ export const valueContentEncodingMap = (valueContent: string) => { return { type: 'custom', encode: (value: AssetURLEncode) => - encodeDataSourceWithHash(value.hashFunction, value.hash, value.url), + encodeDataSourceWithHash( + value.verificationFunction, + value.verificationData, + value.url, + ), decode: (value: string) => decodeDataSourceWithHash(value), }; } @@ -572,31 +580,32 @@ export const valueContentEncodingMap = (valueContent: string) => { return { type: 'custom', encode: (dataToEncode: JSONURLDataToEncode) => { - const { hash, json, hashFunction, url } = dataToEncode; + const { verificationData, json, verificationFunction, url } = + dataToEncode; - let hashedJson = hash; + let hashedJson = verificationData; if (json) { - if (hashFunction) { + if (verificationFunction) { throw new Error( - 'When passing in the `json` property, we use "keccak256(utf8)" as a default hashingFunction. You do not need to set a `hashFunction`.', + 'When passing in the `json` property, we use "keccak256(utf8)" as a default verificationFunction. You do not need to set a `verificationFunction`.', ); } hashedJson = hashData( json, - SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_UTF8, + SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_UTF8, ); } if (!hashedJson) { throw new Error( - 'You have to provide either the hash or the json via the respective properties', + 'You have to provide either the verificationData or the json via the respective properties', ); } return encodeDataSourceWithHash( - (hashFunction as SUPPORTED_HASH_FUNCTION_STRINGS) || - SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_UTF8, + (verificationFunction as SUPPORTED_VERIFICATION_FUNCTION_STRINGS) || + SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_UTF8, hashedJson, url, ); diff --git a/src/lib/getDataFromExternalSources.ts b/src/lib/getDataFromExternalSources.ts index 62592dca..505a42f0 100644 --- a/src/lib/getDataFromExternalSources.ts +++ b/src/lib/getDataFromExternalSources.ts @@ -25,8 +25,8 @@ import { } from '../types/decodeData'; import { ERC725JSONSchema } from '../types/ERC725JSONSchema'; import { - SUPPORTED_HASH_FUNCTIONS, - SUPPORTED_HASH_FUNCTION_STRINGS, + SUPPORTED_VERIFICATION_FUNCTIONS, + SUPPORTED_VERIFICATION_FUNCTION_STRINGS, } from '../constants/constants'; import { isDataAuthentic, patchIPFSUrlsIfApplicable } from './utils'; @@ -81,8 +81,8 @@ export const getDataFromExternalSources = ( receivedData = await fetch(url).then(async (response) => { if ( - urlDataWithHash.hashFunction === - SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_BYTES + urlDataWithHash.verificationFunction === + SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_BYTES ) { return response .arrayBuffer() @@ -98,8 +98,8 @@ export const getDataFromExternalSources = ( return isDataAuthentic( receivedData, - urlDataWithHash.hash, - urlDataWithHash.hashFunction as SUPPORTED_HASH_FUNCTIONS, + urlDataWithHash.verificationData, + urlDataWithHash.verificationFunction as SUPPORTED_VERIFICATION_FUNCTIONS, ) ? { ...dataEntry, value: receivedData } : { ...dataEntry, value: null }; diff --git a/src/lib/utils.test.ts b/src/lib/utils.test.ts index 3365d600..facef7f7 100644 --- a/src/lib/utils.test.ts +++ b/src/lib/utils.test.ts @@ -25,7 +25,7 @@ import { } from '../types/ERC725JSONSchema'; import { GetDataDynamicKey } from '../types/GetData'; -import { SUPPORTED_HASH_FUNCTION_STRINGS } from '../constants/constants'; +import { SUPPORTED_VERIFICATION_FUNCTION_STRINGS } from '../constants/constants'; import { guessKeyTypeFromKeyName, isDataAuthentic, @@ -81,13 +81,17 @@ describe('utils', () => { }, decodedValue: [ { - hashFunction: SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_UTF8, - hash: '0x733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d', + verificationFunction: + SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_UTF8, + verificationData: + '0x733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d', url: 'ipfs://QmbErKh3FjsAR6YjsTjHZNm6McDp6aRt82Ftcv9AJJvZbd', }, { - hashFunction: SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_UTF8, - hash: '0x81bd0b7ed5ac354abbf24619ce16933f00a4bdfa8fcaf3791d25f69b497abf88', + verificationFunction: + SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_UTF8, + verificationData: + '0x81bd0b7ed5ac354abbf24619ce16933f00a4bdfa8fcaf3791d25f69b497abf88', url: 'ipfs://QmbErKh3Fjsxxxxxxxxxxxxxxxxxxxxxxxxxxv9AJJvZbd', }, ], @@ -288,8 +292,10 @@ describe('utils', () => { valueContent: 'AssetURL', valueType: 'bytes', decodedValue: { - hashFunction: SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_UTF8, - hash: '0x81dadadadadadadadadadadadadadadf00a4bdfa8fcaf3791d25f69b497abf88', + verificationFunction: + SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_UTF8, + verificationData: + '0x81dadadadadadadadadadadadadadadf00a4bdfa8fcaf3791d25f69b497abf88', url: 'http://day.night/asset.glb', }, encodedValue: @@ -299,8 +305,10 @@ describe('utils', () => { valueContent: 'JSONURL', valueType: 'bytes', decodedValue: { - hashFunction: SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_UTF8, - hash: '0x81bd0b7ed5ac354abbf24619ce16933f00a4bdfa8fcaf3791d25f69b497abf88', + verificationFunction: + SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_UTF8, + verificationData: + '0x81bd0b7ed5ac354abbf24619ce16933f00a4bdfa8fcaf3791d25f69b497abf88', url: 'ipfs://QmbErKh3Fjsxxxxxxxxxxxxxxxxxxxxxxxxxxv9AJJvZbd', }, encodedValue: @@ -565,8 +573,9 @@ describe('utils', () => { { keyName: 'LSP3Profile', value: { - hashFunction: 'keccak256(utf8)', - hash: '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', + verificationFunction: 'keccak256(utf8)', + verificationData: + '0x820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361', url: 'ipfs://QmYr1VJLwerg6pEoscdhVGugo39pa6rycEZLjtRPDfW84UAx', }, }, @@ -658,7 +667,7 @@ describe('utils', () => { const isAuthentic = isDataAuthentic( data, expectedHash, - SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_BYTES, + SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_BYTES, ); assert.ok(isAuthentic); @@ -670,7 +679,7 @@ describe('utils', () => { const isAuthentic = isDataAuthentic( data, expectedHash, - SUPPORTED_HASH_FUNCTION_STRINGS.KECCAK256_BYTES, + SUPPORTED_VERIFICATION_FUNCTION_STRINGS.KECCAK256_BYTES, ); assert.strictEqual(isAuthentic, false); diff --git a/src/lib/utils.ts b/src/lib/utils.ts index f289fb01..ab4a4edf 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -41,8 +41,8 @@ import { import { HASH_FUNCTIONS, - SUPPORTED_HASH_FUNCTIONS, - SUPPORTED_HASH_FUNCTIONS_LIST, + SUPPORTED_VERIFICATION_FUNCTIONS, + SUPPORTED_VERIFICATION_FUNCTIONS_LIST, COMPACT_BYTES_ARRAY_STRING, } from '../constants/constants'; import { @@ -468,25 +468,29 @@ export function encodeData( ); } -export function getHashFunction(hashFunctionNameOrHash: string) { - const hashFunction = HASH_FUNCTIONS[hashFunctionNameOrHash]; +export function getVerificationFunction( + verificationFunctionNameOrHash: string, +) { + const verificationFunction = HASH_FUNCTIONS[verificationFunctionNameOrHash]; - if (!hashFunction) { + if (!verificationFunction) { throw new Error( - `Chosen hashFunction '${hashFunctionNameOrHash}' is not supported. Supported hashFunctions: ${SUPPORTED_HASH_FUNCTIONS_LIST}`, + `Chosen verificationFunction '${verificationFunctionNameOrHash}' is not supported. Supported verificationFunctions: ${SUPPORTED_VERIFICATION_FUNCTIONS_LIST}`, ); } - return hashFunction; + return verificationFunction; } export function hashData( data: string | Uint8Array | Record, - hashFunctionNameOrHash: SUPPORTED_HASH_FUNCTIONS, + verificationFunctionNameOrHash: SUPPORTED_VERIFICATION_FUNCTIONS, ): string { - const hashFunction = getHashFunction(hashFunctionNameOrHash); + const verificationFunction = getVerificationFunction( + verificationFunctionNameOrHash, + ); - return hashFunction.method(data); + return verificationFunction.method(data); } /** @@ -496,14 +500,14 @@ export function hashData( export function isDataAuthentic( data: string | Uint8Array, expectedHash: string, - lowerCaseHashFunction: SUPPORTED_HASH_FUNCTIONS, + lowerCaseVerificationFunction: SUPPORTED_VERIFICATION_FUNCTIONS, ): boolean { let dataHash: string; if (data instanceof Uint8Array) { - dataHash = hashData(arrToBufArr(data), lowerCaseHashFunction); + dataHash = hashData(arrToBufArr(data), lowerCaseVerificationFunction); } else { - dataHash = hashData(data, lowerCaseHashFunction); + dataHash = hashData(data, lowerCaseVerificationFunction); } if (dataHash !== expectedHash) { diff --git a/src/types/encodeData/JSONURL.ts b/src/types/encodeData/JSONURL.ts index 842dc380..13b6ccfa 100644 --- a/src/types/encodeData/JSONURL.ts +++ b/src/types/encodeData/JSONURL.ts @@ -1,4 +1,4 @@ -import { SUPPORTED_HASH_FUNCTIONS } from '../../constants/constants'; +import { SUPPORTED_VERIFICATION_FUNCTIONS } from '../../constants/constants'; export interface KeyValuePair { key: string; @@ -10,14 +10,14 @@ interface URLData { } export interface URLDataWithHash extends URLData { - hash: string; - hashFunction: SUPPORTED_HASH_FUNCTIONS | string; // | string is to allow use of string directly without importing the enum + verificationData: string; + verificationFunction: SUPPORTED_VERIFICATION_FUNCTIONS | string; // | string is to allow use of string directly without importing the enum json?: never; } export interface URLDataWithJson extends URLData { - hash?: never; - hashFunction?: never; + verificationData?: never; + verificationFunction?: never; json: Record; } diff --git a/src/types/encodeData/index.ts b/src/types/encodeData/index.ts index 44f1e05e..a20a2174 100644 --- a/src/types/encodeData/index.ts +++ b/src/types/encodeData/index.ts @@ -1,7 +1,7 @@ -import { SUPPORTED_HASH_FUNCTIONS } from '../../constants/constants'; +import { SUPPORTED_VERIFICATION_FUNCTIONS } from '../../constants/constants'; export interface AssetURLEncode { - hashFunction: SUPPORTED_HASH_FUNCTIONS; - hash: string; + verificationFunction: SUPPORTED_VERIFICATION_FUNCTIONS; + verificationData: string; url: string; } diff --git a/test/mockSchema.ts b/test/mockSchema.ts index f434d447..1988c8fe 100644 --- a/test/mockSchema.ts +++ b/test/mockSchema.ts @@ -47,8 +47,9 @@ export const mockSchema: (ERC725JSONSchema & { returnGraphData: '0x6f357c6a733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', expectedResult: { - hashFunction: 'keccak256(utf8)', - hash: '0x733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d', // hash of stringified json + verificationFunction: 'keccak256(utf8)', + verificationData: + '0x733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d', // hash of stringified json url: 'ipfs://QmbErKh3FjsAR6YjsTjHZNm6McDp6aRt82Ftcv9AJJvZbd', // same JSON url from LSP3Profile below }, }, @@ -71,8 +72,9 @@ export const mockSchema: (ERC725JSONSchema & { returnGraphData: '0x6f357c6aa7d9a84b44013f71356d72e6c15fdc2533c573271c53d053ed8ddcdaa60f4c81697066733a2f2f516d6245724b6833466a73415236596a73546a485a4e6d364d6344703661527438324674637639414a4a765a6264', expectedResult: { - hashFunction: 'keccak256(utf8)', - hash: '0xa7d9a84b44013f71356d72e6c15fdc2533c573271c53d053ed8ddcdaa60f4c81', // hash of address '0x0c03fba782b07bcf810deb3b7f0595024a444f4e' + verificationFunction: 'keccak256(utf8)', + verificationData: + '0xa7d9a84b44013f71356d72e6c15fdc2533c573271c53d053ed8ddcdaa60f4c81', // hash of address '0x0c03fba782b07bcf810deb3b7f0595024a444f4e' url: 'ipfs://QmbErKh3FjsAR6YjsTjHZNm6McDp6aRt82Ftcv9AJJvZbd', // FAKE. just used from above TODO: fix this is not an asset URL but a JSON url !! }, }, @@ -283,14 +285,16 @@ export const mockSchema: (ERC725JSONSchema & { expectedResult: [ // This JSON from JSONURL above... { - hashFunction: 'keccak256(utf8)', - hash: '0x733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d', // hash of stringified json + verificationFunction: 'keccak256(utf8)', + verificationData: + '0x733e78f2fc4a3304c141e8424d02c9069fe08950c6514b27289ead8ef4faa49d', // hash of stringified json url: 'ipfs://QmbErKh3FjsAR6YjsTjHZNm6McDp6aRt82Ftcv9AJJvZbd', // same JSON url from LSP3Profile below }, // this JSON hash is = {"test1":"value1","test2":"value2","test3":"value3"} { - hashFunction: 'keccak256(utf8)', - hash: '0x81bd0b7ed5ac354abbf24619ce16933f00a4bdfa8fcaf3791d25f69b497abf88', // hash of stringified json + verificationFunction: 'keccak256(utf8)', + verificationData: + '0x81bd0b7ed5ac354abbf24619ce16933f00a4bdfa8fcaf3791d25f69b497abf88', // hash of stringified json url: 'ipfs://QmbErKh3Fjsxxxxxxxxxxxxxxxxxxxxxxxxxxv9AJJvZbd', // dummy url }, ], @@ -608,8 +612,9 @@ export const mockSchema: (ERC725JSONSchema & { ]), returnGraphData: '0x0c03fba782b07bcf810deb3b7f0595024a444f4e', expectedResult: { - hashFunction: 'keccak256(utf8)', - hash: '0xa7d9a84b44013f71356d72e6c15fdc2533c573271c53d053ed8ddcdaa60f4c81', // hash of address '0x0c03fba782b07bcf810deb3b7f0595024a444f4e' + verificationFunction: 'keccak256(utf8)', + verificationData: + '0xa7d9a84b44013f71356d72e6c15fdc2533c573271c53d053ed8ddcdaa60f4c81', // hash of address '0x0c03fba782b07bcf810deb3b7f0595024a444f4e' url: 'ipfs://QmbErKh3FjsAR6YjsTjHZNm6McDp6aRt82Ftcv9AJJvZbd', // FAKE. just used from above TODO: fix this is not an asset URL but a JSON url !! }, },