@@ -73,9 +73,11 @@ export async function exportPrivateKey(privateKey, format = "pem") {
7373export async function publicKeyFingerprint ( publicKey ) {
7474 const key = await crypto . subtle . exportKey ( "raw" , publicKey ) ;
7575 const msgBuffer = new TextEncoder ( ) . encode ( key ) ;
76- const hashBuffer = await crypto . subtle . digest ( ' SHA-256' , msgBuffer ) ;
76+ const hashBuffer = await crypto . subtle . digest ( " SHA-256" , msgBuffer ) ;
7777 const hashArray = Array . from ( new Uint8Array ( hashBuffer ) ) ;
78- const hashHex = hashArray . map ( b => b . toString ( 16 ) . padStart ( 2 , '0' ) ) . join ( '' ) ;
78+ const hashHex = hashArray
79+ . map ( ( b ) => b . toString ( 16 ) . padStart ( 2 , "0" ) )
80+ . join ( "" ) ;
7981 return hashHex ;
8082}
8183
@@ -145,9 +147,16 @@ export async function bifrostId(namespace, pubKey) {
145147 */
146148function formatPEM ( type , buffer ) {
147149 return `-----BEGIN ${ type } -----\n${ toBase64 (
148- arrayBufferToString ( buffer ) ) . replace ( / ( .{ 64 } ) / g, "$1\n" ) } \n-----END ${ type } -----`;
150+ arrayBufferToString ( buffer ) ,
151+ ) . replace ( / ( .{ 64 } ) / g, "$1\n" ) } \n-----END ${ type } -----`;
149152}
150153
154+ /**
155+ *
156+ * @param {string } signAlg
157+ * @param {string } hashAlg
158+ * @returns {pkijs.CryptoEngineAlgorithmParams }
159+ */
151160function getAlgorithm ( signAlg , hashAlg ) {
152161 const algorithm = getAlgorithmParameters ( signAlg , "generatekey" ) ;
153162 if ( "hash" in algorithm . algorithm ) algorithm . algorithm . hash . name = hashAlg ;
0 commit comments