-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Description
HcsDid
throws Error: Couldn't find constructor
when called from an instance of HcsIdentityNetwork
through generateDid()
method. This happens ONLY when HcsIdentityNetwork
object is created via fromAddressBookFile
or fromAddressBook
static methods, both create AddressBook
object without private property fileId
set accordingly.
The workaround which returns AddressBook
from HcsIdentityNetwork
instance through getAddressBoook()
to set manually fileId
on AddressBook with setFileId
API does not solve the issue either, as HcsDid
constructor still fails on args[2] instanceof sdk_1.FileId
condition. This is weird, as args[2]
resolves to FileId {shard: Long, realm: Long, num: Long, _checksum: null}
, which is precisely what sdk_1.FileId type.
NOTE: If HcsIdentityNetwork
object is bootstrapped through HcsIdentityNetworkBuilder()
API everything works fine.
NOTE 2: Call to HcsIdentityNetwork.fromAddressBookFile()
API with fileId
already submitted to HFS fetches properly AddressBook file (just not instantiates the fileId
property on AddressBook Object).
Steps to reproduce
-
Submit AddressBook to Hedera File Service (out-of-bound), keep the fileId reference number as FID.
-
Create new IDENTITY_NETWORK object though
HcsIdentityNetwork.fromAddressBookFile(CLIENT, 'testnet', new FileId(FID))
-
Confirm that
IDENTITY_NETWORK.getAddressBook()
return object withoutfileId
set to FID. -
Try to generate DID by calling
IDENTITY_NETWORK.generateDid(PUBKEY, true)
-
Operation should thrown an error from HcsDid constructor
-
Retry step
4
, but first manually setfileId
property on IDENTITY_NETWORK address book. -
Operation still thrown the same error as in step
5
.
Additional context
ENV:
node: v14.17.6
ts-node: v10.2.1
npm: 6.14.15
macOS: Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64
tsconfig.json:
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2019",
"sourceMap": true,
"rootDir": ".",
"outDir": "./dist",
"baseUrl": "./",
"strict": true,
"forceConsistentCasingInFileNames": true,
"allowJs": true,
"incremental": true,
"skipLibCheck": true
}
}
package-lock.json:
....
"@grpc/grpc-js": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.3.7.tgz",
"integrity": "sha512-CKQVuwuSPh40tgOkR7c0ZisxYRiN05PcKPW72mQL5y++qd7CwBRoaJZvU5xfXnCJDFBmS3qZGQ71Frx6Ofo2XA==",
"requires": {
"@types/node": ">=12.12.47"
}
},
"@hashgraph/cryptography": {
"version": "1.0.20",
"resolved": "https://registry.npmjs.org/@hashgraph/cryptography/-/cryptography-1.0.20.tgz",
"integrity": "sha512-rdKKnENJfs0gsqAtY+7nzpG9TQshtnf+F3/PdH8z+qdy4mo4RSULBMc55FkWWNZLnoA4/34wEW8kohjFEzsLRA==",
"requires": {
"@types/crypto-js": "^4.0.2",
"@types/utf8": "^3.0.0",
"bignumber.js": "^9.0.1",
"crypto-js": "^4.0.0",
"expo-crypto": "^9.2.0",
"expo-random": "^11.2.0",
"fastestsmallesttextencoderdecoder": "^1.0.22",
"js-base64": "^3.6.1",
"tweetnacl": "^1.0.3"
}
},
"@hashgraph/did-sdk-js": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/@hashgraph/did-sdk-js/-/did-sdk-js-0.1.1.tgz",
"integrity": "sha512-YL+8pB8RqkUfvCKowuYEJ6RNexfHFv+RESD7UBn/CMvk70ECIjTb4oBVcqbtPgmDrt/Ayz4itueCob37GTAglw==",
"requires": {
"@hashgraph/sdk": "^2.0.20",
"bs58": "^4.0.1",
"js-base64": "^3.6.1",
"moment": "^2.29.1"
},
"dependencies": {
"@hashgraph/proto": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@hashgraph/proto/-/proto-2.0.0.tgz",
"integrity": "sha512-SgvtrTgZXpAk9c8LuOoOEs4RNqmSZX8/fYu8oDcqpRxAi5mnyChCkLcSneOyWPDJZmaEV1mz+HeO1HJAJUURAw==",
"requires": {
"protobufjs": "^6.11.2"
}
},
"@hashgraph/sdk": {
"version": "2.0.30",
"resolved": "https://registry.npmjs.org/@hashgraph/sdk/-/sdk-2.0.30.tgz",
"integrity": "sha512-aTAeOtnn6EBYTrkXcoE0dfEalHyEOg9fj79hruRHTdZb+tNRVRPr8XYriRy8CUZEIknJYQTFSfvrSEc7C8b6Zw==",
"requires": {
"@grpc/grpc-js": "^1.3.4",
"@hashgraph/cryptography": "^1.0.20",
"@hashgraph/proto": "2.0.0",
"@types/crypto-js": "^4.0.2",
"@types/utf8": "^3.0.0",
"bignumber.js": "^9.0.1",
"crypto-js": "^4.0.0",
"js-base64": "^3.6.1",
"long": "^4.0.0",
"protobufjs": "^6.11.2",
"utf8": "^3.0.0"
}
}
}
},
"@hashgraph/proto": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@hashgraph/proto/-/proto-2.0.0.tgz",
"integrity": "sha512-SgvtrTgZXpAk9c8LuOoOEs4RNqmSZX8/fYu8oDcqpRxAi5mnyChCkLcSneOyWPDJZmaEV1mz+HeO1HJAJUURAw==",
"requires": {
"protobufjs": "^6.11.2"
}
},
"@hashgraph/sdk": {
"version": "2.0.30",
"resolved": "https://registry.npmjs.org/@hashgraph/sdk/-/sdk-2.0.30.tgz",
"integrity": "sha512-aTAeOtnn6EBYTrkXcoE0dfEalHyEOg9fj79hruRHTdZb+tNRVRPr8XYriRy8CUZEIknJYQTFSfvrSEc7C8b6Zw==",
"requires": {
"@grpc/grpc-js": "^1.3.4",
"@hashgraph/cryptography": "^1.0.20",
"@hashgraph/proto": "2.0.0",
"@types/crypto-js": "^4.0.2",
"@types/utf8": "^3.0.0",
"bignumber.js": "^9.0.1",
"crypto-js": "^4.0.0",
"js-base64": "^3.6.1",
"long": "^4.0.0",
"protobufjs": "^6.11.2",
"utf8": "^3.0.0"
}
},
....
Hedera network
testnet
Version
v0.1.1
Operating system
macOS