Skip to content

Commit

Permalink
fix: EthrDIDProvider config
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat committed Nov 2, 2022
1 parent 246595f commit 83b8feb
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 15 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## Before

```bash
➜ yarn start
yarn run v1.22.19
Expand Down Expand Up @@ -34,4 +36,30 @@ Error: missing provider (operation="sendTransaction", code=UNSUPPORTED_OPERATION
code: 'UNSUPPORTED_OPERATION',
operation: 'sendTransaction'
}
```

## After

```bash
➜ yarn start
yarn run v1.22.19
$ ts-node ./add-key
Identifier did:ethr:goerli:0x020a5d2291181edfdcbd91b14e1c3b6b7e39b1c18ed19b3eace01b52318d88157a
New key {
type: 'Secp256k1',
kid: '04bf7d8c740f0ac42ba7a8dd703272776ea64116509b3dfbb363bc6c210d0a5e3795881708c9e367cf344cb980947acba66657a18cb3cf4ddc0998f510ff4c52b5',
publicKeyHex: '04bf7d8c740f0ac42ba7a8dd703272776ea64116509b3dfbb363bc6c210d0a5e3795881708c9e367cf344cb980947acba66657a18cb3cf4ddc0998f510ff4c52b5',
meta: {
algorithms: [
'ES256K',
'ES256K-R',
'eth_signTransaction',
'eth_signTypedData',
'eth_signMessage',
'eth_rawSign'
]
},
kms: 'local'
}
0x5617a43dcbf7914460fd4d4c71e0fa3c1fa87c60ad5a2042b63f10724181042b
```
5 changes: 1 addition & 4 deletions add-key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import { agent } from './setup'

const main = async () => {
const identifier = await agent.didManagerGetOrCreate({
alias: 'default',
options: {
network: 'goerli'
}
alias: 'default'
})

console.log('Identifier', identifier.did)
Expand Down
18 changes: 7 additions & 11 deletions setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,15 @@ export const agent = createAgent<IDIDManager & IKeyManager>({
}),
new DIDManager({
store: new DIDStore(dbConnection),
defaultProvider: 'did:ethr',
defaultProvider: 'did:ethr:goerli',
providers: {
'did:ethr': new EthrDIDProvider({
'did:ethr:goerli': new EthrDIDProvider({
defaultKms: 'local',
networks: [
{
network: 'goerli',
name: 'goerli',
rpcUrl: 'https://goerli.infura.io/v3/' + INFURA_PROJECT_ID,
gas: 1000001,
ttl: 31104001
},
],
network: 'goerli',
name: 'goerli',
rpcUrl: 'https://goerli.infura.io/v3/' + INFURA_PROJECT_ID,
gas: 1000001,
ttl: 31104001
}),
},
}),
Expand Down

0 comments on commit 83b8feb

Please sign in to comment.