Skip to content

Commit

Permalink
chore: mapAlgorithmTypeToKeyType
Browse files Browse the repository at this point in the history
  • Loading branch information
sksadjad committed Jul 29, 2024
1 parent 3276868 commit c81752e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/musap-rn-kms/src/agent/MusapKeyManagerSystem.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IKey, ManagedKeyInfo, MinimalImportableKey, TKeyType } from '@veramo/core'
import {
KeyAlgorithm,
KeyAlgorithmType,
KeyGenReq,
MusapKey,
Expand Down Expand Up @@ -76,13 +77,13 @@ export class MusapKeyManagementSystem extends AbstractKeyManagementSystem {
}
}

mapAlgorithmTypeToKeyType = (type: KeyAlgorithmType): TKeyType => {
mapAlgorithmTypeToKeyType = (type: KeyAlgorithm): TKeyType => {
switch (type) {
case 'ECCP256K1':
case 'eccp256k1':
return 'Secp256k1'
case 'ECCP256R1':
case 'eccp256r1':
return 'Secp256r1'
case 'RSA2K':
case 'rsa4k':
return 'RSA'
default:
throw new Error(`Key type ${type} is not supported.`)
Expand Down Expand Up @@ -126,7 +127,7 @@ export class MusapKeyManagementSystem extends AbstractKeyManagementSystem {
private asMusapKeyInfo(args: MusapKey): ManagedKeyInfo {
const keyInfo: Partial<ManagedKeyInfo> = {
kid: args.keyId,
type: this.mapAlgorithmTypeToKeyType(args.keyType),
type: this.mapAlgorithmTypeToKeyType(args.algorithm),
publicKeyHex: args.publicKey.toString(),
meta: {
...args,
Expand Down

0 comments on commit c81752e

Please sign in to comment.