@sphereon/ssi-sdk-ext.key-utils
Advanced tools
Comparing version 0.12.1-next.8 to 0.12.1-next.9
@@ -133,5 +133,9 @@ "use strict"; | ||
const toSecp256r1Jwk = (publicKeyHex, use) => { | ||
assertProperKeyLength(publicKeyHex, 64); | ||
const prefix = ''; | ||
/*if (publicKeyHex.length === 128) { | ||
prefix = "04" | ||
}*/ | ||
const publicKey = `${prefix}${publicKeyHex}`; // We add the 'uncompressed' type 04 prefix | ||
assertProperKeyLength(publicKey, 66); | ||
const secp256r1 = new elliptic_1.default.ec('p256'); | ||
const publicKey = `03${publicKeyHex}`; // We add the 'compressed' type 03 prefix | ||
const key = secp256r1.keyFromPublic(publicKey, 'hex'); | ||
@@ -138,0 +142,0 @@ const pubPoint = key.getPublic(); |
{ | ||
"name": "@sphereon/ssi-sdk-ext.key-utils", | ||
"description": "Sphereon SSI-SDK plugin for key creation.", | ||
"version": "0.12.1-next.8+9061e29", | ||
"version": "0.12.1-next.9+f5cd4dd", | ||
"source": "src/index.ts", | ||
@@ -48,3 +48,3 @@ "main": "dist/index.js", | ||
], | ||
"gitHead": "9061e2968005931127c52febbb3326fddcd62fb2" | ||
"gitHead": "f5cd4ddd4f0cd0f155dcbf3a7e8b43c89b97cacb" | ||
} |
@@ -117,5 +117,10 @@ import { randomBytes } from '@ethersproject/random' | ||
const toSecp256r1Jwk = (publicKeyHex: string, use?: JwkKeyUse): JsonWebKey => { | ||
assertProperKeyLength(publicKeyHex, 64) | ||
const prefix = '' | ||
/*if (publicKeyHex.length === 128) { | ||
prefix = "04" | ||
}*/ | ||
const publicKey = `${prefix}${publicKeyHex}` // We add the 'uncompressed' type 04 prefix | ||
assertProperKeyLength(publicKey, 66) | ||
const secp256r1 = new elliptic.ec('p256') | ||
const publicKey = `03${publicKeyHex}` // We add the 'compressed' type 03 prefix | ||
const key = secp256r1.keyFromPublic(publicKey, 'hex') | ||
@@ -122,0 +127,0 @@ const pubPoint = key.getPublic() |
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
81736
1339