@sphereon/ssi-sdk-ext.key-manager
Advanced tools
Comparing version 0.26.1-next.38 to 0.26.1-next.86
@@ -8,3 +8,3 @@ import { IKey, ManagedKeyInfo } from '@veramo/core'; | ||
private readonly availableKmses; | ||
readonly defaultKms: string; | ||
_defaultKms: string; | ||
readonly kmsMethods: ISphereonKeyManager; | ||
@@ -24,3 +24,6 @@ constructor(options: { | ||
keyManagerGet({ kid }: IKeyManagerGetArgs): Promise<IKey>; | ||
get defaultKms(): string; | ||
set defaultKms(kms: string); | ||
setKms(name: string, kms: AbstractKeyManagementSystem): void; | ||
} | ||
//# sourceMappingURL=SphereonKeyManager.d.ts.map |
@@ -56,4 +56,4 @@ "use strict"; | ||
this.availableKmses = options.kms; | ||
this.defaultKms = (_a = options.defaultKms) !== null && _a !== void 0 ? _a : Object.keys(this.availableKmses)[0]; | ||
if (!Object.keys(this.availableKmses).includes(this.defaultKms)) { | ||
this._defaultKms = (_a = options.defaultKms) !== null && _a !== void 0 ? _a : Object.keys(this.availableKmses)[0]; | ||
if (!Object.keys(this.availableKmses).includes(this._defaultKms)) { | ||
throw Error(`Default KMS needs to be listed in the kms object as well. Found kms-es: ${Object.keys(this.availableKmses).join(',')}`); | ||
@@ -68,3 +68,3 @@ } | ||
keyManagerGetDefaultKeyManagementSystem() { | ||
return Promise.resolve(this.defaultKms); | ||
return Promise.resolve(this._defaultKms); | ||
} | ||
@@ -74,3 +74,3 @@ keyManagerCreate(args) { | ||
var _a, _b, _c, _d, _e, _f; | ||
const kms = this.getKmsByName((_a = args.kms) !== null && _a !== void 0 ? _a : this.defaultKms); | ||
const kms = this.getKmsByName((_a = args.kms) !== null && _a !== void 0 ? _a : this._defaultKms); | ||
const meta = Object.assign(Object.assign({}, args.meta), (args.opts && { opts: args.opts })); | ||
@@ -82,3 +82,3 @@ if ((0, ISphereonKeyManager_1.hasKeyOptions)(meta) && ((_b = meta.opts) === null || _b === void 0 ? void 0 : _b.ephemeral) && !((_c = meta.opts.expiration) === null || _c === void 0 ? void 0 : _c.removalDate)) { | ||
const partialKey = yield kms.createKey({ type: args.type, meta }); | ||
const key = Object.assign(Object.assign({}, partialKey), { kms: (_e = args.kms) !== null && _e !== void 0 ? _e : this.defaultKms }); | ||
const key = Object.assign(Object.assign({}, partialKey), { kms: (_e = args.kms) !== null && _e !== void 0 ? _e : this._defaultKms }); | ||
key.meta = Object.assign(Object.assign({}, meta), key.meta); | ||
@@ -180,4 +180,16 @@ key.meta.jwkThumbprint = (_f = key.meta.jwkThumbprint) !== null && _f !== void 0 ? _f : (0, ssi_sdk_ext_key_utils_1.calculateJwkThumbprintForKey)({ key }); | ||
} | ||
get defaultKms() { | ||
return this._defaultKms; | ||
} | ||
set defaultKms(kms) { | ||
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(',')}`); | ||
} | ||
this._defaultKms = kms; | ||
} | ||
setKms(name, kms) { | ||
this.availableKmses[name] = kms; | ||
} | ||
} | ||
exports.SphereonKeyManager = SphereonKeyManager; | ||
//# sourceMappingURL=SphereonKeyManager.js.map |
@@ -134,3 +134,3 @@ import { AbstractKeyManagementSystem } from '@veramo/key-manager'; | ||
private readonly availableKmses; | ||
readonly defaultKms: string; | ||
_defaultKms: string; | ||
readonly kmsMethods: ISphereonKeyManager; | ||
@@ -150,2 +150,5 @@ constructor(options: { | ||
keyManagerGet({ kid }: IKeyManagerGetArgs): Promise<IKey>; | ||
get defaultKms(): string; | ||
set defaultKms(kms: string); | ||
setKms(name: string, kms: AbstractKeyManagementSystem): void; | ||
} | ||
@@ -152,0 +155,0 @@ |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.48.0" | ||
"packageVersion": "7.47.11" | ||
} | ||
] | ||
} |
{ | ||
"name": "@sphereon/ssi-sdk-ext.key-manager", | ||
"description": "Sphereon Key Manager plugin with BLS support", | ||
"version": "0.26.1-next.38+4ae483d", | ||
"version": "0.26.1-next.86+650ee51", | ||
"source": "src/index.ts", | ||
@@ -24,4 +24,4 @@ "main": "dist/index.js", | ||
"@mattrglobal/bbs-signatures": "^1.3.1", | ||
"@sphereon/ssi-sdk-ext.key-utils": "0.26.1-next.38+4ae483d", | ||
"@sphereon/ssi-sdk-ext.kms-local": "0.26.1-next.38+4ae483d", | ||
"@sphereon/ssi-sdk-ext.key-utils": "0.26.1-next.86+650ee51", | ||
"@sphereon/ssi-sdk-ext.kms-local": "0.26.1-next.86+650ee51", | ||
"@sphereon/ssi-sdk.dev": "0.30.2-feature.SDK.41.oidf.support.286" | ||
@@ -51,3 +51,3 @@ }, | ||
], | ||
"gitHead": "4ae483d7d5baf604f38dad8e5ace931612b85e2b" | ||
"gitHead": "650ee51e31a6dfa4abaf1227a5dbfdc0905f4670" | ||
} |
@@ -31,3 +31,3 @@ import { calculateJwkThumbprintForKey, toJwk, verifyRawSignature } from '@sphereon/ssi-sdk-ext.key-utils' | ||
private readonly availableKmses: Record<string, AbstractKeyManagementSystem> | ||
public readonly defaultKms: string | ||
public _defaultKms: string | ||
readonly kmsMethods: ISphereonKeyManager | ||
@@ -39,4 +39,4 @@ | ||
this.availableKmses = options.kms | ||
this.defaultKms = options.defaultKms ?? Object.keys(this.availableKmses)[0] | ||
if (!Object.keys(this.availableKmses).includes(this.defaultKms)) { | ||
this._defaultKms = options.defaultKms ?? Object.keys(this.availableKmses)[0] | ||
if (!Object.keys(this.availableKmses).includes(this._defaultKms)) { | ||
throw Error(`Default KMS needs to be listed in the kms object as well. Found kms-es: ${Object.keys(this.availableKmses).join(',')}`) | ||
@@ -52,7 +52,7 @@ } | ||
keyManagerGetDefaultKeyManagementSystem(): Promise<string> { | ||
return Promise.resolve(this.defaultKms) | ||
return Promise.resolve(this._defaultKms) | ||
} | ||
override async keyManagerCreate(args: ISphereonKeyManagerCreateArgs): Promise<ManagedKeyInfo> { | ||
const kms = this.getKmsByName(args.kms ?? this.defaultKms) | ||
const kms = this.getKmsByName(args.kms ?? this._defaultKms) | ||
const meta: KeyMetadata = { ...args.meta, ...(args.opts && { opts: args.opts }) } | ||
@@ -67,3 +67,3 @@ if (hasKeyOptions(meta) && meta.opts?.ephemeral && !meta.opts.expiration?.removalDate) { | ||
const partialKey = await kms.createKey({ type: args.type, meta }) | ||
const key: IKey = { ...partialKey, kms: args.kms ?? this.defaultKms } | ||
const key: IKey = { ...partialKey, kms: args.kms ?? this._defaultKms } | ||
key.meta = { ...meta, ...key.meta } | ||
@@ -156,2 +156,18 @@ key.meta.jwkThumbprint = key.meta.jwkThumbprint ?? calculateJwkThumbprintForKey({ key }) | ||
} | ||
get defaultKms(): string { | ||
return this._defaultKms | ||
} | ||
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(',')}`) | ||
} | ||
this._defaultKms = kms | ||
} | ||
setKms(name: string, kms: AbstractKeyManagementSystem): void { | ||
this.availableKmses[name] = kms | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
72755
1302