@sphereon/ssi-sdk-ext.did-utils
Advanced tools
Comparing version 0.12.1-next.3 to 0.12.1-next.4
@@ -128,6 +128,17 @@ "use strict"; | ||
const secp256 = new elliptic_1.default.ec(pk.publicKeyJwk.crv === 'secp256k1' ? 'secp256k1' : 'p256'); | ||
const prefix = pk.publicKeyJwk.crv === 'secp256k1' ? '04' : '03'; | ||
// const prefix = pk.publicKeyJwk.crv === 'secp256k1' ? '04' : '03' | ||
const x = u8a.fromString(pk.publicKeyJwk.x, 'base64url'); | ||
const y = u8a.fromString(pk.publicKeyJwk.y, 'base64url'); | ||
const hex = `${prefix}${u8a.toString(x, 'base16')}${u8a.toString(y, 'base16')}`; | ||
const xHex = u8a.toString(x, 'base16'); | ||
const yHex = u8a.toString(y, 'base16'); | ||
const length = x.length + y.length; | ||
let prefix = '04'; | ||
if (length === 64 || length === 65) { | ||
// raw key | ||
prefix = '04'; | ||
} | ||
else { | ||
prefix = length % 2 === 1 ? '03' : '02'; | ||
} | ||
const hex = `${prefix}${xHex}${yHex}`; | ||
// We return directly as we don't want to convert the result back into Uint8Array and then convert again to hex as the elliptic lib already returns hex strings | ||
@@ -134,0 +145,0 @@ return secp256.keyFromPublic(hex, 'hex').getPublic(true, 'hex'); |
{ | ||
"name": "@sphereon/ssi-sdk-ext.did-utils", | ||
"description": "DID Utils", | ||
"version": "0.12.1-next.3+51ae676", | ||
"version": "0.12.1-next.4+5f3d708", | ||
"source": "src/index.ts", | ||
@@ -14,3 +14,3 @@ "main": "dist/index.js", | ||
"@sphereon/did-uni-client": "^0.6.0", | ||
"@sphereon/ssi-sdk-ext.key-utils": "0.12.1-next.3+51ae676", | ||
"@sphereon/ssi-sdk-ext.key-utils": "0.12.1-next.4+5f3d708", | ||
"@veramo/core": "4.2.0", | ||
@@ -38,3 +38,3 @@ "@veramo/utils": "4.2.0", | ||
"keywords": [], | ||
"gitHead": "51ae6769386866771c68c7b7806a75b62a9d5ec1" | ||
"gitHead": "5f3d70898783d56f5aa7a36e4fd56faf5907dbeb" | ||
} |
@@ -100,6 +100,18 @@ import { UniResolver } from '@sphereon/did-uni-client' | ||
const secp256 = new elliptic.ec(pk.publicKeyJwk.crv === 'secp256k1' ? 'secp256k1' : 'p256') | ||
const prefix = pk.publicKeyJwk.crv === 'secp256k1' ? '04' : '03' | ||
// const prefix = pk.publicKeyJwk.crv === 'secp256k1' ? '04' : '03' | ||
const x = u8a.fromString(pk.publicKeyJwk.x!, 'base64url') | ||
const y = u8a.fromString(pk.publicKeyJwk.y!, 'base64url') | ||
const hex = `${prefix}${u8a.toString(x, 'base16')}${u8a.toString(y, 'base16')}` | ||
const xHex = u8a.toString(x, 'base16') | ||
const yHex = u8a.toString(y, 'base16') | ||
const length = x.length + y.length | ||
let prefix = '04' | ||
if (length === 64 || length === 65) { | ||
// raw key | ||
prefix = '04' | ||
} else { | ||
prefix = length % 2 === 1 ? '03' : '02' | ||
} | ||
const hex = `${prefix}${xHex}${yHex}` | ||
// We return directly as we don't want to convert the result back into Uint8Array and then convert again to hex as the elliptic lib already returns hex strings | ||
@@ -106,0 +118,0 @@ return secp256.keyFromPublic(hex, 'hex').getPublic(true, 'hex') |
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
54216
659