Skip to content

Commit

Permalink
chore: MUSAP ecc_ed25519 support
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Dec 3, 2024
1 parent 661e959 commit 9a6d90e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
12 changes: 4 additions & 8 deletions packages/key-manager/src/agent/SphereonKeyManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class SphereonKeyManager extends VeramoKeyManager {
// local store reference, given the superclass store is private, and we need additional functions/calls
private kmsStore: AbstractKeyStore
private readonly availableKmses: Record<string, AbstractKeyManagementSystem>
public readonly _defaultKms: string
public _defaultKms: string
readonly kmsMethods: ISphereonKeyManager

constructor(options: { store: AbstractKeyStore; kms: Record<string, AbstractKeyManagementSystem>; defaultKms?: string }) {
Expand Down Expand Up @@ -155,15 +155,11 @@ export class SphereonKeyManager extends VeramoKeyManager {
return this._defaultKms
}

set defaultKms(value: string) {
if (!Object.keys(this.availableKmses).includes(value)) {
set defaultKms(kms: string) {
if (!Object.keys(this.availableKmses).includes(kms)) {
throw Error(`Default KMS needs to be listed in the kms object as well. Found kms-es: ${Object.keys(this.availableKmses).join(',')}`)
}
Object.defineProperty(this, '_defaultKms', {
value,
writable: false,
configurable: false
})
this._defaultKms = kms
}

setKms(name: string, kms: AbstractKeyManagementSystem): void {
Expand Down
2 changes: 1 addition & 1 deletion packages/kms-musap-rn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build:clean": "tsc --build --clean && tsc --build"
},
"dependencies": {
"@sphereon/musap-react-native": "0.2.1-unstable.160",
"@sphereon/musap-react-native": "0.2.1-unstable.161",
"@sphereon/ssi-sdk-ext.key-utils": "workspace:*",
"@sphereon/ssi-sdk-ext.x509-utils": "workspace:*",
"@sphereon/ssi-types": "0.30.2-feature.SDK.41.oidf.support.286",
Expand Down
4 changes: 3 additions & 1 deletion packages/kms-musap-rn/src/MusapKeyManagerSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class MusapKeyManagementSystem extends AbstractKeyManagementSystem {
const existingKeys: MusapKey[] = (this.musapClient.listKeys()) as MusapKey[]
const extKey = existingKeys.find(musapKey => musapKey.sscdType as string === 'External Signature') // FIXME returning does not match SscdType enum
if (extKey) {
extKey.algorithm = 'eccp256r1' // FIXME MUSAP announces key as rsa2k, but it's actually EC
extKey.algorithm = 'ecc_ed25519' // FIXME MUSAP announces key as rsa2k, but it's actually EC
return this.asMusapKeyInfo(extKey)
}
return Promise.reject(Error(`No external key was bound yet for sscd ${this.sscdId}`))
Expand Down Expand Up @@ -126,6 +126,8 @@ export class MusapKeyManagementSystem extends AbstractKeyManagementSystem {
return 'Secp256k1'
case 'eccp256r1':
return 'Secp256r1'
case 'ecc_ed25519':
return 'Ed25519'
case 'rsa2k':
case 'rsa4k':
return 'RSA'
Expand Down
20 changes: 11 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9a6d90e

Please sign in to comment.