public/verifier/signature.js
// Select the first key in the key collection where 'kid' equals the 'kid' in the Jws-Header
Select the first key in the key collection where 'kid' equals the 'kid' in the Jws-Header
Select the first key in the key collection where ' kid ' equals the ' kid ' in the Jws - Header
function selectKey() {
        let keySet = secDownloadKey.getValue();
        keySet = tryParse(keySet);
        if (!keySet) {
            sec.clear();
            sec.setErrors(["Cannot parse KeySet"]);
            return;
        };
        let jwsHeader = secDecodeJWS.getValue(0 );
        jwsHeader = tryParse(jwsHeader);
        if (!jwsHeader) {
            sec.clear();
            sec.setErrors(["Cannot parse JWS header"]);
            return;
        };
        for (let i = 0; i < keySet.keys.length; i++) {
            const key = keySet.keys[i];
            delete key["alg"];
            if (key.kid.toUpperCase() === jwsHeader.kid.toUpperCase()) {
                return key;
            }
        }
        sec.clear();
        sec.setErrors(["Cannot find key with matching \'kid\'."]);
        return null;
    }
function selectKey ( ) { let keySet = secDownloadKey . getValue ( ) ; keySet = tryParse ( keySet ) ; if ( ! keySet ) { sec . clear ( ) ; sec . setErrors ( [ "Cannot parse KeySet" ] ) ; return ; } ; let jwsHeader = secDecodeJWS . getValue ( 0 ) ; jwsHeader = tryParse ( jwsHeader ) ; if ( ! jwsHeader ) { sec . clear ( ) ; sec . setErrors ( [ "Cannot parse JWS header" ] ) ; return ; } ; for ( let i = 0 ; i < keySet . keys . length ; i ++ ) { const key = keySet . keys [ i ] ; delete key [ "alg" ] ; if ( key . kid . toUpperCase ( ) === jwsHeader . kid . toUpperCase ( ) ) { return key ; } } sec . clear ( ) ; sec . setErrors ( [ "Cannot find key with matching \'kid\'." ] ) ; return null ; }
Select the first key in the key collection where 'kid' equals the 'kid' in the Jws-Header
Select the first key in the key collection where ' kid ' equals the ' kid ' in the Jws - Header
/*header*/