build/authorify.js
function(filter) {
      var rval = {};

      var localKeyId;
      if('localKeyId' in filter) {
        localKeyId = filter.localKeyId;
      } else if('localKeyIdHex' in filter) {
        localKeyId = forge.util.hexToBytes(filter.localKeyIdHex);
      }

      // filter on bagType only
      if(localKeyId === undefined && !('friendlyName' in filter) &&
        'bagType' in filter) {
        rval[filter.bagType] = _getBagsByAttribute(
          pfx.safeContents, null, null, filter.bagType);
      }

      if(localKeyId !== undefined) {
        rval.localKeyId = _getBagsByAttribute(
          pfx.safeContents, 'localKeyId',
          localKeyId, filter.bagType);
      }
      if('friendlyName' in filter) {
        rval.friendlyName = _getBagsByAttribute(
          pfx.safeContents, 'friendlyName',
          filter.friendlyName, filter.bagType);
      }

      return rval;
    }
function(filter) {
      var rval = {};

      var localKeyId;
      if('localKeyId' in filter) {
        localKeyId = filter.localKeyId;
      } else if('localKeyIdHex' in filter) {
        localKeyId = forge.util.hexToBytes(filter.localKeyIdHex);
      }

      // filter on bagType only
      if(localKeyId === undefined && !('friendlyName' in filter) &&
        'bagType' in filter) {
        rval[filter.bagType] = _getBagsByAttribute(
          pfx.safeContents, null, null, filter.bagType);
      }

      if(localKeyId !== undefined) {
        rval.localKeyId = _getBagsByAttribute(
          pfx.safeContents, 'localKeyId',
          localKeyId, filter.bagType);
      }
      if('friendlyName' in filter) {
        rval.friendlyName = _getBagsByAttribute(
          pfx.safeContents, 'friendlyName',
          filter.friendlyName, filter.bagType);
      }

      return rval;
    }
function ( filter ) { var rval = { } ; var localKeyId ; if ( 'localKeyId' in filter ) { localKeyId = filter . localKeyId ; } else if ( 'localKeyIdHex' in filter ) { localKeyId = forge . util . hexToBytes ( filter . localKeyIdHex ) ; } // filter on bagType only if ( localKeyId === undefined && ! ( 'friendlyName' in filter ) && 'bagType' in filter ) { rval [ filter . bagType ] = _getBagsByAttribute ( pfx . safeContents , null , null , filter . bagType ) ; } if ( localKeyId !== undefined ) { rval . localKeyId = _getBagsByAttribute ( pfx . safeContents , 'localKeyId' , localKeyId , filter . bagType ) ; } if ( 'friendlyName' in filter ) { rval . friendlyName = _getBagsByAttribute ( pfx . safeContents , 'friendlyName' , filter . friendlyName , filter . bagType ) ; } return rval ; }
Gets bags with matching attributes.

@param filter the attributes to filter by:
[localKeyId] the localKeyId to search for.
[localKeyIdHex] the localKeyId in hex to search for.
[friendlyName] the friendly name to search for.
[bagType] bag type to narrow each attribute search by.

@return a map of attribute type to an array of matching bags or, if no
attribute was given but a bag type, the map key will be the
bag type.
Gets bags with matching attributes .