Skip to content

Commit

Permalink
Merge pull request #225 from docknetwork/feat/read-ecosystem-data-fro…
Browse files Browse the repository at this point in the history
…m-chain

chore: change hashing utility to "createHash"
  • Loading branch information
maycon-mello authored Mar 13, 2024
2 parents 4ff44bc + 4b2bb5d commit e914aa3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/wasm/src/services/trust-registry/service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// @ts-nocheck
import {serviceName} from './configs';
import {typedHexDID} from '@docknetwork/sdk/utils/did/typed-did/helpers';
import {stringToU8a, u8aToHex} from '@polkadot/util';
import {createHash} from 'crypto';
import {dockService} from '../dock/service';
import {validation} from './configs';
import {sha256} from '@polkadot/wasm-crypto';

class TrustRegistryService {
constructor() {
Expand All @@ -28,8 +27,8 @@ class TrustRegistryService {
const queryOptions = {};

if (schemaId) {
const u8aSchemaId = stringToU8a(schemaId);
const schemaIdHex = u8aToHex(sha256(u8aSchemaId));
const hashedId = createHash('sha256').update(schemaId).digest('hex');
const schemaIdHex = '0x' + hashedId;
queryOptions.schemaIds = {
AnyOf: [schemaIdHex],
};
Expand Down Expand Up @@ -62,8 +61,8 @@ class TrustRegistryService {
async getTrustRegistryVerifiers({schemaId, trustRegistryId, issuerDID}) {
validation.getTrustRegistryVerifiers({schemaId, trustRegistryId});

const u8aSchemaId = stringToU8a(schemaId);
const schemaIdHex = u8aToHex(sha256(u8aSchemaId));
const hashedId = createHash('sha256').update(schemaId).digest('hex');
const schemaIdHex = '0x' + hashedId;

const issuerDIDMethodKey = issuerDID
? typedHexDID(dockService.dock.api, issuerDID)
Expand Down

0 comments on commit e914aa3

Please sign in to comment.