You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
It came to notice that we will need to use meta-transaction with options: { metaIdentifierKeyId } for didManagerAddService as it is encapsulated as eth_sendTransaction RPC call under the hood.
However, despite setting up the parameters accordingly in correspond to the discussion thread in Discord which will be elaborated in To Reproduce section, the didManagerAddService still failed with the error shown in Observed behaviour section.
Create add-service-endpoint.ts and insert the following:
import{computePublicKey,SigningKey}from'@ethersproject/signing-key';import*asu8afrom'uint8arrays';import{MinimalImportableKey}from'@veramo/core';import{agent}from'./setup';asyncfunctionmain(){try{// Helper function to find or create did if not found with default alias// Added for ease of test and reproduceconstdidToBeUpdated=awaitfindOrCreateNewDid();if(didToBeUpdated){// Helper function to create DID from private key that holds fundconstimportedIdentifier=awaitgetMetaIdentifier();constres=awaitagent.didManagerAddService({did: didToBeUpdated.did,service: {id: `${didToBeUpdated.did}#Test`,type: 'Test',serviceEndpoint: 'https://test.example.com',},options: {metaIdentifierKeyId: importedIdentifier.controllerKeyId},});console.log('success update DIDDoc of',didToBeUpdated.did,"with txHash: ",res);}}catch(e){console.error(e);}}main().catch(console.log);functionimportableKeyFromPrivateKey(privateKeyHex: string,kms: string,): MinimalImportableKey{constprivateBytes=u8a.fromString(privateKeyHex.toLowerCase(),'base16');constkeyPair=newSigningKey(privateBytes);constpublicKeyHex=keyPair.publicKey.substring(2);return{type: 'Secp256k1',kid: publicKeyHex,
privateKeyHex,
publicKeyHex,
kms,meta: {algorithms: ['ES256K','ES256K-R','eth_signTransaction','eth_signTypedData','eth_signMessage','eth_rawSign',],},};};asyncfunctiongetMetaIdentifier(){constprivateKeyHex=process.env.WALLET_PRIVATE_KEY??'';constkey=importableKeyFromPrivateKey(privateKeyHex,'local');constcompressedPublicKey=computePublicKey(`0x${key.publicKeyHex}`,true);constimportedDid=`did:ethr:linea:goerli:${compressedPublicKey}`;returnawaitagent.didManagerImport({did: importedDid,provider: 'did:ethr:linea:goerli',controllerKeyId: key.kid??`test`,keys: [key],services: [],});}asyncfunctionfindOrCreateNewDid(){constdids=awaitagent.didManagerFind({alias: 'linea-goerli-test'});console.log(`There are ${dids.length} identifiers`);if(dids.length>0){if(dids.length==1)returndids[0];}else{constnewDid=awaitagent.didManagerCreate({alias: 'linea-goerli-test'});console.log(`New did created:`);console.log(JSON.stringify(newDid,null,2));returnnewDid;}}
Should have the similar file structure upon the steps above:
Run npm run execute-with-env add-service-endpoint.ts at project root directory and fails with error shown in Observed behaviour
Observed behaviour
Error: missing provider (operation="sendTransaction", code=UNSUPPORTED_OPERATION, version=abstract-signer/5.7.0)
at Logger.Logger.makeError (<home-path>/veramo-meta-tx-issue/node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
at Logger.Logger.throwError (<home-path>/veramo-meta-tx-issue/node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
at KmsEthereumSigner.Signer._checkProvider (<home-path>/veramo-meta-tx-issue/node_modules/@ethersproject/abstract-signer/src.ts/index.ts:330:38)
at KmsEthereumSigner.<anonymous> (<home-path>/veramo-meta-tx-issue/node_modules/@ethersproject/abstract-signer/src.ts/index.ts:123:14)
at step (<home-path>/veramo-meta-tx-issue/node_modules/@ethersproject/abstract-signer/src.ts/index.ts:1:14)
at Object.next (<home-path>/veramo-meta-tx-issue/node_modules/@ethersproject/abstract-signer/src.ts/index.ts:1:14)
at <anonymous> (<home-path>/veramo-meta-tx-issue/node_modules/@ethersproject/abstract-signer/src.ts/index.ts:1:14)
at new Promise (<anonymous>)
at __awaiter (<home-path>/veramo-meta-tx-issue/node_modules/@ethersproject/abstract-signer/src.ts/index.ts:1:14)
at KmsEthereumSigner.Signer.sendTransaction (<home-path>/veramo-meta-tx-issue/node_modules/@ethersproject/abstract-signer/src.ts/index.ts:122:70) {
reason: 'missing provider',
code: 'UNSUPPORTED_OPERATION',
operation: 'sendTransaction'
}
Expected behaviour
It show success with txHashfrom didManagerAddService
success update DIDDoc of: did:ethr:linea:goerli:0x01g6..8t7p with txHash: <txHash generated from the transaction sent to provider>
Example of success behavior will be illustrated in Details section with further elaboration
Details
Upon encountered with the Observed behaviour, I have tried to utilize the deprecated attributes in setup.ts:
Run npm run execute-with-env add-service-endpoint.ts at project root directory and it will success as shown below:
success update DIDDoc of: did:ethr:linea:goerli:0x01g6..8t7p with txHash: 0x56548..fe5f
To verify the updated DID, create list-did.ts and insert the following:
import{agent}from'./setup'asyncfunctionmain(){constidentifiers=awaitagent.didManagerFind({alias: 'linea-goerli-test'});console.log(`There are ${identifiers.length} identifiers`)if(identifiers.length>0){identifiers.map((id)=>{console.log(id)console.log('..................')})}}main().catch(console.log)
Run npm run execute-with-env list-did.ts and we could see that service is added as shown below:
Just wonder is this didManagerAddService with options: { metaIdentifierKeyId } function supported yet in CLI tool
Apparently the local integration test does not cover for such use case yet on testnet network hence it is probably overlooked while doing the migration from deprecated attributes to networks[].
Versions:
Veramo: 5.5.3
Browser : N/A
Node Version: v21.1.0
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Bug severity
3
Describe the bug
It came to notice that we will need to use meta-transaction with
options: { metaIdentifierKeyId }
fordidManagerAddService
as it is encapsulated aseth_sendTransaction
RPC call under the hood.However, despite setting up the parameters accordingly in correspond to the discussion thread in Discord which will be elaborated in
To Reproduce
section, thedidManagerAddService
still failed with the error shown inObserved behaviour
section.The code example is derived from Veramo Node Tutorial Example
To Reproduce
Steps to reproduce the behaviour (Linux OS):
Create empty folder with NodeJS installed (version stated below).
Create
.env
file with following:Obtain the following environment variable as followed:
INFURA_API_KEY
npx @veramo/cli config create-secret-key
and copy output toKMS_SECRET_KEY
WALLET_PRIVATE_KEY
. Take note to get testnet token from Linea Goerli faucet.The example of final
.env
file:Create
package.json
and insert the following:Run
npm install
to install all dependenciesCreate
tsconfig.json
and insert the following:Create
setup.ts
and insert the following:Create
add-service-endpoint.ts
and insert the following:Should have the similar file structure upon the steps above:
Run
npm run execute-with-env add-service-endpoint.ts
at project root directory and fails with error shown in Observed behaviourObserved behaviour
Expected behaviour
It show success with
txHash
fromdidManagerAddService
Example of success behavior will be illustrated in Details section with further elaboration
Details
deprecated attributes
insetup.ts
:npm run execute-with-env add-service-endpoint.ts
at project root directory and it will success as shown below:list-did.ts
and insert the following:npm run execute-with-env list-did.ts
and we could see that service is added as shown below:Additional context
didManagerAddService with options: { metaIdentifierKeyId }
function supported yet in CLI tooltestnet network
hence it is probably overlooked while doing the migration fromdeprecated attributes
tonetworks[]
.Versions:
5.5.3
N/A
v21.1.0
The text was updated successfully, but these errors were encountered: