Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(kms-web3): listKeys #965

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion packages/kms-web3/src/web3-key-management-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,28 @@ export class Web3KeyManagementSystem extends AbstractKeyManagementSystem {
}

async listKeys(): Promise<ManagedKeyInfo[]> {
throw Error('not_implemented: Web3KeyManagementSystem listKeys')
const keys: ManagedKeyInfo[] = []
for (const provider in this.providers) {
const accounts = await this.providers[provider].listAccounts()
for (const account of accounts) {
const key: ManagedKeyInfo = {
kid: `${provider}-${account}`,
type: 'Secp256k1',
publicKeyHex: '',
kms: '',
meta: {
account,
provider,
algorithms: [
'eth_signMessage',
'eth_signTypedData',
]
}
}
keys.push(key)
}
}
return keys
}

async sharedSecret(args: {
Expand Down