Skip to content

Commit 58f607f

Browse files
committed
fix: x5c is an array in a JWK
1 parent 0474bbc commit 58f607f

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

packages/did-provider-ebsi/src/EbsiDidProvider.ts

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export class EbsiDidProvider extends AbstractIdentifierProvider {
3030
throw new Error(`Type ${type} not supported. Please use @sphereon/ssi-sdk-ext.did-provider-key for Natural Person EBSI DIDs`)
3131
}
3232

33+
// CapabilityInvocation purpose
3334
const secp256k1ImportKey = await generateOrUseEbsiKeyPair(
3435
{
3536
keyOpts: secp256k1Key,
@@ -40,6 +41,7 @@ export class EbsiDidProvider extends AbstractIdentifierProvider {
4041
)
4142
const secp256k1ManagedKeyInfo = await context.agent.keyManagerImport(secp256k1ImportKey)
4243

44+
// Authentication, assertionMethod purpose
4345
const secp256r1ImportKey = await generateOrUseEbsiKeyPair(
4446
{
4547
keyOpts: secp256r1Key,

packages/did-provider-ebsi/src/functions.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export const assertedPurposes = (args: { key?: IKeyOpts }): EbsiPublicKeyPurpose
192192
if (key?.purposes && key.purposes.length > 0 && key.purposes?.includes(EbsiPublicKeyPurpose.CapabilityInvocation)) {
193193
return key.purposes
194194
}
195-
throw new Error(`Secp256k1 key requires ${EbsiPublicKeyPurpose.CapabilityInvocation} purpose`)
195+
throw new Error(`Secp256k1/ES256K key requires ${EbsiPublicKeyPurpose.CapabilityInvocation} purpose`)
196196
}
197197
case 'Secp256r1': {
198198
if (
@@ -202,7 +202,9 @@ export const assertedPurposes = (args: { key?: IKeyOpts }): EbsiPublicKeyPurpose
202202
) {
203203
return key.purposes
204204
}
205-
throw new Error(`Secp256r1 key requires ${[EbsiPublicKeyPurpose.AssertionMethod, EbsiPublicKeyPurpose.Authentication].join(', ')} purposes`)
205+
throw new Error(
206+
`Secp256r1/ES256 key requires ${[EbsiPublicKeyPurpose.AssertionMethod, EbsiPublicKeyPurpose.Authentication].join(', ')} purposes`
207+
)
206208
}
207209
default:
208210
throw new Error(`Unsupported key type: ${key.type}`)

packages/key-utils/src/types/key-util-types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const ENC_KEY_ALGS = ['X25519', 'ECDH_ES_A256KW', 'RSA_OAEP_256']
3434

3535
export interface JWK extends JsonWebKey {
3636
kid?: string
37-
x5c?: string
37+
x5c?: string[]
3838
x5u?: string
3939
}
4040

0 commit comments

Comments
 (0)