Skip to content

Commit

Permalink
fix: Daf-libsodium debug
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat authored and mirceanis committed Sep 7, 2020
1 parent 688595f commit babbfe6
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/daf-libsodium/src/key-management-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import Debug from 'debug'
const debug = Debug('daf:sodium:kms')

export class KeyManagementSystem extends AbstractKeyManagementSystem {

async createKey({ type }: { type: TKeyType }): Promise<Omit<IKey, 'kms'>> {
let key: Omit<IKey, "kms">
let key: Omit<IKey, 'kms'>

switch (type) {
case 'Ed25519':
Expand All @@ -38,7 +37,6 @@ export class KeyManagementSystem extends AbstractKeyManagementSystem {
throw Error('Key type not supported: ' + type)
}


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

return key
Expand All @@ -49,7 +47,7 @@ export class KeyManagementSystem extends AbstractKeyManagementSystem {
return true
}

async encryptJWE({ key, to, data}: { key: IKey; to: IKey; data: string }): Promise<string> {
async encryptJWE({ key, to, data }: { key: IKey; to: IKey; data: string }): Promise<string> {
await didcomm.ready
return await didcomm.pack_anon_msg_for_recipients(data, [
Uint8Array.from(Buffer.from(to.publicKeyHex, 'hex')),
Expand All @@ -70,13 +68,11 @@ export class KeyManagementSystem extends AbstractKeyManagementSystem {
}

async signEthTX({ key, transaction }: { key: IKey; transaction: object }): Promise<string> {
debug('signEthTX', {key, transaction})
return sign(transaction, '0x' + key.privateKeyHex)
}

async signJWT({ key, data }: { key: IKey; data: string }): Promise<EcdsaSignature | string> {
const signer = SimpleSigner(key.privateKeyHex)
return signer(data)
}

}

0 comments on commit babbfe6

Please sign in to comment.