diff --git a/__tests__/shared/utils.ts b/__tests__/shared/utils.ts index afa6c0d8d..6fcf72f8f 100644 --- a/__tests__/shared/utils.ts +++ b/__tests__/shared/utils.ts @@ -28,8 +28,8 @@ export default (testContext: { }) it('should map identifier keys to did doc', async () => { - const ethereumAddress = `0xb09b66026ba5909a7cfe99b76875431d2b8d5190` - const did = `did:ethr:0x4:${ethereumAddress}` + const account = `0xb09b66026ba5909a7cfe99b76875431d2b8d5190` + const did = `did:ethr:0x4:${account}` const controllerKeyId = `${did}#controller` await agent.didManagerImport({ did, @@ -40,8 +40,9 @@ export default (testContext: { type: 'Secp256k1', kms: 'web3', privateKeyHex: '', + publicKeyHex: '', meta: { - ethereumAddress, + account, provider: 'metamask', algorithms: [ 'eth_signMessage', @@ -53,7 +54,7 @@ export default (testContext: { const identifier = await agent.didManagerGet({ did }) const extendedKeys = await mapIdentifierKeysToDoc(identifier, 'verificationMethod', { agent }) - expect(extendedKeys[0].meta.verificationMethod?.blockchainAccountId?.toLocaleLowerCase()).toEqual(`${ethereumAddress}@eip155:4`) + expect(extendedKeys[0].meta.verificationMethod?.blockchainAccountId?.toLocaleLowerCase()).toEqual(`${account}@eip155:4`) }) }) diff --git a/packages/utils/src/did-utils.ts b/packages/utils/src/did-utils.ts index 97ff4bc4c..e2dd2e27c 100644 --- a/packages/utils/src/did-utils.ts +++ b/packages/utils/src/did-utils.ts @@ -54,8 +54,8 @@ function compareBlockchainAccountId(localKey: IKey, verificationMethod: _Normali return false } let vmEthAddr = getEthereumAddress(verificationMethod) - if (localKey.meta?.ethereumAddress) { - return vmEthAddr === localKey.meta?.ethereumAddress + if (localKey.meta?.account) { + return vmEthAddr === localKey.meta?.account } const computedAddr = computeAddress('0x' + localKey.publicKeyHex).toLowerCase() return computedAddr === vmEthAddr @@ -88,7 +88,6 @@ export async function mapIdentifierKeysToDoc( context: IAgentContext, ): Promise<_ExtendedIKey[]> { const didDocument = await resolveDidOrThrow(identifier.did, context) - // dereference all key agreement keys from DID document and normalize const documentKeys: _NormalizedVerificationMethod[] = await dereferenceDidKeys( didDocument,