Skip to content

Commit

Permalink
fix: Await in IdentityProvider and KMS
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat committed Feb 19, 2020
1 parent 22345e0 commit a5b36d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/daf-ethr-did/src/identity-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { IdentityController } from './identity-controller'
import { keccak_256 } from 'js-sha3'
const SignerProvider = require('ethjs-provider-signer')
import Debug from 'debug'
const debug = Debug('daf:ethr-did-fs:identity-provider')
const debug = Debug('daf:ethr-did:identity-provider')

export function toEthereumAddress(hexPublicKey: string): string {
return `0x${Buffer.from(keccak_256.arrayBuffer(Buffer.from(hexPublicKey.slice(2), 'hex')))
Expand Down Expand Up @@ -91,7 +91,7 @@ export class IdentityProvider extends AbstractIdentityProvider {
controllerKeyId: key.serialized.kid,
keys: [key.serialized],
}
this.identityStore.set(serializedIdentity.did, serializedIdentity)
await this.identityStore.set(serializedIdentity.did, serializedIdentity)
debug('Created', serializedIdentity.did)
return this.identityFromSerialized(serializedIdentity)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/daf-libsodium/src/key-management-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class KeyManagementSystem extends AbstractKeyManagementSystem {
throw Error('Key type not supported: ' + type)
}

this.keyStore.set(serializedKey.kid, serializedKey)
await this.keyStore.set(serializedKey.kid, serializedKey)

debug('Created key', type, serializedKey.publicKeyHex)

Expand All @@ -96,6 +96,6 @@ export class KeyManagementSystem extends AbstractKeyManagementSystem {

async deleteKey(kid: string) {
debug('Deleting', kid)
return this.keyStore.delete(kid)
return await this.keyStore.delete(kid)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class KeyManagementSystem extends AbstractKeyManagementSystem {
throw Error('Key type not supported: ' + type)
}

this.keyStore.set(serializedKey.kid, serializedKey)
await this.keyStore.set(serializedKey.kid, serializedKey)

debug('Created key', type, serializedKey.publicKeyHex)

Expand All @@ -96,6 +96,6 @@ export class KeyManagementSystem extends AbstractKeyManagementSystem {

async deleteKey(kid: string) {
debug('Deleting', kid)
return this.keyStore.delete(kid)
return await this.keyStore.delete(kid)
}
}

0 comments on commit a5b36d9

Please sign in to comment.