@sphereon/ssi-sdk-ext.key-utils
Advanced tools
Comparing version 0.23.1-unstable.58 to 0.23.1-unstable.59
@@ -74,2 +74,3 @@ "use strict"; | ||
exports.generatePrivateKeyHex = generatePrivateKeyHex; | ||
const algorithmsFromKeyType = (type) => [type]; // TODO BEFORE PR, is correct? | ||
/** | ||
@@ -103,6 +104,13 @@ * We optionally generate and then import our own keys. | ||
} | ||
if (!privateKeyHex) { | ||
privateKeyHex = yield (0, exports.generatePrivateKeyHex)(type); | ||
if (privateKeyHex) { | ||
return context.agent.keyManagerImport(Object.assign(Object.assign({}, key), { kms: args.kms, type, privateKeyHex: privateKeyHex })); | ||
} | ||
return context.agent.keyManagerImport(Object.assign(Object.assign({}, key), { kms: args.kms, type, privateKeyHex: privateKeyHex })); | ||
return context.agent.keyManagerCreate({ | ||
type, | ||
kms: args.kms, | ||
meta: { | ||
algorithms: algorithmsFromKeyType(type), | ||
keyAlias: args.alias, | ||
}, | ||
}); | ||
}); | ||
@@ -109,0 +117,0 @@ } |
@@ -71,2 +71,3 @@ import { MinimalImportableKey } from '@veramo/core'; | ||
kms?: string; | ||
alias?: string; | ||
options?: IKeyOpts; | ||
@@ -73,0 +74,0 @@ } |
{ | ||
"name": "@sphereon/ssi-sdk-ext.key-utils", | ||
"description": "Sphereon SSI-SDK plugin for key creation.", | ||
"version": "0.23.1-unstable.58+9828ed6", | ||
"version": "0.23.1-unstable.59+6d69f8c", | ||
"source": "src/index.ts", | ||
@@ -49,3 +49,3 @@ "main": "dist/index.js", | ||
], | ||
"gitHead": "9828ed65b9e3afe947e29fcf16c4d566f6fd5383" | ||
"gitHead": "6d69f8cdf4c91cf9b60d6d63683cd2729f5bd369" | ||
} |
@@ -40,2 +40,4 @@ import { randomBytes } from '@ethersproject/random' | ||
const algorithmsFromKeyType = (type: string): string[] => [type] // TODO BEFORE PR, is correct? | ||
/** | ||
@@ -80,11 +82,18 @@ * We optionally generate and then import our own keys. | ||
} | ||
if (!privateKeyHex) { | ||
privateKeyHex = await generatePrivateKeyHex(type) | ||
if (privateKeyHex) { | ||
return context.agent.keyManagerImport({ | ||
...key, | ||
kms: args.kms, | ||
type, | ||
privateKeyHex: privateKeyHex!, | ||
}) | ||
} | ||
return context.agent.keyManagerImport({ | ||
...key, | ||
return context.agent.keyManagerCreate({ | ||
type, | ||
kms: args.kms, | ||
type, | ||
privateKeyHex: privateKeyHex!, | ||
meta: { | ||
algorithms: algorithmsFromKeyType(type), | ||
keyAlias: args.alias, | ||
}, | ||
}) | ||
@@ -91,0 +100,0 @@ } |
@@ -82,2 +82,3 @@ import { MinimalImportableKey } from '@veramo/core' | ||
kms?: string | ||
alias?: string | ||
options?: IKeyOpts | ||
@@ -84,0 +85,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
138871
2237