$active_kids */ public static function checkInstall( array $active_kids, string $kid ): Result { // PHP stores decimal-string array keys as integers; wire kids stay strings. if ( in_array( $kid, array_map( 'strval', $active_kids ), true ) ) { return Result::err( 'kid_in_use', $kid . ' is already active' ); } if ( count( $active_kids ) >= Constants::MAX_ACTIVE_GRANT_KEYS ) { return Result::err( 'key_set_full', 'a third key.install without a retirement is refused' ); } return Result::ok(); } /** * Retiring a kid the set does not hold is a no-op the caller reports from * the store; retiring the last one is refused. * * @param array $active_kids */ public static function checkRetire( array $active_kids, string $kid ): Result { $kids = array_map( 'strval', $active_kids ); if ( array( $kid ) === $kids ) { return Result::err( 'key_set_empty', 'retiring ' . $kid . ' would leave this site no key to verify under' ); } return Result::ok(); } }