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: add support for key type k256 #1722

Merged
merged 13 commits into from
Jan 31, 2024
17 changes: 8 additions & 9 deletions packages/askar/src/utils/askarKeyTypes.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { KeyType } from '@credo-ts/core'
import { KeyAlgs } from '@hyperledger/aries-askar-shared'

const keyTypeToAskarAlg = {
[KeyType.Ed25519]: KeyAlgs.Ed25519,
[KeyType.X25519]: KeyAlgs.X25519,
[KeyType.Bls12381g1]: KeyAlgs.Bls12381G1,
[KeyType.Bls12381g2]: KeyAlgs.Bls12381G2,
[KeyType.Bls12381g1g2]: KeyAlgs.Bls12381G1G2,
[KeyType.P256]: KeyAlgs.EcSecp256r1,
[KeyType.K256]: KeyAlgs.EcSecp256k1,
} as const
export enum AskarKeyTypePurpose {
KeyManagement = 'KeyManagement',
Signing = 'Signing',
}

const keyTypeToAskarAlg = {
[KeyType.Ed25519]: {
Expand All @@ -36,6 +31,10 @@ const keyTypeToAskarAlg = {
keyAlg: KeyAlgs.EcSecp256r1,
purposes: [AskarKeyTypePurpose.KeyManagement],
},
[KeyType.K256]: {
keyAlg: KeyAlgs.EcSecp256k1,
purposes: [AskarKeyTypePurpose.KeyManagement],
},
}

export const isKeyTypeSupportedByAskarForPurpose = (keyType: KeyType, purpose: AskarKeyTypePurpose) =>
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.