@sphereon/ssi-sdk-ext.key-utils
Advanced tools
Comparing version 0.24.1-next.111 to 0.24.1-next.112
@@ -7,2 +7,9 @@ import { JoseSignatureAlgorithm, JWK } from '@sphereon/ssi-types'; | ||
/** | ||
* Function that returns the provided KMS name or the default KMS name if none is provided. | ||
* The default KMS is either explicitly defined during agent construction, or the first KMS available in the system | ||
* @param context | ||
* @param kms. Optional KMS to use. If provided will be the returned name. Otherwise the default KMS will be returned | ||
*/ | ||
export declare const getKms: (context: IAgentContext<any>, kms?: string) => Promise<string>; | ||
/** | ||
* Generates a random Private Hex Key for the specified key type | ||
@@ -9,0 +16,0 @@ * @param type The key type |
@@ -38,3 +38,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.verifySignatureWithSubtle = exports.keyTypeFromCryptographicSuite = exports.signatureAlgorithmFromKeyType = exports.signatureAlgorithmFromKey = exports.hexStringFromUint8Array = exports.toRawCompressedHexPublicKey = exports.isRawCompressedPublicKey = exports.asn1DerToRawPublicKey = exports.isAsn1Der = exports.padLeft = exports.jwkDetermineUse = exports.toJwk = exports.toJwkFromKey = exports.calculateJwkThumbprint = exports.toBase64url = exports.calculateJwkThumbprintForKey = exports.importProvidedOrGeneratedKey = exports.generatePrivateKeyHex = exports.logger = void 0; | ||
exports.verifySignatureWithSubtle = exports.keyTypeFromCryptographicSuite = exports.signatureAlgorithmFromKeyType = exports.signatureAlgorithmFromKey = exports.hexStringFromUint8Array = exports.toRawCompressedHexPublicKey = exports.isRawCompressedPublicKey = exports.asn1DerToRawPublicKey = exports.isAsn1Der = exports.padLeft = exports.jwkDetermineUse = exports.toJwk = exports.toJwkFromKey = exports.calculateJwkThumbprint = exports.toBase64url = exports.calculateJwkThumbprintForKey = exports.importProvidedOrGeneratedKey = exports.generatePrivateKeyHex = exports.getKms = exports.logger = void 0; | ||
const random_1 = require("@ethersproject/random"); | ||
@@ -50,2 +50,18 @@ const ssi_sdk_ext_x509_utils_1 = require("@sphereon/ssi-sdk-ext.x509-utils"); | ||
/** | ||
* Function that returns the provided KMS name or the default KMS name if none is provided. | ||
* The default KMS is either explicitly defined during agent construction, or the first KMS available in the system | ||
* @param context | ||
* @param kms. Optional KMS to use. If provided will be the returned name. Otherwise the default KMS will be returned | ||
*/ | ||
const getKms = (context, kms) => __awaiter(void 0, void 0, void 0, function* () { | ||
if (kms) { | ||
return kms; | ||
} | ||
if (!context.agent.availableMethods().includes('keyManagerGetDefaultKeyManagementSystem')) { | ||
throw Error('Cannot determine default KMS if not provided and a non Sphereon Key Manager is being used'); | ||
} | ||
return context.agent.keyManagerGetDefaultKeyManagementSystem(); | ||
}); | ||
exports.getKms = getKms; | ||
/** | ||
* Generates a random Private Hex Key for the specified key type | ||
@@ -52,0 +68,0 @@ * @param type The key type |
{ | ||
"name": "@sphereon/ssi-sdk-ext.key-utils", | ||
"description": "Sphereon SSI-SDK plugin for key creation.", | ||
"version": "0.24.1-next.111+967cf87", | ||
"version": "0.24.1-next.112+c0ca69f", | ||
"source": "src/index.ts", | ||
@@ -14,3 +14,3 @@ "main": "dist/index.js", | ||
"@ethersproject/random": "^5.7.0", | ||
"@sphereon/ssi-sdk-ext.x509-utils": "0.24.1-next.111+967cf87", | ||
"@sphereon/ssi-sdk-ext.x509-utils": "0.24.1-next.112+c0ca69f", | ||
"@sphereon/ssi-types": "0.29.1-unstable.161", | ||
@@ -53,3 +53,3 @@ "@stablelib/ed25519": "^1.0.3", | ||
], | ||
"gitHead": "967cf877695f548a7026a6307fd5f13fe372b520" | ||
"gitHead": "c0ca69fe0f10cfd9cdafa94b7af31a6cf6100680" | ||
} |
@@ -25,2 +25,18 @@ import { randomBytes } from '@ethersproject/random' | ||
/** | ||
* Function that returns the provided KMS name or the default KMS name if none is provided. | ||
* The default KMS is either explicitly defined during agent construction, or the first KMS available in the system | ||
* @param context | ||
* @param kms. Optional KMS to use. If provided will be the returned name. Otherwise the default KMS will be returned | ||
*/ | ||
export const getKms = async (context: IAgentContext<any>, kms?: string): Promise<string> => { | ||
if (kms) { | ||
return kms | ||
} | ||
if (!context.agent.availableMethods().includes('keyManagerGetDefaultKeyManagementSystem')) { | ||
throw Error('Cannot determine default KMS if not provided and a non Sphereon Key Manager is being used') | ||
} | ||
return context.agent.keyManagerGetDefaultKeyManagementSystem() | ||
} | ||
/** | ||
* Generates a random Private Hex Key for the specified key type | ||
@@ -27,0 +43,0 @@ * @param type The key type |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
142697
2308