code: func (ssa *SQLStorageAuthority) GetAuthorizations(
  	ctx context.Context,
  	req *sapb.GetAuthorizationsRequest) (*sapb.Authorizations, error) {
  	authzMap, err := ssa.getAuthorizations(
  		ctx,
  		authorizationTable,
  		string(core.StatusValid),
  		*req.RegistrationID,
  		req.Domains,
  		time.Unix(0, *req.Now),
  		*req.RequireV2Authzs,
  	)
  	if err != nil {
  		return nil, err
  	}
  	if len(authzMap) == len(req.Domains) {
  		return authzMapToPB(authzMap)
  	}
  
  	// remove names we already have authz for
  	remainingNames := []string{}
  	for _, name := range req.Domains {
  		if _, present := authzMap[name]; !present {
  			remainingNames = append(remainingNames, name)
  		}
  	}
  	pendingAuthz, err := ssa.getPendingAuthorizations(
  		ctx,
  		*req.RegistrationID,
  		remainingNames,
  		time.Unix(0, *req.Now),
  		*req.RequireV2Authzs)
  	if err != nil {
  		return nil, err
  	}
  	// merge pending into valid
  	for name, a := range pendingAuthz {
  		authzMap[name] = a
  	}
  
  	// Wildcard domain issuance requires that the authorizations returned by this
  	// RPC also include populated challenges such that the caller can know if the
  	// challenges meet the wildcard issuance policy (e.g. only 1 DNS-01
  	// challenge).
  	// Fetch each of the authorizations' associated challenges
  	for _, authz := range authzMap {
  		authz.Challenges, err = ssa.getChallenges(ssa.dbMap.WithContext(ctx), authz.ID)
  		if err != nil {
  			return nil, err
  		}
  	}
  	return authzMapToPB(authzMap)
  }
docs: // GetAuthorizations returns a map of valid or pending authorizations for as many names as possible