Skip to content

Commit 36be227

Browse files
chain id in blockchainAccountId
1 parent d5d8c47 commit 36be227

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

tests/iden3comm/jws.test.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
import { expect } from 'chai';
1616
import { DIDResolutionResult } from 'did-resolver';
1717
import { ES256KSigner } from 'did-jwt';
18-
import { DID, Id } from '@iden3/js-iden3-core';
18+
import { DID, getChainId, Id } from '@iden3/js-iden3-core';
1919
import { Hex } from '@iden3/js-crypto';
2020

2121
const didExample = {
@@ -58,25 +58,15 @@ const didExample = {
5858
const didExampleRecovery = {
5959
'@context': [
6060
'https://www.w3.org/ns/did/v1',
61-
'https://w3id.org/security/suites/secp256k1recovery-2020/v2',
62-
{
63-
esrs2020: 'https://identity.foundation/EcdsaSecp256k1RecoverySignature2020#',
64-
privateKeyJwk: {
65-
'@id': 'esrs2020:privateKeyJwk',
66-
'@type': '@json'
67-
},
68-
publicKeyHex: 'esrs2020:publicKeyHex',
69-
privateKeyHex: 'esrs2020:privateKeyHex',
70-
ethereumAddress: 'esrs2020:ethereumAddress'
71-
}
61+
'https://w3id.org/security/suites/secp256k1recovery-2020/v2'
7262
],
7363
id: 'did:iden3:privado:main:2SZDsdYordSH49VhS6hGo164RLwfcQe9FGow5ftSUG',
7464
verificationMethod: [
7565
{
7666
id: 'did:iden3:privado:main:2SZDsdYordSH49VhS6hGo164RLwfcQe9FGow5ftSUG#vm-1',
7767
controller: 'did:iden3:privado:main:2SZDsdYordSH49VhS6hGo164RLwfcQe9FGow5ftSUG',
7868
type: 'EcdsaSecp256k1RecoveryMethod2020',
79-
blockchainAccountId: 'eip155:1:0x964e496a1b2541ed029abd5e49fd01e41cd02995'
69+
blockchainAccountId: 'eip155:21000:0x964e496a1b2541ed029abd5e49fd01e41cd02995'
8070
}
8171
],
8272
authentication: ['did:iden3:privado:main:2SZDsdYordSH49VhS6hGo164RLwfcQe9FGow5ftSUG#vm-1']
@@ -160,13 +150,14 @@ describe('jws packer tests', () => {
160150
const ethDid = DID.parse(ethDidString);
161151
if (isEthereumIdentity(ethDid)) {
162152
const id = DID.idFromDID(ethDid);
153+
const chainId = getChainId(DID.blockchainFromId(id), DID.networkIdFromId(id));
163154
const address = Hex.encodeString(Id.ethAddressFromId(id));
164155
const vms = [
165156
{
166157
id: `${ethDidString}#vm-1`,
167158
controller: ethDidString,
168159
type: 'EcdsaSecp256k1RecoveryMethod2020',
169-
blockchainAccountId: `eip155:1:0x${address}`
160+
blockchainAccountId: `eip155:${chainId}:0x${address}`
170161
}
171162
];
172163
expect(vms[0].blockchainAccountId).to.be.eq(

0 commit comments

Comments
 (0)