Skip to content

Commit

Permalink
chore: fixes left over from extending key types. We cannot use them y…
Browse files Browse the repository at this point in the history
…et to generate
  • Loading branch information
nklomp committed Nov 30, 2024
1 parent 69ec9a6 commit 82901d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/did-provider-key/src/SphereonKeyDidProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class SphereonKeyDidProvider extends AbstractIdentifierProvider {
type?: TKeyType
codecName?: 'EBSI' | 'jwk_jcs-pub' | Multicodec.CodecName
key?: {
type?: TKeyType
type?: Exclude<TKeyType, 'Secp384r1' | 'Secp521r1'>
privateKeyHex: string
}
}
Expand All @@ -59,7 +59,7 @@ export class SphereonKeyDidProvider extends AbstractIdentifierProvider {
let codecName = (options?.codecName?.toUpperCase() === 'EBSI' ? (JWK_JCS_PUB_NAME as Multicodec.CodecName) : options?.codecName) as
| CodeNameType
| undefined
const keyType: TKeyType = options?.type ?? options?.key?.type ?? (codecName === JWK_JCS_PUB_NAME ? 'Secp256r1' : 'Secp256k1')
const keyType = (options?.type ?? options?.key?.type ?? (codecName === JWK_JCS_PUB_NAME ? 'Secp256r1' : 'Secp256k1')) as Exclude<TKeyType, 'Secp384r1' | 'Secp521r1'>
// console.log(`keytype: ${keyType}, codecName: ${codecName}`)

const key = await importProvidedOrGeneratedKey(
Expand Down
2 changes: 1 addition & 1 deletion packages/key-utils/src/types/key-util-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface IImportProvidedOrGeneratedKeyArgs {
}
export interface IKeyOpts {
key?: Partial<MinimalImportableKey> // Optional key to import with only privateKeyHex mandatory. If not specified a key with random kid will be created
type?: TKeyType // The key type. Defaults to Secp256k1
type?: Exclude<TKeyType, 'Secp384r1' | 'Secp521r1'> // The key type. Defaults to Secp256k1
use?: JwkKeyUse // The key use
x509?: X509Opts
}
Expand Down

0 comments on commit 82901d8

Please sign in to comment.